Remote Team

Execute teams hosted on a remote AgentOS instance

The streaming loop prints only content events. Completed events can carry the full response again; handle completion and errors separately when building your application.

Create a Python file

remote_team.py
import asyncio

from agno.team import RemoteTeam
from agno.run.team import TeamRunEvent


async def remote_team_example():
    """Call a remote team hosted on another AgentOS instance."""
    team = RemoteTeam(
        base_url="http://localhost:7778",
        team_id="research-team",
    )

    response = await team.arun(
        "What is the capital of France?",
        user_id="user-123",
        session_id="session-456",
    )
    print(response.content)


async def remote_streaming_example():
    """Stream responses from a remote team."""
    team = RemoteTeam(
        base_url="http://localhost:7778",
        team_id="research-team",
    )

    async for chunk in team.arun(
        "Tell me about Python programming",
        session_id="session-456",
        user_id="user-123",
        stream=True,
    ):
        if chunk.event == TeamRunEvent.run_content and chunk.content:
            print(chunk.content, end="", flush=True)


if __name__ == "__main__":
    print("=" * 60)
    print("RemoteTeam Examples")
    print("=" * 60)

    print("\n1. Remote Team Example:")
    asyncio.run(remote_team_example())

    print("\n\n2. Remote Streaming Example:")
    asyncio.run(remote_streaming_example())

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U agno openai

Start an AgentOS Server

Follow the gateway remote-server recipe to save and run remote_server.py on port 7778. It registers assistant-agent and research-team; the gateway process is not needed here. Install the server dependencies and set OPENAI_API_KEY in that server's terminal.

Leave the server running. In another terminal, activate the client environment. The remote-only client does not need a provider API key.

Run the Client

python remote_team.py