Merge branch 'agents-unify-tools-2' into agents-unify-tools-3

This commit is contained in:
Xi Yan 2025-02-20 19:45:01 -08:00
commit 9f2f6c9b30
4 changed files with 673 additions and 673 deletions

View file

@ -274,67 +274,6 @@
}
}
},
"/v1/agents/{agent_id}/session/{session_id}/turn/{turn_id}/continue": {
"post": {
"responses": {
"200": {
"description": "A single turn in an interaction with an Agentic System. **OR** streamed agent turn completion response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Turn"
}
},
"text/event-stream": {
"schema": {
"$ref": "#/components/schemas/AgentTurnResponseStreamChunk"
}
}
}
}
},
"tags": [
"Agents"
],
"description": "",
"parameters": [
{
"name": "agent_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "turn_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ContinueAgentTurnRequest"
}
}
},
"required": true
}
}
},
"/v1/agents": {
"post": {
"responses": {
@ -2376,6 +2315,67 @@
}
}
},
"/v1/agents/{agent_id}/session/{session_id}/turn/{turn_id}/resume": {
"post": {
"responses": {
"200": {
"description": "A single turn in an interaction with an Agentic System. **OR** streamed agent turn completion response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Turn"
}
},
"text/event-stream": {
"schema": {
"$ref": "#/components/schemas/AgentTurnResponseStreamChunk"
}
}
}
}
},
"tags": [
"Agents"
],
"description": "",
"parameters": [
{
"name": "agent_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "session_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "turn_id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ResumeAgentTurnRequest"
}
}
},
"required": true
}
}
},
"/v1/eval/benchmarks/{benchmark_id}/jobs": {
"post": {
"responses": {
@ -3951,24 +3951,349 @@
"title": "CompletionResponseStreamChunk",
"description": "A chunk of a streamed completion response."
},
"ContinueAgentTurnRequest": {
"AgentConfig": {
"type": "object",
"properties": {
"tool_responses": {
"sampling_params": {
"$ref": "#/components/schemas/SamplingParams"
},
"input_shields": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ToolResponseMessage"
"type": "string"
}
},
"stream": {
"type": "boolean"
"output_shields": {
"type": "array",
"items": {
"type": "string"
}
},
"toolgroups": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AgentTool"
}
},
"client_tools": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ToolDef"
}
},
"tool_choice": {
"type": "string",
"enum": [
"auto",
"required",
"none"
],
"title": "ToolChoice",
"description": "Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model.",
"deprecated": true
},
"tool_prompt_format": {
"type": "string",
"enum": [
"json",
"function_tag",
"python_list"
],
"title": "ToolPromptFormat",
"description": "Prompt format for calling custom / zero shot tools.",
"deprecated": true
},
"tool_config": {
"$ref": "#/components/schemas/ToolConfig"
},
"max_infer_iters": {
"type": "integer",
"default": 10
},
"model": {
"type": "string"
},
"instructions": {
"type": "string"
},
"enable_session_persistence": {
"type": "boolean",
"default": false
},
"response_format": {
"$ref": "#/components/schemas/ResponseFormat"
}
},
"additionalProperties": false,
"required": [
"tool_responses"
"model",
"instructions"
],
"title": "ContinueAgentTurnRequest"
"title": "AgentConfig"
},
"AgentTool": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"args": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"name",
"args"
],
"title": "AgentToolGroupWithArgs"
}
]
},
"ToolDef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ToolParameter"
}
},
"metadata": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"name"
],
"title": "ToolDef"
},
"ToolParameter": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"parameter_type": {
"type": "string"
},
"description": {
"type": "string"
},
"required": {
"type": "boolean",
"default": true
},
"default": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
},
"additionalProperties": false,
"required": [
"name",
"parameter_type",
"description",
"required"
],
"title": "ToolParameter"
},
"CreateAgentRequest": {
"type": "object",
"properties": {
"agent_config": {
"$ref": "#/components/schemas/AgentConfig"
}
},
"additionalProperties": false,
"required": [
"agent_config"
],
"title": "CreateAgentRequest"
},
"AgentCreateResponse": {
"type": "object",
"properties": {
"agent_id": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"agent_id"
],
"title": "AgentCreateResponse"
},
"CreateAgentSessionRequest": {
"type": "object",
"properties": {
"session_name": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"session_name"
],
"title": "CreateAgentSessionRequest"
},
"AgentSessionCreateResponse": {
"type": "object",
"properties": {
"session_id": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"session_id"
],
"title": "AgentSessionCreateResponse"
},
"CreateAgentTurnRequest": {
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/UserMessage"
},
{
"$ref": "#/components/schemas/ToolResponseMessage"
}
]
}
},
"stream": {
"type": "boolean"
},
"documents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"content": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/components/schemas/InterleavedContentItem"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/InterleavedContentItem"
}
},
{
"$ref": "#/components/schemas/URL"
}
]
},
"mime_type": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"content",
"mime_type"
],
"title": "Document"
}
},
"toolgroups": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AgentTool"
}
},
"tool_config": {
"$ref": "#/components/schemas/ToolConfig"
}
},
"additionalProperties": false,
"required": [
"messages"
],
"title": "CreateAgentTurnRequest"
},
"InferenceStep": {
"type": "object",
@ -4581,350 +4906,6 @@
],
"title": "AgentTurnResponseTurnStartPayload"
},
"AgentConfig": {
"type": "object",
"properties": {
"sampling_params": {
"$ref": "#/components/schemas/SamplingParams"
},
"input_shields": {
"type": "array",
"items": {
"type": "string"
}
},
"output_shields": {
"type": "array",
"items": {
"type": "string"
}
},
"toolgroups": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AgentTool"
}
},
"client_tools": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ToolDef"
}
},
"tool_choice": {
"type": "string",
"enum": [
"auto",
"required",
"none"
],
"title": "ToolChoice",
"description": "Whether tool use is required or automatic. This is a hint to the model which may not be followed. It depends on the Instruction Following capabilities of the model.",
"deprecated": true
},
"tool_prompt_format": {
"type": "string",
"enum": [
"json",
"function_tag",
"python_list"
],
"title": "ToolPromptFormat",
"description": "Prompt format for calling custom / zero shot tools.",
"deprecated": true
},
"tool_config": {
"$ref": "#/components/schemas/ToolConfig"
},
"max_infer_iters": {
"type": "integer",
"default": 10
},
"model": {
"type": "string"
},
"instructions": {
"type": "string"
},
"enable_session_persistence": {
"type": "boolean",
"default": false
},
"response_format": {
"$ref": "#/components/schemas/ResponseFormat"
}
},
"additionalProperties": false,
"required": [
"model",
"instructions"
],
"title": "AgentConfig"
},
"AgentTool": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"args": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"name",
"args"
],
"title": "AgentToolGroupWithArgs"
}
]
},
"ToolDef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ToolParameter"
}
},
"metadata": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"name"
],
"title": "ToolDef"
},
"ToolParameter": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"parameter_type": {
"type": "string"
},
"description": {
"type": "string"
},
"required": {
"type": "boolean",
"default": true
},
"default": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
},
"additionalProperties": false,
"required": [
"name",
"parameter_type",
"description",
"required"
],
"title": "ToolParameter"
},
"CreateAgentRequest": {
"type": "object",
"properties": {
"agent_config": {
"$ref": "#/components/schemas/AgentConfig"
}
},
"additionalProperties": false,
"required": [
"agent_config"
],
"title": "CreateAgentRequest"
},
"AgentCreateResponse": {
"type": "object",
"properties": {
"agent_id": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"agent_id"
],
"title": "AgentCreateResponse"
},
"CreateAgentSessionRequest": {
"type": "object",
"properties": {
"session_name": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"session_name"
],
"title": "CreateAgentSessionRequest"
},
"AgentSessionCreateResponse": {
"type": "object",
"properties": {
"session_id": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"session_id"
],
"title": "AgentSessionCreateResponse"
},
"CreateAgentTurnRequest": {
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/UserMessage"
},
{
"$ref": "#/components/schemas/ToolResponseMessage"
}
]
}
},
"stream": {
"type": "boolean"
},
"documents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"content": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/components/schemas/InterleavedContentItem"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/InterleavedContentItem"
}
},
{
"$ref": "#/components/schemas/URL"
}
]
},
"mime_type": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"content",
"mime_type"
],
"title": "Document"
}
},
"toolgroups": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AgentTool"
}
},
"tool_config": {
"$ref": "#/components/schemas/ToolConfig"
}
},
"additionalProperties": false,
"required": [
"messages"
],
"title": "CreateAgentTurnRequest"
},
"CreateUploadSessionRequest": {
"type": "object",
"properties": {
@ -8118,6 +8099,25 @@
],
"title": "RegisterVectorDbRequest"
},
"ResumeAgentTurnRequest": {
"type": "object",
"properties": {
"tool_responses": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ToolResponseMessage"
}
},
"stream": {
"type": "boolean"
}
},
"additionalProperties": false,
"required": [
"tool_responses"
],
"title": "ResumeAgentTurnRequest"
},
"RunEvalRequest": {
"type": "object",
"properties": {

View file

@ -160,45 +160,6 @@ paths:
schema:
$ref: '#/components/schemas/CompletionRequest'
required: true
/v1/agents/{agent_id}/session/{session_id}/turn/{turn_id}/continue:
post:
responses:
'200':
description: >-
A single turn in an interaction with an Agentic System. **OR** streamed
agent turn completion response.
content:
application/json:
schema:
$ref: '#/components/schemas/Turn'
text/event-stream:
schema:
$ref: '#/components/schemas/AgentTurnResponseStreamChunk'
tags:
- Agents
description: ''
parameters:
- name: agent_id
in: path
required: true
schema:
type: string
- name: session_id
in: path
required: true
schema:
type: string
- name: turn_id
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ContinueAgentTurnRequest'
required: true
/v1/agents:
post:
responses:
@ -1440,6 +1401,45 @@ paths:
schema:
$ref: '#/components/schemas/QueryTracesRequest'
required: true
/v1/agents/{agent_id}/session/{session_id}/turn/{turn_id}/resume:
post:
responses:
'200':
description: >-
A single turn in an interaction with an Agentic System. **OR** streamed
agent turn completion response.
content:
application/json:
schema:
$ref: '#/components/schemas/Turn'
text/event-stream:
schema:
$ref: '#/components/schemas/AgentTurnResponseStreamChunk'
tags:
- Agents
description: ''
parameters:
- name: agent_id
in: path
required: true
schema:
type: string
- name: session_id
in: path
required: true
schema:
type: string
- name: turn_id
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ResumeAgentTurnRequest'
required: true
/v1/eval/benchmarks/{benchmark_id}/jobs:
post:
responses:
@ -2570,19 +2570,219 @@ components:
title: CompletionResponseStreamChunk
description: >-
A chunk of a streamed completion response.
ContinueAgentTurnRequest:
AgentConfig:
type: object
properties:
tool_responses:
sampling_params:
$ref: '#/components/schemas/SamplingParams'
input_shields:
type: array
items:
$ref: '#/components/schemas/ToolResponseMessage'
stream:
type: string
output_shields:
type: array
items:
type: string
toolgroups:
type: array
items:
$ref: '#/components/schemas/AgentTool'
client_tools:
type: array
items:
$ref: '#/components/schemas/ToolDef'
tool_choice:
type: string
enum:
- auto
- required
- none
title: ToolChoice
description: >-
Whether tool use is required or automatic. This is a hint to the model
which may not be followed. It depends on the Instruction Following capabilities
of the model.
deprecated: true
tool_prompt_format:
type: string
enum:
- json
- function_tag
- python_list
title: ToolPromptFormat
description: >-
Prompt format for calling custom / zero shot tools.
deprecated: true
tool_config:
$ref: '#/components/schemas/ToolConfig'
max_infer_iters:
type: integer
default: 10
model:
type: string
instructions:
type: string
enable_session_persistence:
type: boolean
default: false
response_format:
$ref: '#/components/schemas/ResponseFormat'
additionalProperties: false
required:
- tool_responses
title: ContinueAgentTurnRequest
- model
- instructions
title: AgentConfig
AgentTool:
oneOf:
- type: string
- type: object
properties:
name:
type: string
args:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
additionalProperties: false
required:
- name
- args
title: AgentToolGroupWithArgs
ToolDef:
type: object
properties:
name:
type: string
description:
type: string
parameters:
type: array
items:
$ref: '#/components/schemas/ToolParameter'
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
additionalProperties: false
required:
- name
title: ToolDef
ToolParameter:
type: object
properties:
name:
type: string
parameter_type:
type: string
description:
type: string
required:
type: boolean
default: true
default:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
additionalProperties: false
required:
- name
- parameter_type
- description
- required
title: ToolParameter
CreateAgentRequest:
type: object
properties:
agent_config:
$ref: '#/components/schemas/AgentConfig'
additionalProperties: false
required:
- agent_config
title: CreateAgentRequest
AgentCreateResponse:
type: object
properties:
agent_id:
type: string
additionalProperties: false
required:
- agent_id
title: AgentCreateResponse
CreateAgentSessionRequest:
type: object
properties:
session_name:
type: string
additionalProperties: false
required:
- session_name
title: CreateAgentSessionRequest
AgentSessionCreateResponse:
type: object
properties:
session_id:
type: string
additionalProperties: false
required:
- session_id
title: AgentSessionCreateResponse
CreateAgentTurnRequest:
type: object
properties:
messages:
type: array
items:
oneOf:
- $ref: '#/components/schemas/UserMessage'
- $ref: '#/components/schemas/ToolResponseMessage'
stream:
type: boolean
documents:
type: array
items:
type: object
properties:
content:
oneOf:
- type: string
- $ref: '#/components/schemas/InterleavedContentItem'
- type: array
items:
$ref: '#/components/schemas/InterleavedContentItem'
- $ref: '#/components/schemas/URL'
mime_type:
type: string
additionalProperties: false
required:
- content
- mime_type
title: Document
toolgroups:
type: array
items:
$ref: '#/components/schemas/AgentTool'
tool_config:
$ref: '#/components/schemas/ToolConfig'
additionalProperties: false
required:
- messages
title: CreateAgentTurnRequest
InferenceStep:
type: object
properties:
@ -2990,219 +3190,6 @@ components:
- event_type
- turn_id
title: AgentTurnResponseTurnStartPayload
AgentConfig:
type: object
properties:
sampling_params:
$ref: '#/components/schemas/SamplingParams'
input_shields:
type: array
items:
type: string
output_shields:
type: array
items:
type: string
toolgroups:
type: array
items:
$ref: '#/components/schemas/AgentTool'
client_tools:
type: array
items:
$ref: '#/components/schemas/ToolDef'
tool_choice:
type: string
enum:
- auto
- required
- none
title: ToolChoice
description: >-
Whether tool use is required or automatic. This is a hint to the model
which may not be followed. It depends on the Instruction Following capabilities
of the model.
deprecated: true
tool_prompt_format:
type: string
enum:
- json
- function_tag
- python_list
title: ToolPromptFormat
description: >-
Prompt format for calling custom / zero shot tools.
deprecated: true
tool_config:
$ref: '#/components/schemas/ToolConfig'
max_infer_iters:
type: integer
default: 10
model:
type: string
instructions:
type: string
enable_session_persistence:
type: boolean
default: false
response_format:
$ref: '#/components/schemas/ResponseFormat'
additionalProperties: false
required:
- model
- instructions
title: AgentConfig
AgentTool:
oneOf:
- type: string
- type: object
properties:
name:
type: string
args:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
additionalProperties: false
required:
- name
- args
title: AgentToolGroupWithArgs
ToolDef:
type: object
properties:
name:
type: string
description:
type: string
parameters:
type: array
items:
$ref: '#/components/schemas/ToolParameter'
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
additionalProperties: false
required:
- name
title: ToolDef
ToolParameter:
type: object
properties:
name:
type: string
parameter_type:
type: string
description:
type: string
required:
type: boolean
default: true
default:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
additionalProperties: false
required:
- name
- parameter_type
- description
- required
title: ToolParameter
CreateAgentRequest:
type: object
properties:
agent_config:
$ref: '#/components/schemas/AgentConfig'
additionalProperties: false
required:
- agent_config
title: CreateAgentRequest
AgentCreateResponse:
type: object
properties:
agent_id:
type: string
additionalProperties: false
required:
- agent_id
title: AgentCreateResponse
CreateAgentSessionRequest:
type: object
properties:
session_name:
type: string
additionalProperties: false
required:
- session_name
title: CreateAgentSessionRequest
AgentSessionCreateResponse:
type: object
properties:
session_id:
type: string
additionalProperties: false
required:
- session_id
title: AgentSessionCreateResponse
CreateAgentTurnRequest:
type: object
properties:
messages:
type: array
items:
oneOf:
- $ref: '#/components/schemas/UserMessage'
- $ref: '#/components/schemas/ToolResponseMessage'
stream:
type: boolean
documents:
type: array
items:
type: object
properties:
content:
oneOf:
- type: string
- $ref: '#/components/schemas/InterleavedContentItem'
- type: array
items:
$ref: '#/components/schemas/InterleavedContentItem'
- $ref: '#/components/schemas/URL'
mime_type:
type: string
additionalProperties: false
required:
- content
- mime_type
title: Document
toolgroups:
type: array
items:
$ref: '#/components/schemas/AgentTool'
tool_config:
$ref: '#/components/schemas/ToolConfig'
additionalProperties: false
required:
- messages
title: CreateAgentTurnRequest
CreateUploadSessionRequest:
type: object
properties:
@ -5248,6 +5235,19 @@ components:
- vector_db_id
- embedding_model
title: RegisterVectorDbRequest
ResumeAgentTurnRequest:
type: object
properties:
tool_responses:
type: array
items:
$ref: '#/components/schemas/ToolResponseMessage'
stream:
type: boolean
additionalProperties: false
required:
- tool_responses
title: ResumeAgentTurnRequest
RunEvalRequest:
type: object
properties:

View file

@ -355,10 +355,10 @@ class Agents(Protocol):
) -> Union[Turn, AsyncIterator[AgentTurnResponseStreamChunk]]: ...
@webmethod(
route="/agents/{agent_id}/session/{session_id}/turn/{turn_id}/continue",
route="/agents/{agent_id}/session/{session_id}/turn/{turn_id}/resume",
method="POST",
)
async def continue_agent_turn(
async def resume_agent_turn(
self,
agent_id: str,
session_id: str,

View file

@ -170,7 +170,7 @@ class MetaReferenceAgentsImpl(Agents):
async for event in agent.create_and_execute_turn(request):
yield event
async def continue_agent_turn(
async def resume_agent_turn(
self,
agent_id: str,
session_id: str,