Skip to main content

Module types

Module types 

Source
Expand description

Core data model: content, messages, responses, and options.

This is the Rust equivalent of agent_framework._types.

Structs§

AgentResponse
A full response from an agent run.
AgentResponseUpdate
A single streaming chunk from an agent run.
Annotation
A citation annotation attached to content.
ChatOptions
Common per-request settings for a chat/AI service.
ChatResponse
A full (non-streaming) response from a chat client.
ChatResponseUpdate
A single streaming chunk from a chat client.
CodeInterpreterToolCallContent
A provider-hosted code-interpreter tool call (the model’s request to run code). inputs carries the submitted code / files as nested content.
CodeInterpreterToolResultContent
The result of a provider-hosted code-interpreter tool call. outputs carries the produced logs / files as nested content.
ComputerSafetyCheck
A provider safety warning that must be reviewed before a computer call’s actions are run (upstream ComputerSafetyCheck, COMPUTER_USE).
ComputerToolCallContent
A computer-use request from the model: an ordered list of UI actions for the application to perform, plus any safety checks the application must review (upstream computer_tool_call, experimental COMPUTER_USE).
ComputerToolResultContent
The application’s result for a ComputerToolCallContent, after running its actions: usually a screenshot of the new state (upstream computer_tool_result, experimental COMPUTER_USE).
ContinuationToken
An opaque, provider-issued token that resumes a background / long-running run where it left off.
DataContent
Inline binary data encoded as a data: URI.
Embedding
A single embedding vector with metadata.
EmbeddingGenerationOptions
Common request settings for embedding generation.
EmbeddingInput
One value to embed.
ErrorContent
A non-fatal error surfaced as content.
FinishReason
Reason a chat response finished. Open value wrapper, like FinishReason.
FunctionApprovalRequestContent
A request to the user to approve a function call (human-in-the-loop).
FunctionApprovalResponseContent
A user’s response approving or denying a function call.
FunctionCallContent
A request from the model to call a tool/function.
FunctionResultContent
The result of executing a tool/function.
GeneratedEmbeddings
A batch of generated embeddings plus usage metadata.
HostedFileContent
A reference to a file hosted by the service.
HostedVectorStoreContent
A reference to a vector store hosted by the service.
McpServerToolCallContent
A provider-hosted MCP server tool call the service already routed to a remote MCP server. Recorded for transcript fidelity; not a local function invocation request (always informational_only).
McpServerToolResultContent
The result of a provider-hosted MCP server tool call.
Message
A single chat message: an author role plus an ordered list of content items.
OauthConsentRequestContent
A request for the user to complete an OAuth consent flow (human-in-the-loop).
Role
The role of a message author.
ShellCommandOutputContent
The output of a single shell command execution.
ShellToolCallContent
A shell tool call: the model’s request to run one or more shell commands. This is request metadata, not command output.
ShellToolResultContent
The aggregate result of a shell tool call. Each per-command output is a ShellCommandOutputContent carried in outputs.
TextContent
Plain text content.
TextReasoningContent
Reasoning / chain-of-thought text, distinct from user-facing text.
TextSpanRegion
An annotated region of text, addressed by index range.
UriContent
A reference to a remote resource by URI (not inline data).
UsageContent
Token usage carried inline as a content item.
UsageDetails
Token usage counts for a request/response.

Enums§

AnnotationKind
The discriminator for an Annotation. Upstream tags every annotation with type: "citation"; this is the sole kind today.
Content
The unified content union, discriminated by the type tag.
FunctionArguments
Arguments to a function call: either a raw (possibly partial) string, or a parsed object.
OperationState
Where a resumable (background) operation stands, as reported by the update that carries it.
RegionCoordinateSpace
What an Annotation’s annotated_regions index into. Upstream’s annotated_regions_coordinate_space.
ResponseFormat
The requested structured-output format for a response.
ToolMode
If and how tools may be used for a request. Mirrors the Python ToolMode.

Constants§

FUNCTION_INVOCATION_ERROR_MARKER
The marker a redacted FunctionResultContent::exception serializes as.
MCP_TOOL_RESULT_HOST_PAYLOAD_KEY
The FunctionResultContent::additional_properties key under which an MCP tool keeps its full tools/call result (content blocks with their _meta, structuredContent, the result _meta) for the host (upstream _MCP_TOOL_RESULT_HOST_PAYLOAD_KEY).

Traits§

IntoMessages
Trait for values that can be turned into a list of chat messages, so the public API can accept &str, String, Message, or vectors thereof — mirroring the Python str | Message | list[...] unions.

Functions§

prepare_function_call_results
Serialize content(s) into a JSON string suitable for a tool result payload.
prepare_messages
Normalize loosely-typed input into a list of chat messages, optionally prepending a system instruction. Mirrors prepare_messages.