humans&

API reference

Use this reference to look up Ampersand endpoints, parameters, and responses. For a working example, start with the quickstart. If you are moving an OpenAI integration, check OpenAI compatibility.

Authentication and requests

Use https://ampersand.humansand.ai/v1 as the base URL. Include Authorization: Bearer <your-key>. All endpoints except the model endpoints also require OpenAI-Beta: agents=v1. JSON requests use Content-Type: application/json. Your API key determines which tenant you can access. You cannot select another tenant through headers or message metadata.

The API rejects unknown request fields and bodies larger than 4 MiB. Strings in the body, path, and query cannot contain the null character, U+0000.

To create a session, supply nonempty input, environment={"type":"none"}, and either agent_id or agent.model. If you supply both, fields in agent override the saved agent's settings for the new session.

Use ampersand-v0.1 for model when creating an agent or agent.model when creating a session with inline agent settings.

Endpoints

Append these paths to https://ampersand.humansand.ai/v1. Successful JSON requests return 200. Submitting events returns 202 with an empty body. Streams use text/event-stream. Follow the type links for request and response fields.

Method Path Request body Success response
GET /models None ModelList
GET /models/{model} None ModelResource
POST /agents AgentCreate AgentResource
GET /agents None AgentPage
GET /agents/{agent_id} None AgentResource
POST /agents/{agent_id} AgentUpdate AgentResource
DELETE /agents/{agent_id} None {"id":"…","object":"agent.deleted","deleted":true}
POST /agents/sessions SessionCreate SessionResource, or SSE with stream=true
GET /agents/sessions None SessionPage
GET /agents/sessions/{session_id} None SessionResource
POST /agents/sessions/{session_id} SessionUpdate SessionResource
DELETE /agents/sessions/{session_id} None {"id":"…","object":"agent.session.deleted","deleted":true}
POST /agents/sessions/{session_id}/events EventsCreate 202, empty body
GET /agents/sessions/{session_id}/events None SSE server events
GET /agents/sessions/{session_id}/items None ItemPage of MessageItem, FunctionCallItem, or FunctionResultItem
GET /agents/sessions/{session_id}/turns None TurnPage
GET /agents/sessions/{session_id}/turns/{turn_id} None TurnResource
GET /agents/sessions/{session_id}/context None SessionContext

Account statement routes require an API key linked to an account. The same authentication and request rate limits apply.

Method Path Request body Success response
GET /account/balance None AccountBalance
GET /account/usage None; start and end query parameters AccountUsage

You can send 1–256 events in one request. Include the original turn_id and call_id with each tool result. To cancel work, send an event containing only type="agent.session.input.cancel".

Event POSTs accept Idempotency-Key: repeating the same body and key creates no new work, while reusing the key with a different body returns 409. Agent and session creation reject this header.

You can update a session's metadata and agent.reasoning.effort. An effort update applies to new turns. An active turn keeps its effort through steering, tool waits, and recovery. Omitted effort is unchanged; null effort resets the model default. Null agent or reasoning objects are rejected. Other session agent settings cannot be updated. Updating or deleting the saved agent does not change existing sessions. Deleting a session stops its work and hides its resources. Data may remain in storage after deletion and still count toward storage quota.

Models

GET /models lists the model IDs available to your tenant, sorted by ID. The response contains object="list" and data. It returns the full list in one response and does not use pagination.

GET /models/{model} returns one model. Use the full model ID in the path, including any / characters. An unknown model, or one unavailable to your tenant, returns 404.

Each model has id, object="model", created=0, and owned_by. The created value is always zero because model IDs are aliases with no fixed creation date. Neither endpoint accepts query parameters or requires the OpenAI-Beta header. Both require your API key.

Pagination

When listing agents, sessions, items, or turns, use limit to set the page size and order to choose the direction. limit accepts 1–100 and defaults to 20. order accepts asc or desc and defaults to desc. To get the next page, pass the last returned ID as after and keep the same order.

You can also filter sessions with agent_id. An unknown cursor or unsupported query parameter returns 400.

Each page contains object="list", data, first_id, last_id, and has_more. Keep requesting pages while has_more is true. An empty page has null first and last IDs.

SSE streams do not use pagination. They accept no query parameters and reject Last-Event-ID.

Read context usage

GET /agents/sessions/{session_id}/context returns {"object":"agent.session.context","session_id":"sess_…","input_tokens":4291}. input_tokens is the measured input usage of the latest completed model reply. It is null if no reply has completed or that reply has no usage measurement. The API does not return an older count in its place. Input and tool results added since that reply are not included yet.

This count differs from turn usage, which adds up model calls, and from the saved-history limit, which is measured in bytes.

This endpoint accepts no query parameters. You receive 404 for a deleted session or one owned by another tenant. See the client example.

Account statements

GET /account/balance returns promotional credit, purchased credit, unsettled usage, and available credit. Amounts are integer microdollars: 1,000,000 equals one US dollar. Available credit already accounts for unsettled usage. This endpoint accepts no query parameters.

GET /account/usage?start=YYYY-MM-DD&end=YYYY-MM-DD returns settled Agents API usage for the account that owns your key. Supply both dates in UTC; the results include both the start and end date. Token quantities are grouped by day, key, model, and meter. Spend and billed requests are grouped by day and key.

Recent usage may appear in unsettled_micro before it appears in a usage statement. Each statement can cover 1–92 days and up to 10,000 quantity rows. Exceeding either limit returns 400. This endpoint has no cursor pagination and rejects query fields other than start and end.

API keys without a linked account receive 404. If account statements are not available for your key, contact Ampersand. If statements are temporarily unavailable or too many reads are in progress, you may receive 503 with Retry-After.

Validation and defaults

Agent and session metadata can contain up to 16 string pairs. Keys can be up to 64 characters and values up to 512 characters. Input message metadata is a separate JSON object, limited to 8 KiB. Its reserved keys have specific types: you can omit them, but cannot set them to null. See message details.

When you create an agent, omitted options use these defaults: no tools, disabled multi-agent mode, null reasoning effort, text output with medium verbosity, service tier auto, allow_silent_completion=true, and compaction=auto. Setting these options to null at creation also uses their defaults.

Models with reasoning selection support reasoning.effort="high" or "max". Saved agents keep omitted/null effort as null. A new session captures its model's default when the inherited or overridden effort is null. This lets saved agents change models without carrying an effort the client did not select. Explicit efforts are inherited and must be supported by the selected model. Existing sessions with null effort follow the model's current endpoint defaults. A release can change those defaults; the current Ampersand default output limit is 16,384 tokens, including for these sessions. The Ampersand presets use high with up to 16,384 generated tokens per model call by default, or max with up to 32,768. These limits include reasoning and the answer; they do not limit the complete session or promise that each call uses the full limit. Effort support is model-specific; unsupported selections return 400. reasoning.summary must remain null. See reasoning settings.

When you update an agent, omitted fields keep their current values. instructions=null clears the instructions, while nullable settings reset to their defaults. model=null is rejected. Ampersand options are updated one field at a time; see agent settings. Responses omit compaction when its value is the default, auto.

Give each tool a unique name and an object JSON Schema. The supported dialects are draft 4, 6, 7, 2019-09, and 2020-12 (the default). Each schema can be up to 32 KiB, with at most 128 KiB across all tools and 32 levels of nesting. References must resolve within the schema. The API rejects invalid references and reference cycles that never reach a property. It also rejects schemas that would apply more than 1,024 subschemas to a single value through references and schema keywords. It does not fetch external schemas.

Ampersand checks function arguments before asking your application to run a tool, but this check has limits:

The model receives the full schema. Your handler must check arguments and permissions before running the function.

If a model reserves special control tokens, tool definitions cannot contain those tokens. Ampersand escapes them in instructions, message text, metadata, and tool results before sending that text to the model. Saved API resources keep the original text.

When input moderation is enabled, Ampersand rejects flagged content before saving it. It also rejects image input. If moderation cannot complete its check, the request returns 503.

Server events

Each SSE event has an event_id and a JSON payload. Session events include the session's state, and turn events include the turn's state. Item and text events include session, turn, and item IDs. The field reference below describes each payload.

Family Event types
Session agent.session.created, .in_progress, .requires_action, .idle, .failed
Turn agent.session.turn.created, .in_progress, .completed, .failed, .cancelled
Item agent.session.turn.item.added, .done
Text content part agent.session.turn.content_part.added, .done
Text agent.session.turn.output_text.delta, .done
Error error

Text deltas are available when the provider supports streaming. When the done event arrives, replace the text shown so far with its full text. Only completed items become part of model history. Tool call IDs can repeat across turns, so identify a call by its session, turn, and call IDs together. See recovery for handling disconnects.

Session status is idle, in_progress, requires_action, or failed. Turn status is queued, in_progress, waiting, completed, failed, or cancelled. Check the turn's status even when the session is idle.

waiting means the turn is paused for tool results. Send a result for every entry in required_actions; the turn resumes when none remain.

Usage is null when it is unknown. Token totals can change as more usage is recorded.

Webhooks send signed notifications to your HTTP endpoint. When webhook management is enabled, register an endpoint in the developer console, select its events, and save its one-time signing secret. New endpoints are disabled until you enable them after receiver setup. Endpoint management is available through the console; it is not a public API or OpenAI client operation.

Notifications use the envelope {id, object, created_at, type, data} and support session created, in_progress, action_required, idle, and failed. See webhook notifications for settings, recovery, and signature verification, and WebhookEvent for payload fields.

Errors and limits

HTTP errors use {"error":{"message":"…","type":"…","param":null,"code":null}}. Check code for a more specific cause when it is present. SSE error events also contain an error object. The OpenAI client can raise APIError when it reads one.

HTTP status Meaning What to do
400 Invalid fields, unsupported features, saved-data limits, or content-policy rejection Correct the request. For retained storage limits, contact Ampersand for help.
401 Invalid or missing credential Check the key.
402 Insufficient credit Add credit. If an earlier request may have succeeded, check saved state before retrying.
403 Access denied Check account eligibility and permissions.
404 Resource not found for your tenant Check the ID and the tenant associated with your key.
408 The first 16 KiB of an events request, or its complete smaller body, did not arrive within 10 seconds Check the client connection.
409 A retry key or message ID conflicts with saved input, or the session is changing state Read saved state and compare it with the request you are sending.
413 Request exceeds 4 MiB Reduce the request.
429 Request rate, work rate, or temporary capacity limit Follow Retry-After; preserve the event request key and body.
503 The service or a required dependency is temporarily unavailable Follow Retry-After when present, then check saved state.

An unexpected server failure can return 500. If you cannot tell whether a write succeeded, check saved state before retrying it.

A turn that cannot finish has status failed and an error with code and message. The message "Model output did not match the required response format" means Ampersand could not use the model's output after its retries, for example a call to a function the agent does not declare. Check whether your instructions ask for actions as markup instead of function tools.

Rate limits can apply to both your key and your tenant. A request can count toward the limit before its body is validated, its resource is found, or its idempotency key is checked. Retries can therefore count toward the limit too. Rate-limit responses may include retry-after-ms as well as Retry-After.

Session deletion and events requests containing only cancellations use a separate control budget; the cancellation body must be no larger than 16 KiB. Saved-data limits return 400 without Retry-After. Waiting and retrying the same request will not free stored data.

Field reference

These tables list the request and response fields. You can also download the JSON Schema definitions and select the relevant entry in $defs to validate a payload. The validation rules and service limits above still apply.

An optional field can be omitted. If no default is listed, do not assume the value will be null; the API may calculate it. See validation and defaults for create and update behavior, and agent settings for older saved sessions.

AccountBalance

Field Type Presence Rules
object "account.balance" Optional Schema default: "account.balance".
account_id string Required —
promotional_micro integer Required —
purchased_micro integer Required —
unsettled_micro integer Required —
available_micro integer Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "object": {
      "const": "account.balance",
      "default": "account.balance",
      "title": "Object",
      "type": "string"
    },
    "account_id": {
      "title": "Account Id",
      "type": "string"
    },
    "promotional_micro": {
      "title": "Promotional Micro",
      "type": "integer"
    },
    "purchased_micro": {
      "title": "Purchased Micro",
      "type": "integer"
    },
    "unsettled_micro": {
      "title": "Unsettled Micro",
      "type": "integer"
    },
    "available_micro": {
      "title": "Available Micro",
      "type": "integer"
    }
  },
  "required": [
    "account_id",
    "promotional_micro",
    "purchased_micro",
    "unsettled_micro",
    "available_micro"
  ],
  "title": "AccountBalance",
  "type": "object"
}

AccountUsage

Field Type Presence Rules
object "account.usage" Optional Schema default: "account.usage".
account_id string Required —
start string Required format=date.
end string Required format=date.
quantities List of UsageQuantity Required —
spend List of UsageSpend Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "object": {
      "const": "account.usage",
      "default": "account.usage",
      "title": "Object",
      "type": "string"
    },
    "account_id": {
      "title": "Account Id",
      "type": "string"
    },
    "start": {
      "format": "date",
      "title": "Start",
      "type": "string"
    },
    "end": {
      "format": "date",
      "title": "End",
      "type": "string"
    },
    "quantities": {
      "items": {
        "$ref": "#/$defs/UsageQuantity"
      },
      "title": "Quantities",
      "type": "array"
    },
    "spend": {
      "items": {
        "$ref": "#/$defs/UsageSpend"
      },
      "title": "Spend",
      "type": "array"
    }
  },
  "required": [
    "account_id",
    "start",
    "end",
    "quantities",
    "spend"
  ],
  "title": "AccountUsage",
  "type": "object"
}

AgentCreate

Field Type Presence Rules
model string Required minLength=1.
instructions string or null Optional Schema default: null.
tools List of FunctionTool Optional —
multi_agent MultiAgentDisabled Optional —
reasoning DefaultReasoning Optional —
text DefaultText Optional —
service_tier "auto" Optional Schema default: "auto".
ampersand AmpersandOptions Optional Optional Ampersand behavior; not part of the upstream OpenAI contract.
name string or null Optional Schema default: null.
metadata object Optional maxProperties=16.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "model": {
      "minLength": 1,
      "title": "Model",
      "type": "string"
    },
    "instructions": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Instructions"
    },
    "tools": {
      "items": {
        "$ref": "#/$defs/FunctionTool"
      },
      "title": "Tools",
      "type": "array"
    },
    "multi_agent": {
      "$ref": "#/$defs/MultiAgentDisabled"
    },
    "reasoning": {
      "$ref": "#/$defs/DefaultReasoning"
    },
    "text": {
      "$ref": "#/$defs/DefaultText"
    },
    "service_tier": {
      "const": "auto",
      "default": "auto",
      "title": "Service Tier",
      "type": "string"
    },
    "ampersand": {
      "$ref": "#/$defs/AmpersandOptions",
      "description": "Optional Ampersand behavior; not part of the upstream OpenAI contract."
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Name"
    },
    "metadata": {
      "additionalProperties": {
        "maxLength": 512,
        "type": "string"
      },
      "maxProperties": 16,
      "propertyNames": {
        "maxLength": 64
      },
      "title": "Metadata",
      "type": "object"
    }
  },
  "required": [
    "model"
  ],
  "title": "AgentCreate",
  "type": "object"
}

AgentOverrides

Field Type Presence Rules
model string or null Optional Schema default: null.
instructions string or null Optional Schema default: null.
tools List of FunctionTool or null Optional Schema default: null.
multi_agent MultiAgentDisabled or null Optional Schema default: null.
reasoning DefaultReasoning or null Optional Schema default: null.
text DefaultText or null Optional Schema default: null.
service_tier "auto" or null Optional Schema default: null.
ampersand AmpersandOptions or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "model": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Model"
    },
    "instructions": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Instructions"
    },
    "tools": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/FunctionTool"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Tools"
    },
    "multi_agent": {
      "anyOf": [
        {
          "$ref": "#/$defs/MultiAgentDisabled"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "reasoning": {
      "anyOf": [
        {
          "$ref": "#/$defs/DefaultReasoning"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "text": {
      "anyOf": [
        {
          "$ref": "#/$defs/DefaultText"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "service_tier": {
      "anyOf": [
        {
          "const": "auto",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Service Tier"
    },
    "ampersand": {
      "anyOf": [
        {
          "$ref": "#/$defs/AmpersandOptions"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "title": "AgentOverrides",
  "type": "object"
}

AgentResource

Field Type Presence Rules
model string Required minLength=1.
instructions string or null Optional Schema default: null.
tools List of FunctionTool Optional —
multi_agent MultiAgentDisabled Optional —
reasoning DefaultReasoning Optional —
text DefaultText Optional —
service_tier "auto" Optional Schema default: "auto".
ampersand AmpersandOptions Optional Captured behavior; an absent value in an older snapshot means false.
name string or null Optional Schema default: null.
metadata object Optional maxProperties=16.
id string Required —
object "agent" Optional Schema default: "agent".
created_at integer Required —
updated_at integer Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "model": {
      "minLength": 1,
      "title": "Model",
      "type": "string"
    },
    "instructions": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Instructions"
    },
    "tools": {
      "items": {
        "$ref": "#/$defs/FunctionTool"
      },
      "title": "Tools",
      "type": "array"
    },
    "multi_agent": {
      "$ref": "#/$defs/MultiAgentDisabled"
    },
    "reasoning": {
      "$ref": "#/$defs/DefaultReasoning"
    },
    "text": {
      "$ref": "#/$defs/DefaultText"
    },
    "service_tier": {
      "const": "auto",
      "default": "auto",
      "title": "Service Tier",
      "type": "string"
    },
    "ampersand": {
      "$ref": "#/$defs/AmpersandOptions",
      "description": "Captured behavior; an absent value in an older snapshot means false."
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Name"
    },
    "metadata": {
      "additionalProperties": {
        "maxLength": 512,
        "type": "string"
      },
      "maxProperties": 16,
      "propertyNames": {
        "maxLength": 64
      },
      "title": "Metadata",
      "type": "object"
    },
    "id": {
      "title": "Id",
      "type": "string"
    },
    "object": {
      "const": "agent",
      "default": "agent",
      "title": "Object",
      "type": "string"
    },
    "created_at": {
      "title": "Created At",
      "type": "integer"
    },
    "updated_at": {
      "title": "Updated At",
      "type": "integer"
    }
  },
  "required": [
    "model",
    "id",
    "created_at",
    "updated_at"
  ],
  "title": "AgentResource",
  "type": "object"
}

AgentUpdate

Field Type Presence Rules
model string or null Optional Schema default: null.
instructions string or null Optional Schema default: null.
tools List of FunctionTool or null Optional Schema default: null.
multi_agent MultiAgentDisabled or null Optional Schema default: null.
reasoning DefaultReasoning or null Optional Schema default: null.
text DefaultText or null Optional Schema default: null.
service_tier "auto" or null Optional Schema default: null.
ampersand AmpersandOptions or null Optional Schema default: null.
name string or null Optional Schema default: null.
metadata object or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "model": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Model"
    },
    "instructions": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Instructions"
    },
    "tools": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/FunctionTool"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Tools"
    },
    "multi_agent": {
      "anyOf": [
        {
          "$ref": "#/$defs/MultiAgentDisabled"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "reasoning": {
      "anyOf": [
        {
          "$ref": "#/$defs/DefaultReasoning"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "text": {
      "anyOf": [
        {
          "$ref": "#/$defs/DefaultText"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "service_tier": {
      "anyOf": [
        {
          "const": "auto",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Service Tier"
    },
    "ampersand": {
      "anyOf": [
        {
          "$ref": "#/$defs/AmpersandOptions"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Name"
    },
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": {
            "maxLength": 512,
            "type": "string"
          },
          "maxProperties": 16,
          "propertyNames": {
            "maxLength": 64
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Metadata"
    }
  },
  "title": "AgentUpdate",
  "type": "object"
}

AmpersandOptions

Field Type Presence Rules
compaction "auto", "disabled" Optional Use configured server compaction, or disable it for this agent. Schema default: "auto".
allow_silent_completion boolean Optional Allow a successful empty response to finish without an assistant message. Schema default: true.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "compaction": {
      "default": "auto",
      "description": "Use configured server compaction, or disable it for this agent.",
      "enum": [
        "auto",
        "disabled"
      ],
      "title": "Compaction",
      "type": "string"
    },
    "allow_silent_completion": {
      "default": true,
      "description": "Allow a successful empty response to finish without an assistant message.",
      "title": "Allow Silent Completion",
      "type": "boolean"
    }
  },
  "title": "AmpersandOptions",
  "type": "object"
}

CancelInput

Field Type Presence Rules
type "agent.session.input.cancel" Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "agent.session.input.cancel",
      "title": "Type",
      "type": "string"
    }
  },
  "required": [
    "type"
  ],
  "title": "CancelInput",
  "type": "object"
}

ContentPartEvent

Field Type Presence Rules
type "agent.session.turn.content_part.added", "agent.session.turn.content_part.done" Required —
event_id string Required —
session_id string Required —
turn_id string Required —
output_index integer Required —
item_id string Required —
content_index integer Required —
part OutputText Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "enum": [
        "agent.session.turn.content_part.added",
        "agent.session.turn.content_part.done"
      ],
      "title": "Type",
      "type": "string"
    },
    "event_id": {
      "title": "Event Id",
      "type": "string"
    },
    "session_id": {
      "title": "Session Id",
      "type": "string"
    },
    "turn_id": {
      "title": "Turn Id",
      "type": "string"
    },
    "output_index": {
      "title": "Output Index",
      "type": "integer"
    },
    "item_id": {
      "title": "Item Id",
      "type": "string"
    },
    "content_index": {
      "title": "Content Index",
      "type": "integer"
    },
    "part": {
      "$ref": "#/$defs/OutputText"
    }
  },
  "required": [
    "type",
    "event_id",
    "session_id",
    "turn_id",
    "output_index",
    "item_id",
    "content_index",
    "part"
  ],
  "title": "ContentPartEvent",
  "type": "object"
}

DefaultReasoning

Field Type Presence Rules
effort "high", "max" or null Optional Schema default: null.
summary null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "effort": {
      "anyOf": [
        {
          "enum": [
            "high",
            "max"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Effort"
    },
    "summary": {
      "default": null,
      "title": "Summary",
      "type": "null"
    }
  },
  "title": "DefaultReasoning",
  "type": "object"
}

DefaultText

Field Type Presence Rules
format TextFormat Optional —
verbosity "medium" Optional Schema default: "medium".
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "format": {
      "$ref": "#/$defs/TextFormat"
    },
    "verbosity": {
      "const": "medium",
      "default": "medium",
      "title": "Verbosity",
      "type": "string"
    }
  },
  "title": "DefaultText",
  "type": "object"
}

ErrorEvent

Field Type Presence Rules
type "error" Optional Schema default: "error".
event_id string Required —
session_id string Required —
error SessionError Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "error",
      "default": "error",
      "title": "Type",
      "type": "string"
    },
    "event_id": {
      "title": "Event Id",
      "type": "string"
    },
    "session_id": {
      "title": "Session Id",
      "type": "string"
    },
    "error": {
      "$ref": "#/$defs/SessionError"
    }
  },
  "required": [
    "event_id",
    "session_id",
    "error"
  ],
  "title": "ErrorEvent",
  "type": "object"
}

EventMetadata

Field Type Presence Rules
id string or null Optional Schema default: null.
source string or null Optional Schema default: null.
channel string or null Optional Schema default: null.
sender string or null Optional Schema default: null.
timestamp number or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": {
    "$ref": "#/$defs/JsonValue"
  },
  "properties": {
    "id": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Id"
    },
    "source": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Source"
    },
    "channel": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Channel"
    },
    "sender": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Sender"
    },
    "timestamp": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Timestamp"
    }
  },
  "title": "EventMetadata",
  "type": "object"
}

EventsCreate

Field Type Presence Rules
events List of MessageInput or CancelInput or ToolResultInput Required minItems=1. maxItems=256.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "events": {
      "items": {
        "discriminator": {
          "mapping": {
            "agent.session.input.cancel": "#/$defs/CancelInput",
            "agent.session.input.message": "#/$defs/MessageInput",
            "agent.session.input.tool_result": "#/$defs/ToolResultInput"
          },
          "propertyName": "type"
        },
        "oneOf": [
          {
            "$ref": "#/$defs/MessageInput"
          },
          {
            "$ref": "#/$defs/CancelInput"
          },
          {
            "$ref": "#/$defs/ToolResultInput"
          }
        ]
      },
      "maxItems": 256,
      "minItems": 1,
      "title": "Events",
      "type": "array"
    }
  },
  "required": [
    "events"
  ],
  "title": "EventsCreate",
  "type": "object"
}

FunctionCallItem

Field Type Presence Rules
id string Required —
type "function_call" Optional Schema default: "function_call".
turn_id string Required —
call_id string Required —
name string Required —
arguments object Required —
status "in_progress", "completed", "failed", "incomplete" Optional Schema default: "in_progress".
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "type": {
      "const": "function_call",
      "default": "function_call",
      "title": "Type",
      "type": "string"
    },
    "turn_id": {
      "title": "Turn Id",
      "type": "string"
    },
    "call_id": {
      "title": "Call Id",
      "type": "string"
    },
    "name": {
      "title": "Name",
      "type": "string"
    },
    "arguments": {
      "additionalProperties": {
        "$ref": "#/$defs/JsonValue"
      },
      "title": "Arguments",
      "type": "object"
    },
    "status": {
      "default": "in_progress",
      "enum": [
        "in_progress",
        "completed",
        "failed",
        "incomplete"
      ],
      "title": "Status",
      "type": "string"
    }
  },
  "required": [
    "id",
    "turn_id",
    "call_id",
    "name",
    "arguments"
  ],
  "title": "FunctionCallItem",
  "type": "object"
}

FunctionResultItem

Field Type Presence Rules
id string Required —
type "function_call_output" Optional Schema default: "function_call_output".
turn_id string Required —
call_id string Required —
output string or List of InputText or InputImage or null Optional Schema default: null.
error string or null Optional Schema default: null.
status "completed", "failed" Required —
metadata EventMetadata or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "type": {
      "const": "function_call_output",
      "default": "function_call_output",
      "title": "Type",
      "type": "string"
    },
    "turn_id": {
      "title": "Turn Id",
      "type": "string"
    },
    "call_id": {
      "title": "Call Id",
      "type": "string"
    },
    "output": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "discriminator": {
              "mapping": {
                "input_image": "#/$defs/InputImage",
                "input_text": "#/$defs/InputText"
              },
              "propertyName": "type"
            },
            "oneOf": [
              {
                "$ref": "#/$defs/InputText"
              },
              {
                "$ref": "#/$defs/InputImage"
              }
            ]
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Output"
    },
    "error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Error"
    },
    "status": {
      "enum": [
        "completed",
        "failed"
      ],
      "title": "Status",
      "type": "string"
    },
    "metadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/EventMetadata"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "id",
    "turn_id",
    "call_id",
    "status"
  ],
  "title": "FunctionResultItem",
  "type": "object"
}

FunctionTool

Field Type Presence Rules
type "function" Optional Schema default: "function".
name string Required minLength=1. maxLength=96. pattern=^[a-zA-Z0-9_-]+$.
description string Optional Schema default: "".
parameters object Required —
defer_loading false Optional Schema default: false.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "function",
      "default": "function",
      "title": "Type",
      "type": "string"
    },
    "name": {
      "maxLength": 96,
      "minLength": 1,
      "pattern": "^[a-zA-Z0-9_-]+$",
      "title": "Name",
      "type": "string"
    },
    "description": {
      "default": "",
      "title": "Description",
      "type": "string"
    },
    "parameters": {
      "additionalProperties": {
        "$ref": "#/$defs/JsonValue"
      },
      "title": "Parameters",
      "type": "object"
    },
    "defer_loading": {
      "const": false,
      "default": false,
      "title": "Defer Loading",
      "type": "boolean"
    }
  },
  "required": [
    "name",
    "parameters"
  ],
  "title": "FunctionTool",
  "type": "object"
}

InputImage

Field Type Presence Rules
type "input_image" Optional Schema default: "input_image".
image_url string Required minLength=1.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "input_image",
      "default": "input_image",
      "title": "Type",
      "type": "string"
    },
    "image_url": {
      "minLength": 1,
      "title": "Image Url",
      "type": "string"
    }
  },
  "required": [
    "image_url"
  ],
  "title": "InputImage",
  "type": "object"
}

InputMessage

Field Type Presence Rules
role "user" Required —
content List of InputText or InputImage Required minItems=1.
type "message" Optional Schema default: "message".
metadata EventMetadata or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "role": {
      "const": "user",
      "title": "Role",
      "type": "string"
    },
    "content": {
      "items": {
        "discriminator": {
          "mapping": {
            "input_image": "#/$defs/InputImage",
            "input_text": "#/$defs/InputText"
          },
          "propertyName": "type"
        },
        "oneOf": [
          {
            "$ref": "#/$defs/InputText"
          },
          {
            "$ref": "#/$defs/InputImage"
          }
        ]
      },
      "minItems": 1,
      "title": "Content",
      "type": "array"
    },
    "type": {
      "const": "message",
      "default": "message",
      "title": "Type",
      "type": "string"
    },
    "metadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/EventMetadata"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "role",
    "content"
  ],
  "title": "InputMessage",
  "type": "object"
}

InputText

Field Type Presence Rules
type "input_text" Optional Schema default: "input_text".
text string Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "input_text",
      "default": "input_text",
      "title": "Type",
      "type": "string"
    },
    "text": {
      "title": "Text",
      "type": "string"
    }
  },
  "required": [
    "text"
  ],
  "title": "InputText",
  "type": "object"
}

InputTokenDetails

Field Type Presence Rules
cached_tokens integer Required minimum=0.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "cached_tokens": {
      "minimum": 0,
      "title": "Cached Tokens",
      "type": "integer"
    }
  },
  "required": [
    "cached_tokens"
  ],
  "title": "InputTokenDetails",
  "type": "object"
}

ItemAddedEvent

Field Type Presence Rules
type "agent.session.turn.item.added" Optional Schema default: "agent.session.turn.item.added".
event_id string Required —
session_id string Required —
turn_id string Required —
output_index integer or null Optional Schema default: null.
item MessageItem or FunctionCallItem or FunctionResultItem Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "agent.session.turn.item.added",
      "default": "agent.session.turn.item.added",
      "title": "Type",
      "type": "string"
    },
    "event_id": {
      "title": "Event Id",
      "type": "string"
    },
    "session_id": {
      "title": "Session Id",
      "type": "string"
    },
    "turn_id": {
      "title": "Turn Id",
      "type": "string"
    },
    "output_index": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Output Index"
    },
    "item": {
      "discriminator": {
        "mapping": {
          "function_call": "#/$defs/FunctionCallItem",
          "function_call_output": "#/$defs/FunctionResultItem",
          "message": "#/$defs/MessageItem"
        },
        "propertyName": "type"
      },
      "oneOf": [
        {
          "$ref": "#/$defs/MessageItem"
        },
        {
          "$ref": "#/$defs/FunctionCallItem"
        },
        {
          "$ref": "#/$defs/FunctionResultItem"
        }
      ],
      "title": "Item"
    }
  },
  "required": [
    "event_id",
    "session_id",
    "turn_id",
    "item"
  ],
  "title": "ItemAddedEvent",
  "type": "object"
}

ItemDoneEvent

Field Type Presence Rules
type "agent.session.turn.item.done" Optional Schema default: "agent.session.turn.item.done".
event_id string Required —
session_id string Required —
turn_id string Required —
output_index integer Required —
item MessageItem or FunctionCallItem Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "agent.session.turn.item.done",
      "default": "agent.session.turn.item.done",
      "title": "Type",
      "type": "string"
    },
    "event_id": {
      "title": "Event Id",
      "type": "string"
    },
    "session_id": {
      "title": "Session Id",
      "type": "string"
    },
    "turn_id": {
      "title": "Turn Id",
      "type": "string"
    },
    "output_index": {
      "title": "Output Index",
      "type": "integer"
    },
    "item": {
      "anyOf": [
        {
          "$ref": "#/$defs/MessageItem"
        },
        {
          "$ref": "#/$defs/FunctionCallItem"
        }
      ],
      "title": "Item"
    }
  },
  "required": [
    "event_id",
    "session_id",
    "turn_id",
    "output_index",
    "item"
  ],
  "title": "ItemDoneEvent",
  "type": "object"
}

JsonValue

JSON Schema
JSON
{}

MessageInput

Field Type Presence Rules
type "agent.session.input.message" Required —
input List of InputMessage Required minItems=1.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "agent.session.input.message",
      "title": "Type",
      "type": "string"
    },
    "input": {
      "items": {
        "$ref": "#/$defs/InputMessage"
      },
      "minItems": 1,
      "title": "Input",
      "type": "array"
    }
  },
  "required": [
    "type",
    "input"
  ],
  "title": "MessageInput",
  "type": "object"
}

MessageItem

Field Type Presence Rules
id string Required —
type "message" Optional Schema default: "message".
turn_id string Required —
role "user", "assistant" Required —
content List of InputText or InputImage or OutputText Required —
phase "commentary", "final_answer" or null Optional Schema default: null.
status "in_progress", "completed", "incomplete" Optional Schema default: "completed".
metadata EventMetadata or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "type": {
      "const": "message",
      "default": "message",
      "title": "Type",
      "type": "string"
    },
    "turn_id": {
      "title": "Turn Id",
      "type": "string"
    },
    "role": {
      "enum": [
        "user",
        "assistant"
      ],
      "title": "Role",
      "type": "string"
    },
    "content": {
      "items": {
        "anyOf": [
          {
            "discriminator": {
              "mapping": {
                "input_image": "#/$defs/InputImage",
                "input_text": "#/$defs/InputText"
              },
              "propertyName": "type"
            },
            "oneOf": [
              {
                "$ref": "#/$defs/InputText"
              },
              {
                "$ref": "#/$defs/InputImage"
              }
            ]
          },
          {
            "$ref": "#/$defs/OutputText"
          }
        ]
      },
      "title": "Content",
      "type": "array"
    },
    "phase": {
      "anyOf": [
        {
          "enum": [
            "commentary",
            "final_answer"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Phase"
    },
    "status": {
      "default": "completed",
      "enum": [
        "in_progress",
        "completed",
        "incomplete"
      ],
      "title": "Status",
      "type": "string"
    },
    "metadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/EventMetadata"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "id",
    "turn_id",
    "role",
    "content"
  ],
  "title": "MessageItem",
  "type": "object"
}

Meter

JSON Schema
JSON
{
  "enum": [
    "input_tokens",
    "cached_input_tokens",
    "output_tokens"
  ],
  "title": "Meter",
  "type": "string"
}

ModelList

The models list is one unpaged page, as in the upstream API.

Field Type Presence Rules
object "list" Optional Schema default: "list".
data List of ModelResource Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "description": "The models list is one unpaged page, as in the upstream API.",
  "properties": {
    "object": {
      "const": "list",
      "default": "list",
      "title": "Object",
      "type": "string"
    },
    "data": {
      "items": {
        "$ref": "#/$defs/ModelResource"
      },
      "title": "Data",
      "type": "array"
    }
  },
  "required": [
    "data"
  ],
  "title": "ModelList",
  "type": "object"
}

ModelResource

Field Type Presence Rules
id string Required —
object "model" Optional Schema default: "model".
created 0 Optional Schema default: 0.
owned_by string Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "object": {
      "const": "model",
      "default": "model",
      "title": "Object",
      "type": "string"
    },
    "created": {
      "const": 0,
      "default": 0,
      "title": "Created",
      "type": "integer"
    },
    "owned_by": {
      "title": "Owned By",
      "type": "string"
    }
  },
  "required": [
    "id",
    "owned_by"
  ],
  "title": "ModelResource",
  "type": "object"
}

MultiAgentDisabled

Field Type Presence Rules
enabled false Optional Schema default: false.
max_concurrent_subagents null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "enabled": {
      "const": false,
      "default": false,
      "title": "Enabled",
      "type": "boolean"
    },
    "max_concurrent_subagents": {
      "default": null,
      "title": "Max Concurrent Subagents",
      "type": "null"
    }
  },
  "title": "MultiAgentDisabled",
  "type": "object"
}

NoEnvironment

Field Type Presence Rules
type "none" Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "none",
      "title": "Type",
      "type": "string"
    }
  },
  "required": [
    "type"
  ],
  "title": "NoEnvironment",
  "type": "object"
}

OutputText

Field Type Presence Rules
type "output_text" Optional Schema default: "output_text".
text string Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "output_text",
      "default": "output_text",
      "title": "Type",
      "type": "string"
    },
    "text": {
      "title": "Text",
      "type": "string"
    }
  },
  "required": [
    "text"
  ],
  "title": "OutputText",
  "type": "object"
}

OutputTextDeltaEvent

Field Type Presence Rules
type "agent.session.turn.output_text.delta" Optional Schema default: "agent.session.turn.output_text.delta".
event_id string Required —
session_id string Required —
turn_id string Required —
output_index integer Required —
item_id string Required —
content_index integer Required —
delta string Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "agent.session.turn.output_text.delta",
      "default": "agent.session.turn.output_text.delta",
      "title": "Type",
      "type": "string"
    },
    "event_id": {
      "title": "Event Id",
      "type": "string"
    },
    "session_id": {
      "title": "Session Id",
      "type": "string"
    },
    "turn_id": {
      "title": "Turn Id",
      "type": "string"
    },
    "output_index": {
      "title": "Output Index",
      "type": "integer"
    },
    "item_id": {
      "title": "Item Id",
      "type": "string"
    },
    "content_index": {
      "title": "Content Index",
      "type": "integer"
    },
    "delta": {
      "title": "Delta",
      "type": "string"
    }
  },
  "required": [
    "event_id",
    "session_id",
    "turn_id",
    "output_index",
    "item_id",
    "content_index",
    "delta"
  ],
  "title": "OutputTextDeltaEvent",
  "type": "object"
}

OutputTextEvent

Field Type Presence Rules
type "agent.session.turn.output_text.done" Optional Schema default: "agent.session.turn.output_text.done".
event_id string Required —
session_id string Required —
turn_id string Required —
output_index integer Required —
item_id string Required —
content_index integer Required —
text string Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "agent.session.turn.output_text.done",
      "default": "agent.session.turn.output_text.done",
      "title": "Type",
      "type": "string"
    },
    "event_id": {
      "title": "Event Id",
      "type": "string"
    },
    "session_id": {
      "title": "Session Id",
      "type": "string"
    },
    "turn_id": {
      "title": "Turn Id",
      "type": "string"
    },
    "output_index": {
      "title": "Output Index",
      "type": "integer"
    },
    "item_id": {
      "title": "Item Id",
      "type": "string"
    },
    "content_index": {
      "title": "Content Index",
      "type": "integer"
    },
    "text": {
      "title": "Text",
      "type": "string"
    }
  },
  "required": [
    "event_id",
    "session_id",
    "turn_id",
    "output_index",
    "item_id",
    "content_index",
    "text"
  ],
  "title": "OutputTextEvent",
  "type": "object"
}

OutputTokenDetails

Field Type Presence Rules
reasoning_tokens integer Required minimum=0.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "reasoning_tokens": {
      "minimum": 0,
      "title": "Reasoning Tokens",
      "type": "integer"
    }
  },
  "required": [
    "reasoning_tokens"
  ],
  "title": "OutputTokenDetails",
  "type": "object"
}

PageQuery

Field Type Presence Rules
after string or null Optional Schema default: null.
limit integer Optional Schema default: 20. minimum=1. maximum=100.
order SortOrder Optional Schema default: "desc".
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "after": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "After"
    },
    "limit": {
      "default": 20,
      "maximum": 100,
      "minimum": 1,
      "title": "Limit",
      "type": "integer"
    },
    "order": {
      "$ref": "#/$defs/SortOrder",
      "default": "desc"
    }
  },
  "title": "PageQuery",
  "type": "object"
}

AgentPage

Field Type Presence Rules
object "list" Optional Schema default: "list".
data List of AgentResource Required —
first_id string or null Required —
last_id string or null Required —
has_more boolean Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "object": {
      "const": "list",
      "default": "list",
      "title": "Object",
      "type": "string"
    },
    "data": {
      "items": {
        "$ref": "#/$defs/AgentResource"
      },
      "title": "Data",
      "type": "array"
    },
    "first_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "First Id"
    },
    "last_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Id"
    },
    "has_more": {
      "title": "Has More",
      "type": "boolean"
    }
  },
  "required": [
    "data",
    "first_id",
    "last_id",
    "has_more"
  ],
  "title": "ResourcePage[AgentResource]",
  "type": "object"
}

ItemPage

Field Type Presence Rules
object "list" Optional Schema default: "list".
data List of MessageItem or FunctionCallItem or FunctionResultItem Required —
first_id string or null Required —
last_id string or null Required —
has_more boolean Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "object": {
      "const": "list",
      "default": "list",
      "title": "Object",
      "type": "string"
    },
    "data": {
      "items": {
        "discriminator": {
          "mapping": {
            "function_call": "#/$defs/FunctionCallItem",
            "function_call_output": "#/$defs/FunctionResultItem",
            "message": "#/$defs/MessageItem"
          },
          "propertyName": "type"
        },
        "oneOf": [
          {
            "$ref": "#/$defs/MessageItem"
          },
          {
            "$ref": "#/$defs/FunctionCallItem"
          },
          {
            "$ref": "#/$defs/FunctionResultItem"
          }
        ]
      },
      "title": "Data",
      "type": "array"
    },
    "first_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "First Id"
    },
    "last_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Id"
    },
    "has_more": {
      "title": "Has More",
      "type": "boolean"
    }
  },
  "required": [
    "data",
    "first_id",
    "last_id",
    "has_more"
  ],
  "title": "ResourcePage[Annotated[Union[MessageItem, FunctionCallItem, FunctionResultItem], FieldInfo(annotation=NoneType, required=True, discriminator='type')]]",
  "type": "object"
}

SessionPage

Field Type Presence Rules
object "list" Optional Schema default: "list".
data List of SessionResource Required —
first_id string or null Required —
last_id string or null Required —
has_more boolean Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "object": {
      "const": "list",
      "default": "list",
      "title": "Object",
      "type": "string"
    },
    "data": {
      "items": {
        "$ref": "#/$defs/SessionResource"
      },
      "title": "Data",
      "type": "array"
    },
    "first_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "First Id"
    },
    "last_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Id"
    },
    "has_more": {
      "title": "Has More",
      "type": "boolean"
    }
  },
  "required": [
    "data",
    "first_id",
    "last_id",
    "has_more"
  ],
  "title": "ResourcePage[SessionResource]",
  "type": "object"
}

TurnPage

Field Type Presence Rules
object "list" Optional Schema default: "list".
data List of TurnResource Required —
first_id string or null Required —
last_id string or null Required —
has_more boolean Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "object": {
      "const": "list",
      "default": "list",
      "title": "Object",
      "type": "string"
    },
    "data": {
      "items": {
        "$ref": "#/$defs/TurnResource"
      },
      "title": "Data",
      "type": "array"
    },
    "first_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "First Id"
    },
    "last_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Id"
    },
    "has_more": {
      "title": "Has More",
      "type": "boolean"
    }
  },
  "required": [
    "data",
    "first_id",
    "last_id",
    "has_more"
  ],
  "title": "ResourcePage[TurnResource]",
  "type": "object"
}

SessionAgent

Field Type Presence Rules
model string Required minLength=1.
instructions string or null Optional Schema default: null.
tools List of FunctionTool Optional —
multi_agent MultiAgentDisabled Optional —
reasoning DefaultReasoning Optional —
text DefaultText Optional —
service_tier "auto" Optional Schema default: "auto".
ampersand AmpersandOptions Optional Captured behavior; an absent value in an older snapshot means false.
name string or null Optional Schema default: null.
id string Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "model": {
      "minLength": 1,
      "title": "Model",
      "type": "string"
    },
    "instructions": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Instructions"
    },
    "tools": {
      "items": {
        "$ref": "#/$defs/FunctionTool"
      },
      "title": "Tools",
      "type": "array"
    },
    "multi_agent": {
      "$ref": "#/$defs/MultiAgentDisabled"
    },
    "reasoning": {
      "$ref": "#/$defs/DefaultReasoning"
    },
    "text": {
      "$ref": "#/$defs/DefaultText"
    },
    "service_tier": {
      "const": "auto",
      "default": "auto",
      "title": "Service Tier",
      "type": "string"
    },
    "ampersand": {
      "$ref": "#/$defs/AmpersandOptions",
      "description": "Captured behavior; an absent value in an older snapshot means false."
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Name"
    },
    "id": {
      "title": "Id",
      "type": "string"
    }
  },
  "required": [
    "model",
    "id"
  ],
  "title": "SessionAgent",
  "type": "object"
}

SessionAgentUpdate

Field Type Presence Rules
reasoning SessionReasoningUpdate Optional —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "reasoning": {
      "$ref": "#/$defs/SessionReasoningUpdate"
    }
  },
  "title": "SessionAgentUpdate",
  "type": "object"
}

SessionContext

Field Type Presence Rules
object "agent.session.context" Optional Schema default: "agent.session.context".
session_id string Required —
input_tokens integer or null Required Input tokens of the latest completed reply; null when it has no usage.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "object": {
      "const": "agent.session.context",
      "default": "agent.session.context",
      "title": "Object",
      "type": "string"
    },
    "session_id": {
      "title": "Session Id",
      "type": "string"
    },
    "input_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Input tokens of the latest completed reply; null when it has no usage.",
      "title": "Input Tokens"
    }
  },
  "required": [
    "session_id",
    "input_tokens"
  ],
  "title": "SessionContext",
  "type": "object"
}

SessionCreate

Field Type Presence Rules
environment NoEnvironment Required —
agent AgentOverrides or null Optional Schema default: null.
agent_id string or null Optional Schema default: null.
input string or List of InputMessage Required —
metadata object or null Optional Schema default: null.
vault_ids List of string or null Optional Schema default: null.
stream boolean Optional Schema default: false.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "environment": {
      "$ref": "#/$defs/NoEnvironment"
    },
    "agent": {
      "anyOf": [
        {
          "$ref": "#/$defs/AgentOverrides"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "agent_id": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Agent Id"
    },
    "input": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "$ref": "#/$defs/InputMessage"
          },
          "type": "array"
        }
      ],
      "title": "Input"
    },
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": {
            "maxLength": 512,
            "type": "string"
          },
          "maxProperties": 16,
          "propertyNames": {
            "maxLength": 64
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Metadata"
    },
    "vault_ids": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "maxItems": 0,
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Vault Ids"
    },
    "stream": {
      "default": false,
      "title": "Stream",
      "type": "boolean"
    }
  },
  "required": [
    "environment",
    "input"
  ],
  "title": "SessionCreate",
  "type": "object"
}

SessionError

Field Type Presence Rules
type string Optional Schema default: "server_error".
code string or null Optional Schema default: null.
message string Required —
param string or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "default": "server_error",
      "title": "Type",
      "type": "string"
    },
    "code": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Code"
    },
    "message": {
      "title": "Message",
      "type": "string"
    },
    "param": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Param"
    }
  },
  "required": [
    "message"
  ],
  "title": "SessionError",
  "type": "object"
}

SessionEvent

Field Type Presence Rules
type "agent.session.created", "agent.session.in_progress", "agent.session.requires_action", "agent.session.idle", "agent.session.failed" Required —
event_id string Required —
session SessionResource Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "enum": [
        "agent.session.created",
        "agent.session.in_progress",
        "agent.session.requires_action",
        "agent.session.idle",
        "agent.session.failed"
      ],
      "title": "Type",
      "type": "string"
    },
    "event_id": {
      "title": "Event Id",
      "type": "string"
    },
    "session": {
      "$ref": "#/$defs/SessionResource"
    }
  },
  "required": [
    "type",
    "event_id",
    "session"
  ],
  "title": "SessionEvent",
  "type": "object"
}

SessionReasoningUpdate

Field Type Presence Rules
effort "high", "max" or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "effort": {
      "anyOf": [
        {
          "enum": [
            "high",
            "max"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Effort"
    }
  },
  "title": "SessionReasoningUpdate",
  "type": "object"
}

SessionResource

Field Type Presence Rules
id string Required —
object "agent.session" Optional Schema default: "agent.session".
agent SessionAgent Required —
environment NoEnvironment Optional —
created_at integer Required —
last_active_at integer Required —
metadata object Optional maxProperties=16.
vault_ids List of string Optional —
status "idle", "in_progress", "requires_action", "failed" Required —
error string or null Optional Schema default: null.
required_actions List of FunctionRequiredAction Optional —
usage TokenUsage or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "object": {
      "const": "agent.session",
      "default": "agent.session",
      "title": "Object",
      "type": "string"
    },
    "agent": {
      "$ref": "#/$defs/SessionAgent"
    },
    "environment": {
      "$ref": "#/$defs/NoEnvironment"
    },
    "created_at": {
      "title": "Created At",
      "type": "integer"
    },
    "last_active_at": {
      "title": "Last Active At",
      "type": "integer"
    },
    "metadata": {
      "additionalProperties": {
        "maxLength": 512,
        "type": "string"
      },
      "maxProperties": 16,
      "propertyNames": {
        "maxLength": 64
      },
      "title": "Metadata",
      "type": "object"
    },
    "vault_ids": {
      "items": {
        "type": "string"
      },
      "title": "Vault Ids",
      "type": "array"
    },
    "status": {
      "enum": [
        "idle",
        "in_progress",
        "requires_action",
        "failed"
      ],
      "title": "Status",
      "type": "string"
    },
    "error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Error"
    },
    "required_actions": {
      "items": {
        "$ref": "#/$defs/ampersand_harness__contracts__resources__RequiredAction"
      },
      "title": "Required Actions",
      "type": "array"
    },
    "usage": {
      "anyOf": [
        {
          "$ref": "#/$defs/TokenUsage"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "id",
    "agent",
    "created_at",
    "last_active_at",
    "status"
  ],
  "title": "SessionResource",
  "type": "object"
}

SessionUpdate

Field Type Presence Rules
agent SessionAgentUpdate Optional —
metadata object or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "agent": {
      "$ref": "#/$defs/SessionAgentUpdate"
    },
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": {
            "maxLength": 512,
            "type": "string"
          },
          "maxProperties": 16,
          "propertyNames": {
            "maxLength": 64
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Metadata"
    }
  },
  "title": "SessionUpdate",
  "type": "object"
}

SortOrder

JSON Schema
JSON
{
  "enum": [
    "asc",
    "desc"
  ],
  "title": "SortOrder",
  "type": "string"
}

TextFormat

Field Type Presence Rules
type "text" Optional Schema default: "text".
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "text",
      "default": "text",
      "title": "Type",
      "type": "string"
    }
  },
  "title": "TextFormat",
  "type": "object"
}

TokenUsage

Field Type Presence Rules
input_tokens integer Required minimum=0.
input_tokens_details InputTokenDetails Required —
output_tokens integer Required minimum=0.
output_tokens_details OutputTokenDetails Required —
total_tokens integer Required minimum=0.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "input_tokens": {
      "minimum": 0,
      "title": "Input Tokens",
      "type": "integer"
    },
    "input_tokens_details": {
      "$ref": "#/$defs/InputTokenDetails"
    },
    "output_tokens": {
      "minimum": 0,
      "title": "Output Tokens",
      "type": "integer"
    },
    "output_tokens_details": {
      "$ref": "#/$defs/OutputTokenDetails"
    },
    "total_tokens": {
      "minimum": 0,
      "title": "Total Tokens",
      "type": "integer"
    }
  },
  "required": [
    "input_tokens",
    "input_tokens_details",
    "output_tokens",
    "output_tokens_details",
    "total_tokens"
  ],
  "title": "TokenUsage",
  "type": "object"
}

ToolResultInput

Field Type Presence Rules
type "agent.session.input.tool_result" Required —
turn_id string Required minLength=1.
call_id string Required minLength=1.
success boolean Required —
output string or List of InputText or InputImage or null Optional Schema default: null.
error string or null Optional Schema default: null.
metadata EventMetadata or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "agent.session.input.tool_result",
      "title": "Type",
      "type": "string"
    },
    "turn_id": {
      "minLength": 1,
      "title": "Turn Id",
      "type": "string"
    },
    "call_id": {
      "minLength": 1,
      "title": "Call Id",
      "type": "string"
    },
    "success": {
      "title": "Success",
      "type": "boolean"
    },
    "output": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "discriminator": {
              "mapping": {
                "input_image": "#/$defs/InputImage",
                "input_text": "#/$defs/InputText"
              },
              "propertyName": "type"
            },
            "oneOf": [
              {
                "$ref": "#/$defs/InputText"
              },
              {
                "$ref": "#/$defs/InputImage"
              }
            ]
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Output"
    },
    "error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Error"
    },
    "metadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/EventMetadata"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "type",
    "turn_id",
    "call_id",
    "success"
  ],
  "title": "ToolResultInput",
  "type": "object"
}

TurnError

Field Type Presence Rules
code "server_error", "context_length_exceeded", "session_budget_exceeded", "invalid_request", "insufficient_credit", "access_denied", "billing_request_in_progress", "access_unavailable" Required —
message string Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "code": {
      "enum": [
        "server_error",
        "context_length_exceeded",
        "session_budget_exceeded",
        "invalid_request",
        "insufficient_credit",
        "access_denied",
        "billing_request_in_progress",
        "access_unavailable"
      ],
      "title": "Code",
      "type": "string"
    },
    "message": {
      "title": "Message",
      "type": "string"
    }
  },
  "required": [
    "code",
    "message"
  ],
  "title": "TurnError",
  "type": "object"
}

TurnEvent

Field Type Presence Rules
type "agent.session.turn.created", "agent.session.turn.in_progress", "agent.session.turn.completed", "agent.session.turn.failed", "agent.session.turn.cancelled" Required —
event_id string Required —
session_id string Required —
turn_id string Required —
turn TurnResource Required —
usage TokenUsage or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "enum": [
        "agent.session.turn.created",
        "agent.session.turn.in_progress",
        "agent.session.turn.completed",
        "agent.session.turn.failed",
        "agent.session.turn.cancelled"
      ],
      "title": "Type",
      "type": "string"
    },
    "event_id": {
      "title": "Event Id",
      "type": "string"
    },
    "session_id": {
      "title": "Session Id",
      "type": "string"
    },
    "turn_id": {
      "title": "Turn Id",
      "type": "string"
    },
    "turn": {
      "$ref": "#/$defs/TurnResource"
    },
    "usage": {
      "anyOf": [
        {
          "$ref": "#/$defs/TokenUsage"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "type",
    "event_id",
    "session_id",
    "turn_id",
    "turn"
  ],
  "title": "TurnEvent",
  "type": "object"
}

TurnResource

Field Type Presence Rules
id string Required —
object "agent.session.turn" Optional Schema default: "agent.session.turn".
session_id string Required —
agent_id string Required —
subagent_id null Optional Schema default: null.
created_at integer Required —
started_at integer or null Optional Schema default: null.
completed_at integer or null Optional Schema default: null.
status "queued", "in_progress", "waiting", "completed", "failed", "cancelled" Required —
error TurnError or null Optional Schema default: null.
usage TokenUsage or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "object": {
      "const": "agent.session.turn",
      "default": "agent.session.turn",
      "title": "Object",
      "type": "string"
    },
    "session_id": {
      "title": "Session Id",
      "type": "string"
    },
    "agent_id": {
      "title": "Agent Id",
      "type": "string"
    },
    "subagent_id": {
      "default": null,
      "title": "Subagent Id",
      "type": "null"
    },
    "created_at": {
      "title": "Created At",
      "type": "integer"
    },
    "started_at": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Started At"
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Completed At"
    },
    "status": {
      "enum": [
        "queued",
        "in_progress",
        "waiting",
        "completed",
        "failed",
        "cancelled"
      ],
      "title": "Status",
      "type": "string"
    },
    "error": {
      "anyOf": [
        {
          "$ref": "#/$defs/TurnError"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "usage": {
      "anyOf": [
        {
          "$ref": "#/$defs/TokenUsage"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "id",
    "session_id",
    "agent_id",
    "created_at",
    "status"
  ],
  "title": "TurnResource",
  "type": "object"
}

UsageQuantity

Field Type Presence Rules
day string Required format=date.
key_id string or null Required —
model string Required —
meter Meter Required —
quantity integer Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "day": {
      "format": "date",
      "title": "Day",
      "type": "string"
    },
    "key_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Key Id"
    },
    "model": {
      "title": "Model",
      "type": "string"
    },
    "meter": {
      "$ref": "#/$defs/Meter"
    },
    "quantity": {
      "title": "Quantity",
      "type": "integer"
    }
  },
  "required": [
    "day",
    "key_id",
    "model",
    "meter",
    "quantity"
  ],
  "title": "UsageQuantity",
  "type": "object"
}

UsageSpend

Field Type Presence Rules
day string Required format=date.
key_id string or null Required —
spent_micro integer Required —
requests integer Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "day": {
      "format": "date",
      "title": "Day",
      "type": "string"
    },
    "key_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Key Id"
    },
    "spent_micro": {
      "title": "Spent Micro",
      "type": "integer"
    },
    "requests": {
      "title": "Requests",
      "type": "integer"
    }
  },
  "required": [
    "day",
    "key_id",
    "spent_micro",
    "requests"
  ],
  "title": "UsageSpend",
  "type": "object"
}

WebhookData

Field Type Presence Rules
id string Required —
required_action WebhookRequiredAction or null Optional Schema default: null.
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "required_action": {
      "anyOf": [
        {
          "$ref": "#/$defs/ampersand_harness__webhooks__models__RequiredAction"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "id"
  ],
  "title": "WebhookData",
  "type": "object"
}

WebhookEvent

Field Type Presence Rules
id string Required —
object "event" Optional Schema default: "event".
created_at integer Required —
type WebhookType Required —
data WebhookData Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "object": {
      "const": "event",
      "default": "event",
      "title": "Object",
      "type": "string"
    },
    "created_at": {
      "title": "Created At",
      "type": "integer"
    },
    "type": {
      "$ref": "#/$defs/WebhookType"
    },
    "data": {
      "$ref": "#/$defs/WebhookData"
    }
  },
  "required": [
    "id",
    "created_at",
    "type",
    "data"
  ],
  "title": "WebhookEvent",
  "type": "object"
}

WebhookType

JSON Schema
JSON
{
  "enum": [
    "agent.session.created",
    "agent.session.action_required",
    "agent.session.in_progress",
    "agent.session.idle",
    "agent.session.failed"
  ],
  "title": "WebhookType",
  "type": "string"
}

FunctionRequiredAction

Field Type Presence Rules
type "function_call" Optional Schema default: "function_call".
turn_id string Required —
call_id string Required —
name string Required —
arguments object Required —
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "function_call",
      "default": "function_call",
      "title": "Type",
      "type": "string"
    },
    "turn_id": {
      "title": "Turn Id",
      "type": "string"
    },
    "call_id": {
      "title": "Call Id",
      "type": "string"
    },
    "name": {
      "title": "Name",
      "type": "string"
    },
    "arguments": {
      "additionalProperties": {
        "$ref": "#/$defs/JsonValue"
      },
      "title": "Arguments",
      "type": "object"
    }
  },
  "required": [
    "turn_id",
    "call_id",
    "name",
    "arguments"
  ],
  "title": "RequiredAction",
  "type": "object"
}

WebhookRequiredAction

Field Type Presence Rules
type "function_call" Optional Schema default: "function_call".
JSON Schema
JSON
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "function_call",
      "default": "function_call",
      "title": "Type",
      "type": "string"
    }
  },
  "title": "RequiredAction",
  "type": "object"
}