AgentOSClient provides a convenient interface for interacting with a running AgentOS instance. It supports all AgentOS operations including running agents, teams, and workflows, managing sessions and memories, and searching knowledge bases.
Basic Usage
Parameters
Methods
Discovery & Configuration
aget_config
Get AgentOS configuration and metadata asynchronously.
ConfigResponse containing:
os_id: Unique identifier for the OS instancename: Name of the OS instanceagents: List of registered agentsteams: List of registered teamsworkflows: List of registered workflowsinterfaces: List of available interfaces
get_config
Synchronous version of aget_config.
list_agents
List all agents configured in the AgentOS instance.
List[AgentSummaryResponse]
aget_agent
Get detailed configuration for a specific agent.
agent_id(str): ID of the agent to retrieve
AgentResponse
list_teams
List all teams configured in the AgentOS instance.
List[TeamSummaryResponse]
aget_team
Get detailed configuration for a specific team.
team_id(str): ID of the team to retrieve
TeamResponse
list_workflows
List all workflows configured in the AgentOS instance.
List[WorkflowSummaryResponse]
aget_workflow
Get detailed configuration for a specific workflow.
workflow_id(str): ID of the workflow to retrieve
WorkflowResponse
Running Agents
run_agent
Execute an agent run (non-streaming).
Returns:
RunOutput
run_agent_stream
Stream an agent run response.
run_agent
Yields: RunOutputEvent (one of RunStartedEvent, RunContentEvent, RunToolCallEvent, RunCompletedEvent, etc.)
continue_agent_run
Continue a paused agent run with tool results.
Returns:
RunOutput
cancel_agent_run
Cancel an agent run.
Running Teams
run_team
Execute a team run (non-streaming).
Returns:
TeamRunOutput
Paused runs return status="paused" and requirements on the TeamRunOutput.
run_team_stream
Stream a team run response.
TeamRunOutputEvent
cancel_team_run
Cancel a team run.
Running Workflows
run_workflow
Execute a workflow run (non-streaming).
Returns:
WorkflowRunOutput
run_workflow_stream
Stream a workflow run response.
WorkflowRunOutputEvent
cancel_workflow_run
Cancel a workflow run.
Memory Operations
create_memory
Create a new user memory.
Returns:
UserMemorySchema
list_memories
List user memories with filtering and pagination.
Returns:
PaginatedResponse[UserMemorySchema]
get_memory
Get a specific memory by ID.
UserMemorySchema
update_memory
Update an existing memory.
UserMemorySchema
delete_memory
Delete a specific memory.
Session Operations
create_session
Create a new session.
Returns:
AgentSessionDetailSchema, TeamSessionDetailSchema, or WorkflowSessionDetailSchema
get_sessions
List sessions with filtering and pagination.
PaginatedResponse[SessionSchema]
get_session
Get a specific session by ID.
AgentSessionDetailSchema, TeamSessionDetailSchema, or WorkflowSessionDetailSchema
get_session_runs
Get all runs for a specific session.
List[RunSchema | TeamRunSchema | WorkflowRunSchema]
rename_session
Rename a session.
delete_session
Delete a specific session.
Knowledge Operations
upload_knowledge_content
Upload content to the knowledge base.
Returns:
ContentResponseSchema
search_knowledge
Search the knowledge base.
Returns:
PaginatedResponse[VectorSearchResult]
list_knowledge_content
List all content in the knowledge base.
PaginatedResponse[ContentResponseSchema]
get_knowledge_config
Get knowledge base configuration.
KnowledgeConfigResponse
Trace Operations
get_traces
List execution traces with filtering and pagination.
PaginatedResponse[TraceSummary]
get_trace
Get detailed trace information.
TraceDetail or TraceNode (if span_id provided)
Metrics Operations
get_metrics
Retrieve AgentOS metrics and analytics data.
MetricsResponse
refresh_metrics
Manually trigger recalculation of system metrics.
List[DayAggregatedMetrics]
Error Handling
The client raisesRemoteServerUnavailableError when the remote server is unavailable:
httpx.HTTPStatusError.
Authentication
To include authentication headers in requests, pass theheaders parameter to any method: