Skip to main content
RemoteTeam allows you to execute teams that are running on a remote AgentOS instance. This enables you to leverage complex multi-agent teams without hosting them locally.

Prerequisites

You need a running AgentOS instance with at least one team configured. See Creating Your First OS to set one up.

Basic Usage

import asyncio
from agno.team import RemoteTeam

async def main():
    # Connect to a remote team
    team = RemoteTeam(
        base_url="http://localhost:7778",  # Running on localhost for this example
        team_id="research-team",
    )
    
    # Run the team
    response = await team.arun("Research the latest trends in AI")
    print(response.content)

asyncio.run(main())

Streaming Responses

Stream team responses in real-time:
from agno.team import RemoteTeam
from agno.run.team import RunContentEvent

team = RemoteTeam(
    base_url="http://localhost:7778",  # Running on localhost for this example
    team_id="research-team",
)

print("Team Response: ", end="", flush=True)
async for event in team.arun(
    "Analyze the current state of quantum computing",
    stream=True,
):
    if isinstance(event, RunContentEvent):
        print(event.content, end="", flush=True)

Configuration Access

Access the remote team’s configuration:
from agno.team import RemoteTeam

team = RemoteTeam(
    base_url="http://localhost:7778",  # Running on localhost for this example
    team_id="research-team",
)

# Access cached properties
print(f"Name: {team.name}")
print(f"Description: {team.description}")
print(f"Role: {team.role}")

# Get fresh configuration
config = await team.get_team_config()
print(f"Members: {config.members}")

# Force refresh cache
team.refresh_config()

Using in Gateway

Register remote teams in an AgentOS gateway:
from agno.team import RemoteTeam
from agno.os import AgentOS

gateway = AgentOS(
    id="api-gateway",
    teams=[
        RemoteTeam(base_url="http://server-1:7777", team_id="research-team"),
        RemoteTeam(base_url="http://server-2:7777", team_id="analysis-team"),
    ],
)

gateway.serve(port=7777)

Authentication

For authenticated AgentOS instances:
from agno.team import RemoteTeam

team = RemoteTeam(
    base_url="http://localhost:7778",  # Running on localhost for this example
    team_id="research-team",
)

response = await team.arun(
    "Research this topic",
    auth_token="your-jwt-token",
)

Error Handling

from agno.team import RemoteTeam
from agno.exceptions import RemoteServerUnavailableError

team = RemoteTeam(
    base_url="http://localhost:7778",  # Running on localhost for this example
    team_id="research-team",
)

try:
    response = await team.arun("Hello")
except RemoteServerUnavailableError as e:
    print(f"Cannot connect to server: {e.message}")
    # Handle fallback logic

A2A Protocol Support

RemoteTeam can also connect to any A2A-compatible server, enabling communication with teams built using other frameworks.

Connecting to Agno AgentOS via A2A interface

from agno.team import RemoteTeam

team = RemoteTeam(
    base_url="http://localhost:7778/a2a/teams/my-team",  # Running on localhost for this example
    team_id="my-team",
    protocol="a2a",
)

response = await team.arun("Research the rise of AI in the last decade")
print(response.content)

# Streaming is also supported
async for event in team.arun("Analyze the data on the rise of AI", stream=True):
    if hasattr(event, "content") and event.content:
        print(event.content, end="", flush=True)

Developer Resources