Public team

Expose one selected team while keeping its member routes private.

Expose one selected team while keeping its member routes private.

"""Serve a selected Team publicly; member routes remain private.

Run: .venvs/demo/bin/python cookbook/05_agent_os/27_public_pages/public_team.py
Requires PAGE_DEMO_DB_URL and OPENAI_API_KEY. Add --check to validate wiring only.
"""

import argparse
from os import getenv

from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIResponses
from agno.os import AgentOS
from agno.os.public import PublicSurface
from agno.team import Team

# Reuse the member across runs; selecting the Team does not select its members.
db = PostgresDb(
    db_url=getenv(
        "PAGE_DEMO_DB_URL", "postgresql+psycopg://ai:ai@localhost:5532/page_demo"
    )
)
member = Agent(
    id="researcher", name="Researcher", model=OpenAIResponses(id="gpt-5.6-luna")
)
team = Team(
    id="support",
    name="Support",
    members=[member],
    model=OpenAIResponses(id="gpt-5.6-luna"),
    db=db,
)
agent_os = AgentOS(
    id="public-support", db=db, teams=[team], public=PublicSurface(teams=[team])
)
app = agent_os.get_app()

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument(
        "--check",
        action="store_true",
        help="Validate configuration without serving or calling a model",
    )
    args = parser.parse_args()
    if args.check:
        print("Selected Team configuration is valid.")
    else:
        agent_os.serve(app=app)

Run the example

Complete the shared environment and database setup first.

This example uses the separate demo database for sessions and admission counters. It does not need page synchronization.

python cookbook/05_agent_os/27_public_pages/public_team.py --check
python cookbook/05_agent_os/27_public_pages/public_team.py

--check constructs and validates the configuration without starting a server or calling a model. Once the server is running on port 7777:

curl http://localhost:7777/teams
curl -N http://localhost:7777/teams/support/runs \
  -F 'message=Help me plan a documentation review.' -F stream=true

Selecting support does not expose a separate public route for its researcher member. Successful team output can still include native member tool results; public selection is a route boundary, not a promise to redact every member result. See Public surface.

View the source.