Add session to agents (#4216)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Jack Amadeo <jackamadeo@squareup.com>
Co-authored-by: Jack Amadeo <jackamadeo@block.xyz>
This commit is contained in:
Douwe Osinga
2025-09-03 10:31:24 -04:00
committed by GitHub
parent db94c5b7c3
commit d2195289cf
65 changed files with 1473 additions and 1601 deletions
+200 -4
View File
@@ -85,6 +85,45 @@
}
}
},
"/agent/resume": {
"post": {
"tags": [
"super::routes::agent"
],
"operationId": "resume_agent",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ResumeAgentRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Agent started successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StartAgentResponse"
}
}
}
},
"400": {
"description": "Bad request - invalid working directory"
},
"401": {
"description": "Unauthorized - invalid secret key"
},
"500": {
"description": "Internal server error"
}
}
}
},
"/agent/session_config": {
"post": {
"tags": [
@@ -124,6 +163,45 @@
}
}
},
"/agent/start": {
"post": {
"tags": [
"super::routes::agent"
],
"operationId": "start_agent",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StartAgentRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Agent started successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StartAgentResponse"
}
}
}
},
"400": {
"description": "Bad request - invalid working directory"
},
"401": {
"description": "Unauthorized - invalid secret key"
},
"500": {
"description": "Internal server error"
}
}
}
},
"/agent/tools": {
"get": {
"tags": [
@@ -140,6 +218,15 @@
"type": "string",
"nullable": true
}
},
{
"name": "session_id",
"in": "query",
"description": "Required session ID to scope tools to a specific session",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
@@ -209,6 +296,16 @@
"super::routes::agent"
],
"operationId": "update_router_tool_selector",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateRouterToolSelectorRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Tool selection strategy updated successfully",
@@ -1414,9 +1511,13 @@
"AddSubRecipesRequest": {
"type": "object",
"required": [
"sub_recipes"
"sub_recipes",
"session_id"
],
"properties": {
"session_id": {
"type": "string"
},
"sub_recipes": {
"type": "array",
"items": {
@@ -1850,11 +1951,15 @@
"ExtendPromptRequest": {
"type": "object",
"required": [
"extension"
"extension",
"session_id"
],
"properties": {
"extension": {
"type": "string"
},
"session_id": {
"type": "string"
}
}
},
@@ -2265,10 +2370,16 @@
},
"GetToolsQuery": {
"type": "object",
"required": [
"session_id"
],
"properties": {
"extension_name": {
"type": "string",
"nullable": true
},
"session_id": {
"type": "string"
}
}
},
@@ -2644,7 +2755,8 @@
"type": "object",
"required": [
"id",
"action"
"action",
"session_id"
],
"properties": {
"action": {
@@ -2655,6 +2767,9 @@
},
"principal_type": {
"$ref": "#/components/schemas/PrincipalType"
},
"session_id": {
"type": "string"
}
}
},
@@ -3026,6 +3141,17 @@
}
}
},
"ResumeAgentRequest": {
"type": "object",
"required": [
"session_id"
],
"properties": {
"session_id": {
"type": "string"
}
}
},
"RetryConfig": {
"type": "object",
"description": "Configuration for retry logic in recipe execution",
@@ -3156,6 +3282,9 @@
},
"SessionConfigRequest": {
"type": "object",
"required": [
"session_id"
],
"properties": {
"response": {
"allOf": [
@@ -3164,6 +3293,9 @@
}
],
"nullable": true
},
"session_id": {
"type": "string"
}
}
},
@@ -3342,6 +3474,14 @@
"description": "The number of output tokens used in the session. Retrieved from the provider's last usage.",
"nullable": true
},
"recipe": {
"allOf": [
{
"$ref": "#/components/schemas/Recipe"
}
],
"nullable": true
},
"schedule_id": {
"type": "string",
"description": "ID of the schedule that triggered this session, if any",
@@ -3388,6 +3528,47 @@
}
}
},
"StartAgentRequest": {
"type": "object",
"required": [
"working_dir"
],
"properties": {
"recipe": {
"allOf": [
{
"$ref": "#/components/schemas/Recipe"
}
],
"nullable": true
},
"working_dir": {
"type": "string"
}
}
},
"StartAgentResponse": {
"type": "object",
"required": [
"session_id",
"metadata",
"messages"
],
"properties": {
"messages": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Message"
}
},
"metadata": {
"$ref": "#/components/schemas/SessionMetadata"
},
"session_id": {
"type": "string"
}
}
},
"SubRecipe": {
"type": "object",
"required": [
@@ -3645,7 +3826,8 @@
"UpdateProviderRequest": {
"type": "object",
"required": [
"provider"
"provider",
"session_id"
],
"properties": {
"model": {
@@ -3654,6 +3836,20 @@
},
"provider": {
"type": "string"
},
"session_id": {
"type": "string"
}
}
},
"UpdateRouterToolSelectorRequest": {
"type": "object",
"required": [
"session_id"
],
"properties": {
"session_id": {
"type": "string"
}
}
},