Create an agent-powered response with tool support
Creates a new AI agent response using advanced language models with autonomous tool usage capabilities.
Authorizations
Body
Request schema for creating a new agent response. Configures the agent's model, input, tools, output format, and behavior. Supports both foreground (blocking) and background (asynchronous) execution with optional streaming.
Apply additional guardrails attached to this saved agent in the caller's team. Saved-agent execution sets this to its canonical agent ID, including pinned versions and background runs. This field only adds policy; it does not authorize access to or execute an agent.
1 - 255Ordered list of model IDs to fall back to when a model call fails (provider error or unhealthy provider), tried in order after model. Each entry must be a model available to your organization, including your own registered models, and may not be auto. When set, this chain replaces any fallback rules configured on the models themselves; an empty list disables fallback for the request. With model: "auto", the chain is tried after the routed model fails. Once the run has switched to a fallback it stays on it for the remaining steps; a step that has already streamed output does not fall back. The served model is reported in resolved_model. Maximum length is configured by the gateway (default 5).
1Additional fields to include in the response output. Allows requesting specific nested data like web search sources, code interpreter outputs, computer screenshots, file search results, input images, output logprobs, or reasoning content. These fields may have performance or cost implications.
web_search_call.action.sources, code_interpreter_call.outputs, computer_call_output.output.image_url, file_search_call.results, message.input_image.image_url, message.output_text.logprobs, reasoning.encrypted_content Configuration options for text output from the model. Includes response format (text, JSON object, JSON schema) and verbosity level (low, medium, high). Use this to control output structure and detail level.
Gateway extension. When true, provider calls are streamed even when stream is false, so per-token delta events are published to the response's event channel and visible via GET /responses/{id}?stream=true. Does not change the shape of this endpoint's HTTP response. Only valid when background=true; foreground requests are rejected. Defaults to false.
Whether to run the model response in the background asynchronously. When true, the request returns immediately with a response ID while the agent processes in the background. Use GET /responses/{id} to retrieve results later. When false, the request blocks until completion. Defaults to false.
Array of tool definitions that the agent can use during response generation. Supports built-in tools (web search, file search, code interpreter, image generation, shell) and custom tools (functions, MCP, OpenAPI, local shell). Shell network_policy supports allowed_domains and inline or vault-backed domain_secrets on container_auto; policies on existing containers (container_reference) are unsupported. Code interpreter memory_limit sets a hard guest memory cap. computer_use_preview is not supported: requests that include it are rejected with a 400 invalid_request_error.
Function tool definition: Defines a callable function tool. Provide a tool name and parameters schema, with optional description and deferred loading.
- Function tool definition
- File search tool definition
- Computer use tool definition
- Web search tool definition
- MCP tool definition
- Code interpreter request tool
- Image generation tool definition
- Local shell tool definition
- Shell request tool
- Custom tool definition
- Web search preview tool definition
- Option 12
- Sleep tool definition
- History tool definition
- Agent tool definition
- Approval tool definition
- Schedule tool definition
- Browser tool definition
- OpenAPI tool definition
The maximum total number of tool calls the agent can make during this response. Useful for controlling execution time and preventing infinite loops. Applies to all built-in tools like web search, file search, code interpreter, etc. Must be a positive integer between 1 and 300. Defaults to 64.
1 <= x <= 300Specifies the processing tier for serving the request. 'auto' lets the system choose, 'default' uses standard processing, 'flex' allows flexible scheduling for lower priority, 'priority' provides faster processing. Defaults to 'auto'.
auto, default, flex, priority Custom metadata to attach to this response as key-value pairs. Keys must be strings up to 64 characters, values must be strings up to 512 characters. Maximum 16 pairs, excluding invocation workspace linkage. Useful for tracking, categorization, or passing custom identifiers through your system.
Response
Successful response - returns either streaming events (SSE) or a complete response object (JSON) depending on the stream parameter
The overall status of the response generation. 'completed' means successfully finished, 'failed' means error occurred, 'in_progress' means currently processing, 'cancelled' means user-cancelled, 'queued' means waiting to start, 'incomplete' means partial completion.
completed, failed, in_progress, cancelled, queued, incomplete Input message item: A message with role and content. Use this for user, assistant, system, or developer turns in structured inputs.
- Input message item
- Output message item
- Output audio item
- File search call item
- Computer call item
- Computer call output item
- Web search call item
- Function call item
- Function call output item
- Reasoning item
- Image generation call item
- Code interpreter call item
- Local shell call item
- Local shell call output item
- Shell call item
- Shell call output item
- MCP list tools item
- MCP approval request item
- MCP approval response item
- Tool approval request item
- Tool approval response item
- MCP call item
- Custom tool call item
- Custom tool call output item
- Item reference item
- Compaction item
Function tool definition: Defines a callable function tool. Provide a tool name and parameters schema, with optional description and deferred loading.
- Function tool definition · object
- File search tool definition · object
- Computer use tool definition · object
- Web search tool definition · object
- any
- Code interpreter tool definition · object
- Image generation tool definition · object
- Local shell tool definition · object
- Shell tool definition · object
- Custom tool definition · object
- Web search preview tool definition · object
- Hosted tool definition · object
- Sleep tool definition · object
- History tool definition · object
- Agent tool definition · object
- Approval tool definition · object
- Schedule tool definition · object
- Browser tool definition · object
- OpenAPI tool definition · object
Where the request was served, as reported by the serving upstream (the x-mka1-serving-location response header, set by MKA1 Compute's workload gateway or a BYO endpoint that chooses to) or, failing that, the single location the model's registry card declares. Null when neither is known, which is the case for externally hosted models. Absent until a route is known.
The verdict of the organization's groundedness output guardrail, when one judged this response: the score, the claims it found and how the retrieved sources bear on each, and those sources. Absent when no groundedness rule applies or the run retrieved no sources. An answer the rule flagged is returned whole with it; one the rule blocked is a refusal (metadata.guardrail_triggered is groundedness) that carries it too.