Agent Playground

No data is sent to agno.com, all agent data is stored locally in your sqlite database.

Running Playground Locally

Let’s run the playground application locally so we can chat with our Agents using the Agent UI. Create a file playground.py

playground.py
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.playground import Playground, serve_playground_app
from agno.storage.agent.sqlite import SqliteAgentStorage
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.yfinance import YFinanceTools

agent_storage: str = "tmp/agents.db"

web_agent = Agent(
    name="Web Agent",
    model=OpenAIChat(id="gpt-4o"),
    tools=[DuckDuckGoTools()],
    instructions=["Always include sources"],
    # Store the agent sessions in a sqlite database
    storage=SqliteAgentStorage(table_name="web_agent", db_file=agent_storage),
    # Adds the current date and time to the instructions
    add_datetime_to_instructions=True,
    # Adds the history of the conversation to the messages
    add_history_to_messages=True,
    # Number of history responses to add to the messages
    num_history_responses=5,
    # Adds markdown formatting to the messages
    markdown=True,
)

finance_agent = Agent(
    name="Finance Agent",
    model=OpenAIChat(id="gpt-4o"),
    tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True)],
    instructions=["Always use tables to display data"],
    storage=SqliteAgentStorage(table_name="finance_agent", db_file=agent_storage),
    add_datetime_to_instructions=True,
    add_history_to_messages=True,
    num_history_responses=5,
    markdown=True,
)

app = Playground(agents=[web_agent, finance_agent]).get_app()

if __name__ == "__main__":
    serve_playground_app("playground:app", reload=True)
Make sure the serve_playground_app() points to the file that contains your Playground app.

Authenticate with Agno

Authenticate with agno.com so your local application can let agno know that you are running a playground application. Run:

No data is sent to agno.com, only that you’re running a playground application at port 7777.

ag setup

[or] export your AGNO_API_KEY from app.agno.com

Run the playground app

Install dependencies and run your playground application:

pip install openai duckduckgo-search yfinance sqlalchemy 'fastapi[standard]' agno

python playground.py

View the playground

  • Open the link provided or navigate to http://app.agno.com/playground (login required)
  • Select the localhost:7777 endpoint and start chatting with your agents!