Configuration for modifying a model call at runtime. All fields are optional and only provided fields will override defaults.
interface ModelRequestAdditional settings to bind to the model when preparing it for invocation.
These settings are applied via bindTools() and can include parameters like
headers, container, etc. The model is re-bound on each request,
so these settings can vary per invocation.
modelSettings: {
headers: { "anthropic-beta": "code-execution-2025-08-25" },
container: "container_abc123"
}The tool response format.
If "content" then the output of the tool is interpreted as the contents of a ToolMessage. If "content_and_artifact" then the output is expected to be a two-tuple corresponding to the (content, artifact) of a ToolMessage.
The runtime context containing metadata, signal, writer, interrupt, etc.
The current agent state (includes both middleware state and built-in state).
The system message for this step. If no systemPrompt was provided, when createAgent
was initialized, an empty system message will be used.
wrapModelCall: async (request, handler) => {
return handler({
...request,
systemMessage: request.systemMessage.concat("something")
});
}wrapModelCall: async (request, handler) => {
return handler({
...request,
systemMessage: request.systemMessage.concat(
new SystemMessage({
content: [{
type: "text",
text: "something",
cache_control: { type: "ephemeral", ttl: "1m" }
}],
})
),
});
}Tool choice configuration (model-specific format). Can be one of:
"auto": means the model can pick between generating a message or calling one or more tools."none": means the model will not call any tool and instead generates a message."required": means the model must call one or more tools.{ type: "function", function: { name: string } }: The model will use the specified function.The system message string for this step.