Basic Client Usage

Connect to an AgentOS instance and inspect its agents, teams, and workflows

Create a Python file

basic_client.py
import asyncio
import os

from agno.client import AgentOSClient


HEADERS = {"Authorization": f"Bearer {os.environ['OS_SECURITY_KEY']}"}

async def main():
    # Connect to AgentOS
    client = AgentOSClient(base_url="http://localhost:7778")

    # Get AgentOS configuration
    config = await client.aget_config(headers=HEADERS)
    print(f"Connected to: {config.name or config.os_id}")
    print(f"Available agents: {[a.id for a in (config.agents or [])]}")
    print(f"Available teams: {[t.id for t in (config.teams or [])]}")
    print(f"Available workflows: {[w.id for w in (config.workflows or [])]}")

    # Get details about a specific agent
    if config.agents:
        agent_id = config.agents[0].id
        agent = await client.aget_agent(agent_id, headers=HEADERS)
        print("\nAgent Details:")
        print(f"  Name: {agent.name}")
        print(f"  Model: {agent.model}")
        print(f"  Tools: {len((agent.tools or {}).get('tools') or [])}")


if __name__ == "__main__":
    asyncio.run(main())

Set up your virtual environment

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

Install dependencies

uv pip install -U "agno[os]" openai

Set the server model key

Set this key in the terminal that starts the example server. The client sends requests to AgentOS and does not call OpenAI directly.

export OPENAI_API_KEY="your_openai_api_key_here"

Start an AgentOS Server

Set OS_SECURITY_KEY in the client terminal to the same value used by the server. The code sends it as a bearer credential on each request.

export OS_SECURITY_KEY="your_os_security_key_here"

Start the client example server on port 7778. It registers the agents, team, and workflow used by these client examples.

Run the Client

python basic_client.py