Skip to main content
Loading navigation
Back to prompt library

Define Pydantic AI Physics Agent

Linked challenge: Water Utility Physical Cyber Attack Monitoring with Pydantic AI

Prompt source

implementation8 lines4 sectionsNo variables0 checklist items
from pydantic import BaseModel, Field
from pydantic_ai import Agent

class TelemetryReport(BaseModel):
    physical_violation: bool
    anomaly_type: str
    certainty: float = Field(ge=0.0, le=1.0)

agent = Agent('openai:gpt-4o', result_type=TelemetryReport)

# Implement agent tool to evaluate fluid mass conservation