trading_agent.gateway.routes.extension_routes
¶
Routes for the extensions: skills, subagents, MCP servers, packages and checkpoints.
GET /api/desks/{desk}/skills the desk's usable skills with their usage, and the hidden ones GET /api/subagents the subagent definitions, and the files that could not be read GET /api/mcp each MCP server's state and tools GET /api/packages the installed packages GET /api/desks/{desk}/checkpoints the snapshots of the desk's own files POST /api/desks/{desk}/checkpoints/{checkpoint}/restore put the desk's files back as they were
Typical usage example:
application.include_router(ExtensionRoutes(guard, parts, shared, manager).router())
ExtensionRoutes
¶
Bases: RouteGroup
The extension routes.
Creates the routes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guard
|
AccessGuard
|
Checks the access token. |
required |
parts
|
Mapping[str, DeskParts]
|
Each desk's skills and checkpoints. |
required |
shared
|
SharedParts
|
The layout, subagents and packages. |
required |
manager
|
McpClientManager
|
The MCP connections. |
required |
Source code in src/trading_agent/gateway/routes/extension_routes.py
skills
¶
The desk's skills.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk_name
|
str
|
The desk. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The usable skills with where they come from and how often they were used, and the hidden skills with what they miss. |
Source code in src/trading_agent/gateway/routes/extension_routes.py
subagents
¶
The subagent definitions.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Each definition's name, description, tools, models and limits, and the broken files with their errors. |
Source code in src/trading_agent/gateway/routes/extension_routes.py
mcp_servers
¶
Each MCP server's state.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Each server's name, transport, state, error and tool names. |
Source code in src/trading_agent/gateway/routes/extension_routes.py
packages
¶
The installed packages.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Each package's name, version, description and what it brought. |
Source code in src/trading_agent/gateway/routes/extension_routes.py
checkpoints
¶
The desk's snapshots, newest first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk_name
|
str
|
The desk. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Each snapshot's identifier, time and reason. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
git failed (status 500). |
Source code in src/trading_agent/gateway/routes/extension_routes.py
restore_checkpoint
¶
Restores the desk's files from a snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk_name
|
str
|
The desk. |
required |
checkpoint_id
|
str
|
The snapshot. |
Path(pattern=_CHECKPOINT_PATTERN)
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The restored checkpoint, and the snapshot taken just before restoring, which undoes the restore. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
The snapshot could not be restored (status 400). |