SSE event reference
Format SSE: event: <event>\ndata: <dane JSON>\n\n. Każdy przyjęty strumień kończy dokładnie jedno done; może je poprzedzać error. Kroki są zapowiadane przed wykonaniem publicznej operacji. Wyniki zawierają dokładne treści publicznych odpowiedzi.
| event | Meaning |
|---|---|
answer.citations | Numbered citations with source/date. |
answer.delta | Answer text after settlement. |
artifact | Whole signed API result. |
budget.exceeded | Unexecuted plan exceeds budget. |
client_tool.call | Client UI action request. |
confirm.required | Pause for user approval. |
done | End and continuation; cost after settlement. |
error | Failure; inspect settlement state. |
step.finished | Finished step and settled cost. |
step.started | Request and estimate before execution. |
step.started
{
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"const": "step.started"
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"step_id": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"tool": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 300
},
"request": {
"type": "object",
"additionalProperties": false,
"properties": {
"method": {
"enum": [
"GET",
"POST",
"PUT",
"DELETE"
]
},
"path": {
"type": "string",
"pattern": "^/v1/"
},
"query": {
"type": "object"
},
"body": {
"type": [
"object",
"null"
]
}
},
"required": [
"method",
"path",
"query",
"body"
]
},
"estimated_credits": {
"type": "integer",
"minimum": 0,
"maximum": 20
}
},
"required": [
"step_id",
"tool",
"label",
"request",
"estimated_credits"
]
}
},
"required": [
"event",
"data"
]
}
step.finished
{
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"const": "step.finished"
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"step_id": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"status": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"credits_charged": {
"type": "integer",
"minimum": 0,
"maximum": 20
},
"duration_ms": {
"type": "integer",
"minimum": 0
},
"artifact_id": {
"type": "string",
"minLength": 1,
"maxLength": 80
}
},
"required": [
"step_id",
"status",
"credits_charged",
"duration_ms"
]
}
},
"required": [
"event",
"data"
]
}
artifact
{
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"const": "artifact"
},
"data": {
"$ref": "#/$defs/AskSignedResult"
}
},
"required": [
"event",
"data"
]
}
answer.delta
{
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"const": "answer.delta"
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"text": {
"type": "string",
"minLength": 1,
"maxLength": 24000
}
},
"required": [
"text"
]
}
},
"required": [
"event",
"data"
]
}
answer.citations
{
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"const": "answer.citations"
},
"data": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"citation_id": {
"type": "integer",
"minimum": 1
},
"artifact_id": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"layer": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"source": {
"$ref": "#/$defs/SourceRef"
},
"as_of": {
"type": [
"string",
"null"
],
"format": "date"
}
},
"required": [
"citation_id",
"artifact_id",
"source",
"as_of"
]
},
"maxItems": 40
}
},
"required": [
"event",
"data"
]
}
client_tool.call
{
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"const": "client_tool.call"
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"call_id": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"arguments": {
"type": "object"
}
},
"required": [
"call_id",
"name",
"arguments"
]
}
},
"required": [
"event",
"data"
]
}
confirm.required
{
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"const": "confirm.required"
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"step_id": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"action": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 300
},
"credits": {
"type": "integer",
"minimum": 0,
"maximum": 20
}
},
"required": [
"step_id",
"action",
"label",
"credits"
]
}
},
"required": [
"event",
"data"
]
}
budget.exceeded
{
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"const": "budget.exceeded"
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"needed": {
"type": "integer",
"minimum": 1,
"maximum": 1000
},
"max_credits": {
"type": "integer",
"minimum": 0,
"maximum": 20
},
"plan": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"step_id": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"tool": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 300
},
"request": {
"type": "object",
"additionalProperties": false,
"properties": {
"method": {
"enum": [
"GET",
"POST",
"PUT",
"DELETE"
]
},
"path": {
"type": "string",
"pattern": "^/v1/"
},
"query": {
"type": "object"
},
"body": {
"type": [
"object",
"null"
]
}
},
"required": [
"method",
"path",
"query",
"body"
]
},
"estimated_credits": {
"type": "integer",
"minimum": 0,
"maximum": 20
}
},
"required": [
"step_id",
"tool",
"label",
"request",
"estimated_credits"
]
},
"maxItems": 12
}
},
"required": [
"needed",
"max_credits",
"plan"
]
}
},
"required": [
"event",
"data"
]
}
done
{
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"const": "done"
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"credits_total": {
"type": "integer",
"minimum": 0,
"maximum": 20
},
"continuation": {
"anyOf": [
{
"$ref": "#/$defs/AskContinuation"
},
{
"type": "null"
}
]
}
},
"required": [
"credits_total",
"continuation"
]
}
},
"required": [
"event",
"data"
]
}
error
{
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"const": "error"
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"message": {
"type": "string",
"minLength": 1,
"maxLength": 500
},
"code": {
"type": "string",
"minLength": 1,
"maxLength": 80
}
},
"required": [
"message",
"code"
]
}
},
"required": [
"event",
"data"
]
}
References resolve against Envelope. See ask guide for sequencing and settlement.