from pydantic import BaseModel, Field
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
class ReviewInput(BaseModel):
text: str
product_id: str
class SentimentResult(BaseModel):
sentiment: str = Field(description="positive, negative, or neutral")
confidence: float = Field(ge=0, le=1)
summary: str = Field(description="One sentence summary")
agent = Agent(
model=OpenAIResponses(id="gpt-5.2"),
output_schema=SentimentResult,
)
response = agent.run(
input=ReviewInput(text="Love this product!", product_id="SKU-123")
)
result: SentimentResult = response.content
print(result.sentiment) # "positive"
print(result.confidence) # 0.95