> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Remote Team

> Execute teams hosted on remote AgentOS instances

`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 [Run Your AgentOS](/agent-os/run-your-os) to set one up.

## Basic Usage

```python theme={null}
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:

```python theme={null}
import asyncio

from agno.team import RemoteTeam
from agno.run.team import RunContentEvent

async def main():
    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)

asyncio.run(main())
```

## Configuration Access

Access the remote team's configuration:

```python theme={null}
import asyncio

from agno.team import RemoteTeam

async def main():
    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
    await team.refresh_config()

asyncio.run(main())
```

## Using in Gateway

Register remote teams in an AgentOS gateway:

```python theme={null}
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"),
    ],
)

app = gateway.get_app()

if __name__ == "__main__":
    gateway.serve(app="gateway:app", port=7777)
```

## Authentication

For authenticated AgentOS instances:

```python theme={null}
import asyncio

from agno.team import RemoteTeam

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

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

asyncio.run(main())
```

## Error Handling

```python theme={null}
import asyncio

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

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

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

asyncio.run(main())
```

## 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

```python theme={null}
import asyncio

from agno.team import RemoteTeam

async def main():
    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)

asyncio.run(main())
```

## Developer Resources

* [RemoteTeam Reference](/reference/teams/remote-team) for complete API documentation.
* [RemoteTeam Example](/agent-os/usage/remote-execution/remote-team) for a complete example.
