Back to prompt library
Pydantic AI Agent Setup
Linked challenge: Pydantic AI & Dify Anti-Money Laundering Sharing Agent
Prompt source
implementation8 lines4 sectionsNo variables0 checklist items
from pydantic import BaseModel, Field
from pydantic_ai import Agent, RunContext
class CosmicAlert(BaseModel):
risk_level: str = Field(description='LOW, MEDIUM, or HIGH')
confidence: float = Field(ge=0.0, le=1.0)
redacted_payload: str
agent = Agent('openai:gpt-4o', result_type=CosmicAlert, system_prompt='You are a COSMIC ML/TF Compliance Analyst.')
# Implement tool dependency injection and run method here