Im trying to use an agent that is defined with a resoponse_model in the playground, but for some reason it seems to be idle and not running the agent: for example with this code running the agent locally everything works well:
import asyncio
from typing import Optional
from pydantic import BaseModel, Field
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.playground import Playground
class Result(BaseModel):
domain: str = Field(..., description="The root domain that was searched")
privacy_policy_url: str = Field(..., description="Direct URL to the privacy policy page")
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
response_model=Result,
use_json_mode=True,
description="Privacy policy finder agent"
)
if __name__ == "__main__":
asyncio.run(agent.aprint_response("Find privacy policy for netflix.com", markdown=True))
everything works well:
┏━ Message ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ Find privacy policy for netflix.com ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━ Response (0.7s) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ { ┃
┃ "domain": "netflix.com", ┃
┃ "privacy_policy_url": "https://help.netflix.com/legal/privacy" ┃
┃ } ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
but when i run it using playground as such:
import asyncio
from typing import Optional
from pydantic import BaseModel, Field
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.playground import Playground
class Result(BaseModel):
domain: str = Field(..., description="The root domain that was searched")
privacy_policy_url: str = Field(..., description="Direct URL to the privacy policy page")
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
response_model=Result,
description="Privacy policy finder agent",
markdown=True,
)
playground = Playground(agents=[agent])
app = playground.get_app()
if __name__ == "__main__":
playground.serve("sample:app", reload=True)
nothing happens in the playground when i sen the message, it seems stuck:
I tried using use_json_mode
, stream
but with no luck.
when i remove the response_model=Result
it works well in playground but i want it to be structured output (it will be part of a team).
can you please help me on how to resolve this?
Thanks!