Agent Playground

No data is sent to pinax.tech, 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 pinaxai.agent import Agent
from pinaxai.models.openai import OpenAIChat
from pinaxai.playground import Playground, serve_playground_app
from pinaxai.storage.sqlite import SqliteStorage
from pinaxai.tools.duckduckgo import DuckDuckGoTools
from pinaxai.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=SqliteStorage(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=SqliteStorage(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)
Remember to export your OPENAI_API_KEY before running the playground application.
Make sure the serve_playground_app() points to the file that contains your Playground app.

Authenticate with Pinaxai

Authenticate with pinax.tech so your local application can let pinaxai know which port you are running the playground on. Run:
No data is sent to pinax.tech, only that you’re running a playground application at port 7777.
pinaxai setup
[or] export your pinax_API_KEY from app.pinax.tech
export pinax_API_KEY=ag-***

Run the playground app

Install dependencies and run your playground application:
pip install openai duckduckgo-search yfinance sqlalchemy 'fastapi[standard]' pinaxai

python playground.py

View the playground

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

Open Source Agent UI

Looking for a self-hosted alternative? Check out our Open Source Agent UI - A modern Agent interface built with Next.js and TypeScript that works exactly like the Agent Playground.
agent-ui

Agent UI Interface

Get Started with Agent UI

# Create a new Agent UI project
npx create-agent-ui@latest

# Or clone and run manually
git clone https://github.com/Pinax-Labs/agent-ui.git
cd agent-ui && pnpm install && pnpm dev
The UI will connect to localhost:7777 by default, matching the Playground setup above. Visit GitHub for more details.

Troubleshooting

We have identified that certain browsers may experience compatibility issues with the Agent Playground, potentially resulting in connection errors.

Brave Browser

Users may encounter difficulties connecting to localhost endpoints when using Brave, and the pinaxai setup command might not work as expected. To resolve this issue, please try disabling Brave Shields in your browser settings.

Safari Browser

Similar connection issues have been reported with Safari when attempting to connect to localhost endpoints and running pinaxai setup. While we are actively working on a solution, we kindly recommend using alternative browsers such as Chrome, Firefox, or Edge for the best experience.