curl --request GET \
--url https://api.example.com/sessions/ \
--header 'x-user-id: <x-user-id>'{
"sessions": [
{
"session": {
"user_id": "<string>",
"agent_id": "<string>",
"config": {
"workspace_id": "<string>",
"name": "<string>",
"chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
},
"fallback_chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
}
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"source": "user",
"source_schedule_id": "<string>",
"team_id": "<string>",
"state": {
"session_id": "<string>",
"summary": "",
"context": [
{
"name": "<string>",
"content": [
{
"text": "<string>",
"type": "text",
"id": "<string>"
}
],
"id": "<string>",
"metadata": {},
"created_at": "<string>",
"finished_at": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123
}
}
],
"reply_id": "<string>",
"cur_iter": 0,
"permission_context": {
"mode": "default",
"working_directories": {},
"allow_rules": {},
"deny_rules": {},
"ask_rules": {}
},
"tool_context": {
"max_cache_files": 100,
"max_cache_bytes": 25000,
"read_file_cache": [
{
"lines": [
"<string>"
],
"updated_at": 123,
"bytes": 123,
"file_path": "<string>"
}
],
"activated_groups": [
"<string>"
]
},
"tasks_context": {
"tasks": [
{
"subject": "<string>",
"description": "<string>",
"metadata": {},
"created_at": "<string>",
"state": "pending",
"id": "<string>",
"owner": "<string>",
"blocks": [
"<string>"
],
"blocked_by": [
"<string>"
]
}
]
}
}
},
"is_running": true,
"team": {
"team": {
"user_id": "<string>",
"session_id": "<string>",
"data": {
"name": "<string>",
"description": "",
"member_ids": [
"<string>"
]
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
},
"leader_agent": {
"user_id": "<string>",
"data": {
"name": "<string>",
"context_config": {
"trigger_ratio": 0.8,
"reserve_ratio": 0.1,
"compression_prompt": "<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>",
"summary_template": "<system-info>Here is a summary of your previous work\n# Task Overview\n{task_overview}\n\n# Current State\n{current_state}\n\n# Important Discoveries\n{important_discoveries}\n\n# Next Steps\n{next_steps}\n\n# Context to Preserve\n{context_to_preserve}</system-info>",
"summary_schema": {},
"tool_result_limit": 3000
},
"react_config": {
"max_iters": 20,
"stop_on_reject": false
},
"id": "<string>",
"system_prompt": "You're a helpful assistant."
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"source": "user"
},
"members": [
{
"agent": {
"user_id": "<string>",
"data": {
"name": "<string>",
"context_config": {
"trigger_ratio": 0.8,
"reserve_ratio": 0.1,
"compression_prompt": "<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>",
"summary_template": "<system-info>Here is a summary of your previous work\n# Task Overview\n{task_overview}\n\n# Current State\n{current_state}\n\n# Important Discoveries\n{important_discoveries}\n\n# Next Steps\n{next_steps}\n\n# Context to Preserve\n{context_to_preserve}</system-info>",
"summary_schema": {},
"tool_result_limit": 3000
},
"react_config": {
"max_iters": 20,
"stop_on_reject": false
},
"id": "<string>",
"system_prompt": "You're a helpful assistant."
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"source": "user"
},
"session_id": "<string>"
}
]
}
}
],
"total": 123
}List sessions for an agent
Return all sessions for an agent as enriched
:class:SessionView entries.
Each entry bundles three things the chat UI needs to render
without follow-up requests: the session record (incl.
state), whether a chat run is currently active, and — when
the session participates in a team — the resolved team detail
(leader agent + member agents with their session ids).
Args:
agent_id (str):
Agent whose sessions to list.
user_id (str):
Injected authenticated user ID.
storage (StorageBase):
Injected storage backend.
message_bus (MessageBus):
Injected message bus (used for session_is_running).
Returns:
ListSessionsResponse:
Enriched session views and their count.
Raises:
HTTPException: 404 if the agent does not exist or does not
belong to the authenticated user.
curl --request GET \
--url https://api.example.com/sessions/ \
--header 'x-user-id: <x-user-id>'{
"sessions": [
{
"session": {
"user_id": "<string>",
"agent_id": "<string>",
"config": {
"workspace_id": "<string>",
"name": "<string>",
"chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
},
"fallback_chat_model_config": {
"type": "<string>",
"credential_id": "<string>",
"model": "<string>",
"parameters": {}
}
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"source": "user",
"source_schedule_id": "<string>",
"team_id": "<string>",
"state": {
"session_id": "<string>",
"summary": "",
"context": [
{
"name": "<string>",
"content": [
{
"text": "<string>",
"type": "text",
"id": "<string>"
}
],
"id": "<string>",
"metadata": {},
"created_at": "<string>",
"finished_at": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123
}
}
],
"reply_id": "<string>",
"cur_iter": 0,
"permission_context": {
"mode": "default",
"working_directories": {},
"allow_rules": {},
"deny_rules": {},
"ask_rules": {}
},
"tool_context": {
"max_cache_files": 100,
"max_cache_bytes": 25000,
"read_file_cache": [
{
"lines": [
"<string>"
],
"updated_at": 123,
"bytes": 123,
"file_path": "<string>"
}
],
"activated_groups": [
"<string>"
]
},
"tasks_context": {
"tasks": [
{
"subject": "<string>",
"description": "<string>",
"metadata": {},
"created_at": "<string>",
"state": "pending",
"id": "<string>",
"owner": "<string>",
"blocks": [
"<string>"
],
"blocked_by": [
"<string>"
]
}
]
}
}
},
"is_running": true,
"team": {
"team": {
"user_id": "<string>",
"session_id": "<string>",
"data": {
"name": "<string>",
"description": "",
"member_ids": [
"<string>"
]
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
},
"leader_agent": {
"user_id": "<string>",
"data": {
"name": "<string>",
"context_config": {
"trigger_ratio": 0.8,
"reserve_ratio": 0.1,
"compression_prompt": "<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>",
"summary_template": "<system-info>Here is a summary of your previous work\n# Task Overview\n{task_overview}\n\n# Current State\n{current_state}\n\n# Important Discoveries\n{important_discoveries}\n\n# Next Steps\n{next_steps}\n\n# Context to Preserve\n{context_to_preserve}</system-info>",
"summary_schema": {},
"tool_result_limit": 3000
},
"react_config": {
"max_iters": 20,
"stop_on_reject": false
},
"id": "<string>",
"system_prompt": "You're a helpful assistant."
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"source": "user"
},
"members": [
{
"agent": {
"user_id": "<string>",
"data": {
"name": "<string>",
"context_config": {
"trigger_ratio": 0.8,
"reserve_ratio": 0.1,
"compression_prompt": "<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>",
"summary_template": "<system-info>Here is a summary of your previous work\n# Task Overview\n{task_overview}\n\n# Current State\n{current_state}\n\n# Important Discoveries\n{important_discoveries}\n\n# Next Steps\n{next_steps}\n\n# Context to Preserve\n{context_to_preserve}</system-info>",
"summary_schema": {},
"tool_result_limit": 3000
},
"react_config": {
"max_iters": 20,
"stop_on_reject": false
},
"id": "<string>",
"system_prompt": "You're a helpful assistant."
},
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"source": "user"
},
"session_id": "<string>"
}
]
}
}
],
"total": 123
}Headers
Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.
Query Parameters
Filter sessions by agent ID.