Quick Start Guide

Get up and running with AA Kit in under 5 minutes. This guide will walk you through creating your first agent.

Prerequisites

  • Python 3.8 or higher
  • An OpenAI or Anthropic API key
  • Basic Python knowledge

1Install AA Kit

bash
pip install aa-kit

2Create your first agent

python
from aakit import Agent

# Create an agent in 3 lines
agent = Agent(
    name="assistant",
    instruction="You are a helpful AI assistant",
    model="gpt-4"
)

# Chat with your agent - no async/await needed!
response = agent.chat("What can you help me with?")
print(response)

# Or use async when you need it
response = await agent.achat("What can you help me with?")
print(response)

3Add tools to your agent

python
from aakit import Agent

# Define a simple tool
def search_database(query: str) -> str:
    """Search our database for information."""
    # Your search logic here
    return f"Found results for: {query}"

# Create agent with tools
agent = Agent(
    name="researcher",
    instruction="You help users find information",
    model="gpt-4",
    tools=[search_database],  # Automatically converted to MCP
    reasoning="react"  # Use ReAct pattern for tool usage
)

# Agent can now use tools - synchronous by default
response = agent.chat("Find information about Python")

# Or async version
response = await agent.achat("Find information about Python")

4Compose agents together

python
from aakit import Agent

# Create specialized agents
researcher = Agent("researcher", "You research topics", "gpt-4")
writer = Agent("writer", "You write articles", "claude-3")

# Create a coordinator that uses other agents
coordinator = Agent(
    name="coordinator",
    instruction="You coordinate research and writing tasks",
    model="gpt-4",
    tools=[researcher, writer]  # Agents as tools!
)

# Coordinate complex tasks - sync or async, your choice!
response = coordinator.chat(
    "Research AI safety and write a short article about it"
)

# Or use async for concurrent operations
response = await coordinator.achat(
    "Research AI safety and write a short article about it"
)

5Have a conversation

python
from aakit import Agent

# Create an agent with memory
agent = Agent(
    name="assistant",
    instruction="You are a helpful AI assistant",
    model="gpt-4",
    memory="memory://"  # Enable conversation memory
)

# Have a contextual conversation
with agent.conversation() as chat:
    # Send messages - agent maintains context
    chat.send("I'm learning Python")
    chat.send("What should I learn first?")  # Knows you're learning Python
    chat.send("Can you show me an example?")  # Knows the context
    
    # Save the conversation
    chat.save("learning_session.json")

# Or use interactive mode for a terminal chat
agent.interactive()  # Opens REPL-like interface

6Serve as MCP server

python
from aakit import Agent

# Create your agent
agent = Agent("assistant", "You are helpful", "gpt-4")

# Serve as MCP server - compatible with Claude Desktop!
agent.serve_mcp(
    port=8080,
    name="My Assistant",
    description="A helpful AI assistant"
)

# Now accessible at http://localhost:8080
# Can be used by Claude Desktop or other MCP clients

🎉 Congratulations!

You've just learned the core features of AA Kit:

  • Creating agents with just 3 lines of code
  • Adding tools that automatically become MCP-compatible
  • Composing agents together for complex tasks
  • Serving agents as MCP servers

Configuration

Set your API keys as environment variables:

# For OpenAI models
export OPENAI_API_KEY="your-api-key"

# For Anthropic models
export ANTHROPIC_API_KEY="your-api-key"

# Or use a .env file
echo "OPENAI_API_KEY=your-api-key" >> .env

Production Features

AA Kit comes with 10 production features built-in. Here's how to use them:

python
from aakit import Agent, ProductionConfig

# Configure production features
config = ProductionConfig(
    rate_limit=100,  # 100 requests per minute
    cache_ttl=3600,  # Cache for 1 hour
    timeout=30,      # 30 second timeout
    retry_max=3,     # Retry up to 3 times
)

agent = Agent(
    name="production_agent",
    instruction="You are a production-ready assistant",
    model="gpt-4",
    config=config
)

What's Next?

Need Help?

Join our community for support and discussions: