This guide will help you get started with PandaAGI in two ways: using the ready-made chat interface for immediate results or integrating the SDK in your Python code for custom applications.

1

Get API Key

1. Visit https://agi.pandas-ai.com/ and sign in with GitHub 2. Access your dashboard to get your API key 3. Copy your API key for the next step
2

Launch Chat Interface

The fastest way to experience PandaAGI is through our ready-made chat interface:

# Clone the repository
git clone https://github.com/sinaptik-ai/panda-agi.git
cd panda-agi/examples/ui

# Set your API key
echo "PANDA_AGI_KEY=your-api-key-here" > ./backend/.env
echo "TAVILY_API_KEY=your-tavily-api-key-here" >> ./backend/.env
echo "WORKSPACE_PATH=./workspace" >> ./backend/.env

# Start the application
./start.sh

This launches a production-ready chat interface at http://localhost:3000

3

Start Chatting

Try these powerful prompts:

  • “Research the latest AI developments and create a summary report”
  • “Analyze this CSV data and create visualizations” (after uploading a file)
  • “Design a database schema for an e-commerce platform”

Building with the SDK

The PandaAGI SDK connects you to a pre-configured autonomous general AI agent with built-in capabilities for web browsing, file system access, and code execution. You simply submit tasks and receive results:

import os, asyncio
from panda_agi import Agent
from panda_agi.envs import DockerEnv
from panda_agi.handlers import LogsHandler

async def main():

    os.environ['PANDA_AGI_KEY'] = 'your-api-key-here'
    os.environ['TAVILY_API_KEY'] = 'your-tavily-api-key-here'

    # Create environment for the general AI agent to work in
    agent_env = DockerEnv("./workspace")
    agent = Agent(environment=agent_env)
    
    # Create a handler for logging events
    handlers = [LogsHandler(use_colors=True, show_timestamps=True)]

    # Submit a task with event handlers
    response = await agent.run(
        "Research the latest AI developments and create a summary report",
        event_handlers=handlers
    )
    # The general AI agent will:
    # 1. Search multiple sources for recent AI news and developments
    # 2. Analyze and synthesize information from various websites
    # 3. Create a structured report with key findings
    # 4. Save the report as a markdown file in your workspace
    # 5. Include citations and sources for all information

    print(f"Task completed: {response.output}")
    
    await agent.disconnect()

if __name__ == "__main__":
    asyncio.run(main())

Pre-built Chat Interface

PandaAGI Chat Interface

PandaAGI includes a production-ready chat interface that lets you interact with your AI agent without writing any code. This is perfect for:

  • Quickly demonstrating AI capabilities to stakeholders
  • Testing different prompts and use cases
  • Providing a polished UI for non-technical users
  • Learning how the agent thinks and uses tools

Features of the Chat UI

Real-time Streaming

See agent responses, thinking, and actions as they happen

File Upload

Upload files for the agent to analyze or process

Conversation History

Maintain context across multiple interactions

Mobile Responsive

Works seamlessly on desktop and mobile devices

Running the Chat Interface

Want to customize the chat interface? Check out the Chat Interface Guide for detailed documentation on how to extend and modify the UI.

Advanced Configuration

Custom Environment

You can configure your AI agent with different execution environments:

from panda_agi.envs import LocalEnv, DockerEnv

# Use local environment (limited capabilities but no Docker required)
local_env = LocalEnv("./workspace")

# Use Docker environment (full capabilities, requires Docker)
docker_env = DockerEnv("./workspace")

agent = Agent(environment=docker_env)

Conversation Management

Manage conversation state for multi-turn interactions:

from panda_agi.handlers import LogsHandler
from panda_agi.envs import DockerEnv

# Create agent with conversation ID for persistence
agent = Agent(
    environment=DockerEnv("./workspace"),
    conversation_id="unique-conversation-id"
)

# Create event handler
handlers = [LogsHandler(use_colors=True, show_timestamps=True)]

# First interaction
response1 = await agent.run(
    "Find information about electric vehicles",
    event_handlers=handlers
)
print(f"First task completed: {response1.output}")

# Later interaction (continues the same conversation)
response2 = await agent.run(
    "Now compare the top 3 models",
    event_handlers=handlers
)
print(f"Second task completed: {response2.output}")

Event Handling

Filter and process specific event types for custom UIs:

from panda_agi import BaseHandler, EventType
from panda_agi.client.models import BaseStreamEvent

class CustomEventHandler(BaseHandler):
    def process(self, event: BaseStreamEvent) -> None:
        if event.type == EventType.THINKING:
            print(f"Agent is thinking: {event.data}")
        elif event.type == EventType.ACTION:
            print(f"Agent is taking action: {event.data}")
        elif event.type == EventType.RESULT:
            print(f"Agent produced result: {event.data}")

# Use custom handler
handler = CustomEventHandler("CustomUI")
response = await agent.run("Create a data visualization", event_handlers=[handler])

Next Steps

Now that you’re up and running with PandaAGI, explore these resources to learn more: