Skip to content

3.1 and streaming #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
278 changes: 222 additions & 56 deletions openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openapi: 3.0.3
openapi: 3.1.1
info:
title: Agent Connect Protocol
version: '0.1'
Expand Down Expand Up @@ -160,18 +160,18 @@ paths:
schema:
$ref: '#/components/schemas/RunCreate'
required: true
callbacks:
runstatuschange:
"{$request.body#/webhook}":
callbacks:
runstatuschange:
'{$request.body#/webhook}':
post:
requestBody:
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Run'
responses:
"200":
'200':
description: Your server returns this code if it accepts the callback
responses:
'200':
Expand Down Expand Up @@ -410,6 +410,53 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/runs/{run_id}/stream:
get:
tags:
- Runs
summary: Stream the run output
description: >-
Send a stream of events using Server-sent events (SEE). See
<https://html.spec.whatwg.org/multipage/server-sent-events.html> for
details.
operationId: get_run_stream
parameters:
- description: The ID of the run.
required: true
schema:
type: string
format: uuid
title: Run Id
description: The ID of the run.
name: run_id
in: path
responses:
'200':
description: Stream of agent results either as values or updates. Note that the stream of events is carried using the format specified in SSE spec `test/event-stream`
content:
text/event-stream:
schema:
$ref: '#/components/schemas/RunOutputStream'
'204':
description: No Output Available
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Conflict
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/threads:
post:
tags:
Expand Down Expand Up @@ -771,55 +818,76 @@ components:
title: Thread Support
default: false
description: >-
this is True if the agent supports run threads. If this is
False, then the threads tagged with `Threads` are not
this is `true` if the agent supports run threads. If this is
`false`, then the threads tagged with `Threads` are not
available. If missing, it means `false`
interrupts:
type: boolean
title: Interrupt Support
default: false
description: >-
this is True if the agent runs can interrupt to request
this is `true` if the agent runs can interrupt to request
additional input and can be subsequently resumed. If
missing, it means `false`
callbacks:
type: boolean
title: Callback Support
default: false
description: >-
this it True if the agent supports a webhook to report run
results. If this is false, providing a `webhook` at run
this is `true` if the agent supports a webhook to report run
results. If this is `false`, providing a `webhook` at run
creation has no effect. If missing, it means `false`
streaming:
type: object
title: Streaming Modes
description: >-
Streaming modes supported. If missing, streaming is not
supported. If no mode is supproted attempts to stream
output will result in an error.
properties:
values:
type: boolean
title: Values Streaming
description: >-
this is `true` if the agent supports values streaming.
If `false` or missing values streaming is not supported.
updates:
type: boolean
title: Updates Streaming
description: >-
this is `true` if the agent supports updates streaming.
If `false` or missing updates streaming is not
supported.
input:
type: object
description: >-
This object contains an instance of an OpenAPI schema object,
formatted as per the OpenAPI specs:
https://spec.openapis.org/oas/v3.1.1.html#schema-object
example:
type: object
required:
- name
properties:
name:
type: string
address:
type: string
age:
type: integer
format: int32
minimum: 0
examples:
- type: object
required:
- name
properties:
name:
type: string
address:
type: string
age:
type: integer
format: int32
minimum: 0
output:
type: object
description: >-
This object contains an instance of an OpenAPI schema object,
formatted as per the OpenAPI specs:
https://spec.openapis.org/oas/v3.1.1.html#schema-object
example:
type: object
required:
- name
properties:
examples:
- type: object
required:
- name
properties: null
name:
type: string
address:
Expand All @@ -838,11 +906,11 @@ components:
contains an instance of an OpenAPI schema object, formatted as
per the OpenAPI specs:
https://spec.openapis.org/oas/v3.1.1.html#schema-object
example:
type: object
required:
- name
properties:
examples:
- type: object
required:
- name
properties: null
name:
type: string
address:
Expand All @@ -857,11 +925,11 @@ components:
This object contains an instance of an OpenAPI schema object,
formatted as per the OpenAPI specs:
https://spec.openapis.org/oas/v3.1.1.html#schema-object
example:
type: object
required:
- name
properties:
examples:
- type: object
required:
- name
properties: null
name:
type: string
address:
Expand Down Expand Up @@ -891,11 +959,11 @@ components:
This object contains an instance of an OpenAPI schema
object, formatted as per the OpenAPI specs:
https://spec.openapis.org/oas/v3.1.1.html#schema-object
example:
type: object
required:
- name
properties:
examples:
- type: object
required:
- name
properties: null
name:
type: string
address:
Expand All @@ -910,11 +978,11 @@ components:
This object contains an instance of an OpenAPI schema
object, formatted as per the OpenAPI specs:
https://spec.openapis.org/oas/v3.1.1.html#schema-object
example:
type: object
required:
- name
properties:
examples:
- type: object
required:
- name
properties: null
name:
type: string
address:
Expand Down Expand Up @@ -1093,10 +1161,10 @@ components:
This object contains an instance of an OpenAPI schema object, formatted
as per the OpenAPI specs:
https://spec.openapis.org/oas/v3.1.1.html#security-scheme-object-0
example:
type: apiKey
name: api-key
in: header
examples:
- type: apiKey
name: api-key
in: header
AgentSearchRequest:
properties:
name:
Expand Down Expand Up @@ -1161,7 +1229,20 @@ components:
format: uri
title: Status change webhook
description: >-
Webhook to call upon change of run status. This is a url that accepts a POST containing the `Run` object as body. See Callbacks definition.
Webhook to call upon change of run status. This is a url that
accepts a POST containing the `Run` object as body. See Callbacks
definition.
streaming:
type: string
enum:
- values
- udates
title: Streaming Mode
description: >-
if populated, indicates that the client requests to stream results
with the specified streaming mode. The streaming mode requested must
be one of the one supported by the agent as declared in its
manifest.
required:
- agent_id
Run:
Expand Down Expand Up @@ -1280,6 +1361,91 @@ components:
description: The ID of the run.
result:
$ref: '#/components/schemas/OutputSchema'
RunOutputStream:
type: object
title: Run Output Stream Event
description: >-
Server-sent event containing one agent ouptut event. Actual event type
is carried inside the data.
properties:
id:
type: string
description: Unique identifier of the event
title: Event ID
event:
type: string
enum:
- agent_event
description: >-
Event type. This is the constant string `agent_event` to be
compatible with SSE spec. The actual type differentiation is done in
the event itself.
data:
$ref: '#/components/schemas/RunOutputStreamEventData'
RunOutputStreamEventData:
title: Stream Event Payload
description: >-
A serialized JSON data structure carried in the SSE event data field.
The event can carry either a full result, if streaming mode is `values`
or an update if streaming mode is `updates`
oneOf:
- $ref: '#/components/schemas/RunResult'
- $ref: '#/components/schemas/RunResultUpdate'
discriminator:
propertyName: type
mapping:
result: '#/components/schemas/RunResult'
update: '#/components/schemas/RunResultUpdate'
RunResultUpdate:
title: Run Result Update
description: Delta on the Run Result.
type: object
properties:
type:
title: Output Type
type: string
enum:
- update
run_id:
type: string
format: uuid
title: Run Id
description: The ID of the run.
delta:
title: Delta
type: array
description: Array of atomic updates to the `OutputSchema` data structure.
items:
type: object
properties:
affected_field:
type: string
format: jsonpath
description: >-
A Json path pointing to the value the result schema this delta
is for.
value_delta:
oneOf:
- type: string
- type: number
- type: integer
- type: boolean
- type: array
- type: object
title: Value Delta
description: >-
Value delta on the field specified in `affected_field`. Type
of this field must correspond to the type of the affected
field.
operation:
type: string
enum:
- replace
- append
description: >-
Specify the operation to perform on the afftected field.
**Note that `append` is only supported if the type of affected
field is `array` or `string`**
RunError:
title: Run Error
description: Run terminated with an error
Expand Down Expand Up @@ -1347,7 +1513,7 @@ components:
polimorphic object, which means a schema structured with `oneOf` and
`discriminator`. The discriminator is the `interrupt_type`, while the
schemas will be the ones defined in the agent spec under
`interrupts`/`interrupt_payload` For example: oneOf:
`interrupts`/`interrupt_payload` For example: oneOf:
- $ref: '#/components/schemas/ApprovalInterruptPayload'
- $ref: '#/components/schemas/QuestionInterruptPayload'
discriminator:
Expand All @@ -1363,7 +1529,7 @@ components:
schema describes a polimorphic object, which means a schema structured
with `oneOf` and `discriminator`. The discriminator is the
`interrupt_type`, while the schemas will be those defined in the agent
spec under `interrupts`/`resume_payload` For example: oneOf:
spec under `interrupts`/`resume_payload` For example: oneOf:
- $ref: '#/components/schemas/ApprovalResumePayload'
- $ref: '#/components/schemas/QuestionResumePayload'
discriminator:
Expand Down