Create Team Run

Example Team server

Install the runtime, SQLite and model dependencies, then configure credentials:

uv pip install -U "agno[os]" openai sqlalchemy
export OPENAI_API_KEY="your-openai-api-key"
export OS_SECURITY_KEY="your-agentos-key"

Save as team_api.py and run python team_api.py:

from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIChat
from agno.os import AgentOS
from agno.team import Team


db = SqliteDb(id="team-api-db", db_file="tmp/team-api.db")
member = Agent(
    id="writing-assistant",
    name="Writing Assistant",
    model=OpenAIChat(id="gpt-5.4-mini"),
    role="Help write clear explanations.",
)
team = Team(
    id="reference-team",
    name="Reference Team",
    model=OpenAIChat(id="gpt-5.4-mini"),
    members=[member],
    db=db,
    store_member_responses=True,
    store_events=True,
)
agent_os = AgentOS(db=db, teams=[team])
app = agent_os.get_app()

if __name__ == "__main__":
    agent_os.serve(app="team_api:app", host="127.0.0.1", port=7777)

Send form fields for a complete JSON response:

curl --fail-with-body http://127.0.0.1:7777/teams/reference-team/runs \
  -H "Authorization: Bearer $OS_SECURITY_KEY" \
  -F 'message=Explain what an AI agent does in two sentences.' -F 'stream=false'

Keep the returned run_id and session_id. With stream=true (the default), read SSE events such as TeamRunStarted and TeamRunContent. Generated Agent-style RunStarted/RunContent samples below do not describe Team event names. A stream can report a failure after HTTP 200 has started.

Background responses

background=true requires a Team database; remote Teams reject background execution. With stream=false, acceptance returns 202 with run/session IDs and status. Use Get Team Run to poll; it is not the complete output shown by the generic success example. With stream=true, it returns resumable SSE.

This server uses local process execution. Restart durability requires the durable queue and an eligible submission; factories, pinned versions, uploaded media or non-serializable requests can bypass it. The monitor form field is currently only logged by this handler; it does not configure tracing or telemetry.

POST/teams/{team_id}/runs

Execute a team collaboration with multiple agents working together on a task.

Features:

  • Text message input with optional session management
  • Multi-media support: images (PNG, JPEG, WebP), audio (WAV, MP3), video (MP4, WebM, etc.)
  • Document processing: PDF, CSV, DOCX, TXT, JSON
  • Real-time streaming responses with Server-Sent Events (SSE)
  • User and session context preservation

Streaming Response: When stream=true, returns SSE events with event and data fields.

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

team_id*Team Id

Request Body

multipart/form-data

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl --request POST 'https://example.com/teams/string/runs' \  --form-string 'message=string'
null