Getting Started
This guide walks you through installing Agent Teams, creating your first team, and running tasks.
Prerequisites
- Python 3.10+
- A model provider API key (OpenAI, Anthropic, etc.)
Installation
pip install agent-teams
For development:
git clone https://github.com/datalayer/agent-teams
cd agent-teams
pip install -e ".[test]"
Option A: Python API
1. Create a Team
import asyncio
from agent_teams.types import TeamConfig, AgentMemberConfig, ExecutionMode
from agent_teams.manager import TeamManager
async def main():
manager = TeamManager()
config = TeamConfig(
name="my-first-team",
execution_mode=ExecutionMode.SEQUENTIAL,
members=[
AgentMemberConfig(
name="analyst",
model="openai:gpt-4o",
system_prompt="You are a data analyst.",
),
],
)
team = await manager.create_team(config)
print(f"Team created: {team.team_id}")
asyncio.run(main())
2. Start the Team and Assign a Task
await manager.start_team(team.team_id)
result = await manager.assign_task(
team.team_id,
"Summarise the key trends in Q4 revenue data",
)
print(result)
3. Check Metrics
metrics = manager.get_metrics(team.team_id)
print(f"Tasks completed: {metrics.tasks_completed}")
print(f"Tasks failed: {metrics.tasks_failed}")
4. Stop the Team
await manager.stop_team(team.team_id)
Option B: CLI
1. Start the Server
agent-teams serve --port 8765
2. Create a Team from a YAML File
Create a team.yaml file:
name: my-first-team
execution_mode: sequential
members:
- name: analyst
model: openai:gpt-4o
system_prompt: You are a data analyst.
Then create the team:
agent-teams create team.yaml
3. Manage the Team
# List all teams
agent-teams list
# Start the team
agent-teams start <team-id>
# Assign a task
agent-teams assign <team-id> "Summarise Q4 revenue trends"
# Check status
agent-teams status <team-id>
# View metrics
agent-teams metrics <team-id>
# Stream events
agent-teams events <team-id>
# Stop the team
agent-teams stop <team-id>
Option C: REST API
The FastAPI server exposes a full REST interface:
# Create a team
curl -X POST http://localhost:8765/teams \
-H "Content-Type: application/json" \
-d '{"name": "my-team", "execution_mode": "sequential", "members": [{"name": "analyst", "model": "openai:gpt-4o"}]}'
# Start the team
curl -X POST http://localhost:8765/teams/<team-id>/start
# Assign a task
curl -X POST http://localhost:8765/teams/<team-id>/tasks \
-H "Content-Type: application/json" \
-d '{"title": "Analyse data", "description": "Summarise Q4 revenue"}'
# Get events (Server-Sent Events)
curl http://localhost:8765/teams/<team-id>/events
Embedding in Another App
Agent Teams can be mounted inside an existing FastAPI application:
from fastapi import FastAPI
from agent_teams.app import create_app
from agent_teams.manager import TeamManager
parent_app = FastAPI()
manager = TeamManager()
parent_app.mount("/api/agent-teams/v1", create_app(manager=manager))
Next Steps
- Architecture — Understand the module structure and design patterns.
- Health Monitoring — Configure heartbeat thresholds and recovery.
- Reactions — Set up automatic responses to events.
- CLI Reference — Full CLI command reference.
- A2A Extensions — Expose your teams over the A2A protocol.