Maniac Docs
API Reference

Schemas

Shared Zod schemas and wire-format types.

@maniac-ai/agents


Interfaces

StepContext

Defined in: src/schemas/hooks.ts:55

Snapshot of run state handed to hooks around a single iteration.

messages is the live list the runner is about to send to the LM (during beforeStep) or just sent (during shouldStop / afterStep). Hooks should treat it as read-only — to mutate, return a StepDecision with messages: ..., which the runner installs in place after the hook chain finishes.

lastResponse and lastCell reference the previous iteration's output (null on iteration 0). During shouldStop and afterStep, the in-flight resp and cell are passed alongside the context as explicit args.

Properties

iteration

iteration: number

Defined in: src/schemas/hooks.ts:56

messages

messages: object[]

Defined in: src/schemas/hooks.ts:57

role

role: "system" | "user" | "assistant" | "tool"

content

content: string | ({ type: "text"; text: string; cache_control?: { type: "ephemeral"; } | null; } | { type: "image"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; cache_control?: { type: "ephemeral"; } | null; } | { type: "file"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; filename?: string | null; cache_control?: { type: "ephemeral"; } | null; })[]

String form is preserved verbatim for back-compat; the ContentPart array form (Phase 3) lets producers attach images and files to any message and annotate individual parts with Anthropic-flavored cache_control. Consumers that only care about the textual portion can call messageToText to flatten either form to a string. See docs/concepts/multimodal-content-and-cache-control.md for the cross-language design.

name?

optional name?: string | null

tool_calls?

optional tool_calls?: object[] | null

tool_call_id?

optional tool_call_id?: string | null

usage

usage: object

Defined in: src/schemas/hooks.ts:58

prompt

prompt: number

completion

completion: number

cost_usd?

optional cost_usd?: number | null

cache_creation_input_tokens?

optional cache_creation_input_tokens?: number | null

cache_read_input_tokens?

optional cache_read_input_tokens?: number | null

elapsedS

elapsedS: number

Defined in: src/schemas/hooks.ts:59

lastResponse

lastResponse: {[key: string]: unknown; content: string | ({ type: "text"; text: string; cache_control?: { type: "ephemeral"; } | null; } | { type: "image"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; cache_control?: { type: "ephemeral"; } | null; } | { type: "file"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; filename?: string | null; cache_control?: { type: "ephemeral"; } | null; })[]; usage: { prompt: number; completion: number; cost_usd?: number | null; cache_creation_input_tokens?: number | null; cache_read_input_tokens?: number | null; }; finish_reason: "length" | "error" | "stop"; tool_calls: object[]; reasoning?: string | null; } | null

Defined in: src/schemas/hooks.ts:60

Union Members
Type Literal

{[key: string]: unknown; content: string | ({ type: "text"; text: string; cache_control?: { type: "ephemeral"; } | null; } | { type: "image"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; cache_control?: { type: "ephemeral"; } | null; } | { type: "file"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; filename?: string | null; cache_control?: { type: "ephemeral"; } | null; })[]; usage: { prompt: number; completion: number; cost_usd?: number | null; cache_creation_input_tokens?: number | null; cache_read_input_tokens?: number | null; }; finish_reason: "length" | "error" | "stop"; tool_calls: object[]; reasoning?: string | null; }

Index Signature

[key: string]: unknown

content

content: string | ({ type: "text"; text: string; cache_control?: { type: "ephemeral"; } | null; } | { type: "image"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; cache_control?: { type: "ephemeral"; } | null; } | { type: "file"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; filename?: string | null; cache_control?: { type: "ephemeral"; } | null; })[]

The model's response content. Mirrors MessageSchema.content's union shape: a plain string for text-only responses (the overwhelming majority today), or a ContentPart array when the adapter streamed multimodal deltas (image / file blocks). The runner forwards this onto the assistant message verbatim, so the shape that flows into messages mirrors what came back from the LM. Consumers that only care about the textual portion can call messageToText.

usage

usage: object

usage.prompt

prompt: number

usage.completion

completion: number

usage.cost_usd?

optional cost_usd?: number | null

usage.cache_creation_input_tokens?

optional cache_creation_input_tokens?: number | null

usage.cache_read_input_tokens?

optional cache_read_input_tokens?: number | null

finish_reason

finish_reason: "length" | "error" | "stop"

tool_calls

tool_calls: object[]

reasoning?

optional reasoning?: string | null


null

lastCell

lastCell: JsonDict | null

Defined in: src/schemas/hooks.ts:69

Optional cell that was produced on the previous iteration. The TypeScript runner doesn't currently surface a typed Cell counterpart to the Python schemas.execution.Cell, so this is left as a free-form JSON dict for forward-compat. null means "no cell" — i.e. the iteration before this one didn't run a REPL cell, or this is the first iteration.

specId

specId: string

Defined in: src/schemas/hooks.ts:70

principal

principal: string

Defined in: src/schemas/hooks.ts:71


StepDecision

Defined in: src/schemas/hooks.ts:90

Outcome of a beforeStep hook. All-undefined means "no change".

request: when set, replaces the InferenceRequest the runner was about to send. Use this to override temperature, max_tokens, stop, or to fully replace the message list.

messages: shorthand for "rewrite the message history but leave everything else on the request alone". When both request and messages are set, request.messages wins.

stop: short-circuit the run. The runner emits final with source: "prepare_step" and AgentResult.final = final ?? lastResponse.content ?? "(stopped by hook)". reason flows into the trace event payload for observability.

Properties

request?

optional request?: { messages: object[]; response_format: "text" | "json"; max_tokens?: number | null; temperature?: number | null; top_p?: number | null; top_k?: number | null; frequency_penalty?: number | null; presence_penalty?: number | null; seed?: number | null; logit_bias?: Record<string, number> | null; stop: string[]; tools: object[]; tool_choice: { kind: "named"; name: string; } | "auto" | "required" | "none"; parallel_tool_calls?: boolean | null; user?: string | null; reasoning?: { effort?: "minimal" | "low" | "medium" | "high" | null; max_tokens?: number | null; summary?: "auto" | "concise" | "detailed" | null; } | null; } | null

Defined in: src/schemas/hooks.ts:91

Union Members
Type Literal

{ messages: object[]; response_format: "text" | "json"; max_tokens?: number | null; temperature?: number | null; top_p?: number | null; top_k?: number | null; frequency_penalty?: number | null; presence_penalty?: number | null; seed?: number | null; logit_bias?: Record<string, number> | null; stop: string[]; tools: object[]; tool_choice: { kind: "named"; name: string; } | "auto" | "required" | "none"; parallel_tool_calls?: boolean | null; user?: string | null; reasoning?: { effort?: "minimal" | "low" | "medium" | "high" | null; max_tokens?: number | null; summary?: "auto" | "concise" | "detailed" | null; } | null; }

messages

messages: object[]

response_format

response_format: "text" | "json"

max_tokens?

optional max_tokens?: number | null

temperature?

optional temperature?: number | null

top_p?

optional top_p?: number | null

Nucleus-sampling cutoff. Forwarded verbatim as top_p by every OpenAI-compatible adapter and as top_p by Anthropic. null/omitted (the default) leaves the field off so the provider default applies. Setting both temperature and top_p is allowed by the wire formats but most providers recommend tuning only one.

top_k?

optional top_k?: number | null

Top-k sampling cutoff. Native on Anthropic (top_k) and most OpenAI-compatible open-model gateways (OpenRouter, llama.cpp, mlx, vLLM, ...). Not part of vanilla OpenAI Chat Completions — sending it to api.openai.com is rejected server-side, mirroring the existing reasoning_effort contract (forwarded verbatim; unsupported endpoints surface the rejection). null/omitted leaves it off.

frequency_penalty?

optional frequency_penalty?: number | null

OpenAI frequency_penalty (typically -2.0..2.0). Forwarded by OpenAI-compatible adapters and LiteLLM; Anthropic has no equivalent and silently ignores it. null/omitted leaves it off.

presence_penalty?

optional presence_penalty?: number | null

OpenAI presence_penalty (typically -2.0..2.0). Forwarded by OpenAI-compatible adapters and LiteLLM; Anthropic has no equivalent and silently ignores it. null/omitted leaves it off.

seed?

optional seed?: number | null

Best-effort deterministic-sampling seed. Forwarded as seed by OpenAI-compatible adapters and LiteLLM (providers treat it as a hint, not a hard guarantee); Anthropic has no equivalent and silently ignores it. null/omitted leaves it off.

logit_bias?

optional logit_bias?: Record<string, number> | null

Per-token logit bias map (token-id string -> bias, typically -100..100). Forwarded as logit_bias by OpenAI-compatible adapters and LiteLLM; Anthropic has no equivalent and silently ignores it. null/omitted leaves it off.

stop

stop: string[]

tools

tools: object[]

tool_choice

tool_choice: { kind: "named"; name: string; } | "auto" | "required" | "none"

parallel_tool_calls?

optional parallel_tool_calls?: boolean | null

Whether the provider may emit multiple tool calls in a single turn. OpenAI-compatible adapters forward it as parallel_tool_calls (only when tools is non-empty, the provider's own constraint). Anthropic expresses the inverse via tool_choice.disable_parallel_tool_use: a value of false is translated to disable_parallel_tool_use: true; true/null leave Anthropic's default (parallel allowed) untouched. null/omitted leaves it off for OpenAI-compatible providers.

user?

optional user?: string | null

Opaque stable end-user identifier for provider-side abuse monitoring. OpenAI-compatible adapters forward it as user; Anthropic maps it to metadata.user_id. null/omitted leaves it off.

reasoning?

optional reasoning?: { effort?: "minimal" | "low" | "medium" | "high" | null; max_tokens?: number | null; summary?: "auto" | "concise" | "detailed" | null; } | null

Optional reasoning configuration. See ReasoningConfigSchema. null/omitted means "use the provider default" -- exactly the pre-Phase-4 behavior, so adapters can ignore this field unmodified when callers don't set it.

Union Members
Type Literal

{ effort?: "minimal" | "low" | "medium" | "high" | null; max_tokens?: number | null; summary?: "auto" | "concise" | "detailed" | null; }

effort?

optional effort?: "minimal" | "low" | "medium" | "high" | null

max_tokens?

optional max_tokens?: number | null

Hard cap on the reasoning token budget. When set:

  • Anthropic adapter forwards it as thinking.budget_tokens.
  • OpenAI-compatible adapter ignores it (chat completions has no per-call budget knob beyond max_completion_tokens); callers wanting a hard cap on OpenAI should set InferenceRequest.max_tokens.
summary?

optional summary?: "auto" | "concise" | "detailed" | null

OpenAI Responses-style summary verbosity. Recognized by adapters that hit the Responses API; ignored by chat-completions adapters.


null


null

messages?

optional messages?: object[] | null

Defined in: src/schemas/hooks.ts:92

stop?

optional stop?: boolean

Defined in: src/schemas/hooks.ts:93

final?

optional final?: string | null

Defined in: src/schemas/hooks.ts:94

reason?

optional reason?: string | null

Defined in: src/schemas/hooks.ts:95


Continuation

Defined in: src/schemas/hooks.ts:111

Outcome of a beforeFinalize hook that vetoes termination.

Returning a Continuation from beforeFinalize tells the runner: "the model emitted a tool-call-less response that would terminate the run, but the task isn't really done yet — append this nudge as a user message and iterate again." The runner counts the rejected turn as a real iteration so the budget eventually wins.

userMessage is the body the runner appends as role: "user". reason is recorded on the trace event so a post-mortem can attribute the veto to the right hook without parsing message text.

Properties

userMessage

userMessage: string

Defined in: src/schemas/hooks.ts:112

reason?

optional reason?: string | null

Defined in: src/schemas/hooks.ts:113


StepHook

Defined in: src/schemas/hooks.ts:124

Four-method observer/transformer around one root iteration.

Implementations may extend BaseStepHook (re-exported from @maniac-ai/agents) to inherit no-op defaults and override only the methods they care about. Direct implementers must define all four methods.

Methods

beforeStep()

beforeStep(ctx): Promise<StepDecision | null | undefined>

Defined in: src/schemas/hooks.ts:125

Parameters
ctx

StepContext

Returns

Promise<StepDecision | null | undefined>

beforeFinalize()

beforeFinalize(ctx, resp): Promise<Continuation | null | undefined>

Defined in: src/schemas/hooks.ts:126

Parameters
ctx

StepContext

resp
content

string | ({ type: "text"; text: string; cache_control?: { type: "ephemeral"; } | null; } | { type: "image"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; cache_control?: { type: "ephemeral"; } | null; } | { type: "file"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; filename?: string | null; cache_control?: { type: "ephemeral"; } | null; })[] = ...

The model's response content. Mirrors MessageSchema.content's union shape: a plain string for text-only responses (the overwhelming majority today), or a ContentPart array when the adapter streamed multimodal deltas (image / file blocks). The runner forwards this onto the assistant message verbatim, so the shape that flows into messages mirrors what came back from the LM. Consumers that only care about the textual portion can call messageToText.

usage

{ prompt: number; completion: number; cost_usd?: number | null; cache_creation_input_tokens?: number | null; cache_read_input_tokens?: number | null; } = ...

usage.prompt

number = ...

usage.completion

number = ...

usage.cost_usd?

number | null = ...

usage.cache_creation_input_tokens?

number | null = ...

usage.cache_read_input_tokens?

number | null = ...

finish_reason

"length" | "error" | "stop" = ...

tool_calls

object[] = ...

reasoning?

string | null = ...

Returns

Promise<Continuation | null | undefined>

shouldStop()

shouldStop(ctx, resp, cell): Promise<boolean>

Defined in: src/schemas/hooks.ts:130

Parameters
ctx

StepContext

resp
content

string | ({ type: "text"; text: string; cache_control?: { type: "ephemeral"; } | null; } | { type: "image"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; cache_control?: { type: "ephemeral"; } | null; } | { type: "file"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; filename?: string | null; cache_control?: { type: "ephemeral"; } | null; })[] = ...

The model's response content. Mirrors MessageSchema.content's union shape: a plain string for text-only responses (the overwhelming majority today), or a ContentPart array when the adapter streamed multimodal deltas (image / file blocks). The runner forwards this onto the assistant message verbatim, so the shape that flows into messages mirrors what came back from the LM. Consumers that only care about the textual portion can call messageToText.

usage

{ prompt: number; completion: number; cost_usd?: number | null; cache_creation_input_tokens?: number | null; cache_read_input_tokens?: number | null; } = ...

usage.prompt

number = ...

usage.completion

number = ...

usage.cost_usd?

number | null = ...

usage.cache_creation_input_tokens?

number | null = ...

usage.cache_read_input_tokens?

number | null = ...

finish_reason

"length" | "error" | "stop" = ...

tool_calls

object[] = ...

reasoning?

string | null = ...

cell

JsonDict | null

Returns

Promise<boolean>

afterStep()

afterStep(ctx, resp, cell): Promise<void>

Defined in: src/schemas/hooks.ts:135

Parameters
ctx

StepContext

resp
content

string | ({ type: "text"; text: string; cache_control?: { type: "ephemeral"; } | null; } | { type: "image"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; cache_control?: { type: "ephemeral"; } | null; } | { type: "file"; source: { kind: "base64"; media_type: string; data: string; } | { kind: "url"; url: string; }; filename?: string | null; cache_control?: { type: "ephemeral"; } | null; })[] = ...

The model's response content. Mirrors MessageSchema.content's union shape: a plain string for text-only responses (the overwhelming majority today), or a ContentPart array when the adapter streamed multimodal deltas (image / file blocks). The runner forwards this onto the assistant message verbatim, so the shape that flows into messages mirrors what came back from the LM. Consumers that only care about the textual portion can call messageToText.

usage

{ prompt: number; completion: number; cost_usd?: number | null; cache_creation_input_tokens?: number | null; cache_read_input_tokens?: number | null; } = ...

usage.prompt

number = ...

usage.completion

number = ...

usage.cost_usd?

number | null = ...

usage.cache_creation_input_tokens?

number | null = ...

usage.cache_read_input_tokens?

number | null = ...

finish_reason

"length" | "error" | "stop" = ...

tool_calls

object[] = ...

reasoning?

string | null = ...

cell

JsonDict | null

Returns

Promise<void>

Type Aliases

PrepareStep

PrepareStep = (ctx) => StepDecision | null | undefined | Promise<StepDecision | null | undefined>

Defined in: src/schemas/hooks.ts:147

Sugar form of beforeStep. Sync or async; returning null / undefined is the no-op. Agent({ prepare_step: ... }) wraps a callable into a synthesized StepHook.

Parameters

ctx

StepContext

Returns

StepDecision | null | undefined | Promise<StepDecision | null | undefined>


StopWhen

StopWhen = (ctx, resp) => boolean | Promise<boolean>

Defined in: src/schemas/hooks.ts:156

Sugar form of shouldStop. Sync or async; returning true halts the loop. Agent({ stop_when: ... }) wraps a callable into a synthesized StepHook.

Parameters

ctx

StepContext

resp

InferenceResponse

Returns

boolean | Promise<boolean>

References

AgentBudgetSchema

Re-exports AgentBudgetSchema


AgentBudget

Re-exports AgentBudget


RequestContextSchema

Re-exports RequestContextSchema


RequestContext

Re-exports RequestContext


InstructionsBuilder

Re-exports InstructionsBuilder


TraceKind

Re-exports TraceKind


TraceKindSchema

Re-exports TraceKindSchema


TokenPayloadSchema

Re-exports TokenPayloadSchema


TokenPayload

Re-exports TokenPayload


LMCallStartPayloadSchema

Re-exports LMCallStartPayloadSchema


LMCallStartPayload

Re-exports LMCallStartPayload


LMCallPayloadSchema

Re-exports LMCallPayloadSchema


LMCallPayload

Re-exports LMCallPayload


ToolPhaseSchema

Re-exports ToolPhaseSchema


ToolPhase

Re-exports ToolPhase


ToolResultPreviewSchema

Re-exports ToolResultPreviewSchema


ToolResultPreview

Re-exports ToolResultPreview


ToolPayloadSchema

Re-exports ToolPayloadSchema


ToolPayload

Re-exports ToolPayload


ToolCallArgumentsDeltaPayloadSchema

Re-exports ToolCallArgumentsDeltaPayloadSchema


ToolCallArgumentsDeltaPayload

Re-exports ToolCallArgumentsDeltaPayload


CellPhaseSchema

Re-exports CellPhaseSchema


CellPhase

Re-exports CellPhase


CellPayloadSchema

Re-exports CellPayloadSchema


CellPayload

Re-exports CellPayload


SubagentPhaseSchema

Re-exports SubagentPhaseSchema


SubagentPhase

Re-exports SubagentPhase


SubagentPayloadSchema

Re-exports SubagentPayloadSchema


SubagentPayload

Re-exports SubagentPayload


AgentPhaseSchema

Re-exports AgentPhaseSchema


AgentPhase

Re-exports AgentPhase


AgentPayloadSchema

Re-exports AgentPayloadSchema


AgentPayload

Re-exports AgentPayload


ApprovalPhaseSchema

Re-exports ApprovalPhaseSchema


ApprovalPhase

Re-exports ApprovalPhase


ApprovalSourceSchema

Re-exports ApprovalSourceSchema


ApprovalSource

Re-exports ApprovalSource


ApprovalDecisionSchema

Re-exports ApprovalDecisionSchema


ApprovalDecision

Re-exports ApprovalDecision


ApprovalPayloadSchema

Re-exports ApprovalPayloadSchema


ApprovalPayload

Re-exports ApprovalPayload


MemoryPayloadSchema

Re-exports MemoryPayloadSchema


MemoryPayload

Re-exports MemoryPayload


GuardrailPayloadSchema

Re-exports GuardrailPayloadSchema


GuardrailPayload

Re-exports GuardrailPayload


BackgroundTaskPayloadSchema

Re-exports BackgroundTaskPayloadSchema


BackgroundTaskPayload

Re-exports BackgroundTaskPayload


StepPhaseSchema

Re-exports StepPhaseSchema


StepPhase

Re-exports StepPhase


StepPayloadSchema

Re-exports StepPayloadSchema


StepPayload

Re-exports StepPayload


RetryPayloadSchema

Re-exports RetryPayloadSchema


RetryPayload

Re-exports RetryPayload


FinalPayloadSchema

Re-exports FinalPayloadSchema


FinalPayload

Re-exports FinalPayload


ErrorPayloadSchema

Re-exports ErrorPayloadSchema


ErrorPayload

Re-exports ErrorPayload


ContentPartKindSchema

Re-exports ContentPartKindSchema


ContentPartKind

Re-exports ContentPartKind


TokenEventSchema

Re-exports TokenEventSchema


TokenEvent

Re-exports TokenEvent


LMCallStartEventSchema

Re-exports LMCallStartEventSchema


LMCallStartEvent

Re-exports LMCallStartEvent


LMCallEventSchema

Re-exports LMCallEventSchema


LMCallEvent

Re-exports LMCallEvent


ToolEventSchema

Re-exports ToolEventSchema


ToolEvent

Re-exports ToolEvent


ToolCallArgumentsDeltaEventSchema

Re-exports ToolCallArgumentsDeltaEventSchema


ToolCallArgumentsDeltaEvent

Re-exports ToolCallArgumentsDeltaEvent


CellEventSchema

Re-exports CellEventSchema


CellEvent

Re-exports CellEvent


SubagentEventSchema

Re-exports SubagentEventSchema


SubagentEvent

Re-exports SubagentEvent


AgentEventSchema

Re-exports AgentEventSchema


AgentEventVariant

Re-exports AgentEventVariant


ApprovalEventSchema

Re-exports ApprovalEventSchema


ApprovalEvent

Re-exports ApprovalEvent


MemoryEventSchema

Re-exports MemoryEventSchema


MemoryEvent

Re-exports MemoryEvent


GuardrailEventSchema

Re-exports GuardrailEventSchema


GuardrailEvent

Re-exports GuardrailEvent


BackgroundTaskEventSchema

Re-exports BackgroundTaskEventSchema


BackgroundTaskEvent

Re-exports BackgroundTaskEvent


StepEventSchema

Re-exports StepEventSchema


StepEvent

Re-exports StepEvent


RetryEventSchema

Re-exports RetryEventSchema


RetryEvent

Re-exports RetryEvent


FinalEventSchema

Re-exports FinalEventSchema


FinalEvent

Re-exports FinalEvent


ErrorEventSchema

Re-exports ErrorEventSchema


ErrorEvent

Re-exports ErrorEvent


StreamGapPayloadSchema

Re-exports StreamGapPayloadSchema


StreamGapPayload

Re-exports StreamGapPayload


StreamGapEventSchema

Re-exports StreamGapEventSchema


StreamGapEvent

Re-exports StreamGapEvent


PlanEntryPrioritySchema

Re-exports PlanEntryPrioritySchema


PlanEntryPriority

Re-exports PlanEntryPriority


PlanEntryStatusSchema

Re-exports PlanEntryStatusSchema


PlanEntryStatus

Re-exports PlanEntryStatus


PlanEntrySchema

Re-exports PlanEntrySchema


PlanEntry

Re-exports PlanEntry


PlanPayloadSchema

Re-exports PlanPayloadSchema


PlanPayload

Re-exports PlanPayload


PlanEventSchema

Re-exports PlanEventSchema


PlanEvent

Re-exports PlanEvent


TraceEventSchema

Re-exports TraceEventSchema


TraceEvent

Re-exports TraceEvent


TracePayload

Re-exports TracePayload


TracePayloadFor

Re-exports TracePayloadFor


TraceEventFor

Re-exports TraceEventFor


AgentEvent

Re-exports AgentEvent


AgentResultSchema

Re-exports AgentResultSchema


AgentResult

Re-exports AgentResult


Agent

Re-exports Agent


AgentSpec

Re-exports AgentSpec


normalizeAgent

Re-exports normalizeAgent


normalizeAgentSpec

Re-exports normalizeAgentSpec


resolveInstructions

Re-exports resolveInstructions


makeCheckpoint

Re-exports makeCheckpoint


MakeTraceEventOptions

Re-exports MakeTraceEventOptions


makeTraceEvent

Re-exports makeTraceEvent


PendingSubActionSchema

Re-exports PendingSubActionSchema


PendingSubAction

Re-exports PendingSubAction


PendingApprovalSchema

Re-exports PendingApprovalSchema


PendingApproval

Re-exports PendingApproval


ApprovalResponseSchema

Re-exports ApprovalResponseSchema


ApprovalResponse

Re-exports ApprovalResponse


BaseException

Re-exports BaseException


NeedsApprovalError

Re-exports NeedsApprovalError


SerializedSessionSchema

Re-exports SerializedSessionSchema


SerializedSession

Re-exports SerializedSession


RunCheckpointSchema

Re-exports RunCheckpointSchema


RunCheckpoint

Re-exports RunCheckpoint


BackgroundStatusSchema

Re-exports BackgroundStatusSchema


BackgroundStatus

Re-exports BackgroundStatus


BackpressurePolicySchema

Re-exports BackpressurePolicySchema


BackpressurePolicy

Re-exports BackpressurePolicy


TaskHook

Re-exports TaskHook


BackgroundConfigSchema

Re-exports BackgroundConfigSchema


BackgroundConfig

Re-exports BackgroundConfig


AgentBackgroundConfigSchema

Re-exports AgentBackgroundConfigSchema


AgentBackgroundConfig

Re-exports AgentBackgroundConfig


BackgroundTasksConfigSchema

Re-exports BackgroundTasksConfigSchema


BackgroundTasksConfig

Re-exports BackgroundTasksConfig


BackgroundTaskRecordSchema

Re-exports BackgroundTaskRecordSchema


BackgroundTaskRecord

Re-exports BackgroundTaskRecord


JsonValueSchema

Re-exports JsonValueSchema


JsonValue

Re-exports JsonValue


JsonDict

Re-exports JsonDict


JsonDictSchema

Re-exports JsonDictSchema


UnknownRecordSchema

Re-exports UnknownRecordSchema


nowIso

Re-exports nowIso


parseJsonDict

Re-exports parseJsonDict


toJsonValue

Re-exports toJsonValue


toJsonDict

Re-exports toJsonDict


SafeJsonValueResult

Re-exports SafeJsonValueResult


safeToJsonValue

Re-exports safeToJsonValue


CellSchema

Re-exports CellSchema


Cell

Re-exports Cell


ScratchpadVariableSchema

Re-exports ScratchpadVariableSchema


ScratchpadVariable

Re-exports ScratchpadVariable


ScratchpadStateSchema

Re-exports ScratchpadStateSchema


ScratchpadState

Re-exports ScratchpadState


SandboxRunResultSchema

Re-exports SandboxRunResultSchema


SandboxRunResult

Re-exports SandboxRunResult


Sandbox

Re-exports Sandbox


ExecutionEnvironment

Re-exports ExecutionEnvironment


CacheControlEphemeralSchema

Re-exports CacheControlEphemeralSchema


CacheControlEphemeral

Re-exports CacheControlEphemeral


CacheControlSchema

Re-exports CacheControlSchema


CacheControl

Re-exports CacheControl


ImageBase64SourceSchema

Re-exports ImageBase64SourceSchema


ImageBase64Source

Re-exports ImageBase64Source


ImageUrlSourceSchema

Re-exports ImageUrlSourceSchema


ImageUrlSource

Re-exports ImageUrlSource


ImageSourceSchema

Re-exports ImageSourceSchema


ImageSource

Re-exports ImageSource


FileSourceSchema

Re-exports FileSourceSchema


FileSource

Re-exports FileSource


TextPartSchema

Re-exports TextPartSchema


TextPart

Re-exports TextPart


ImagePartSchema

Re-exports ImagePartSchema


ImagePart

Re-exports ImagePart


FilePartSchema

Re-exports FilePartSchema


FilePart

Re-exports FilePart


ContentPartSchema

Re-exports ContentPartSchema


ContentPart

Re-exports ContentPart


MessageContentSchema

Re-exports MessageContentSchema


MessageContent

Re-exports MessageContent


messageToText

Re-exports messageToText


ToolDefSchema

Re-exports ToolDefSchema


ToolDef

Re-exports ToolDef


ToolCallSchema

Re-exports ToolCallSchema


ToolCall

Re-exports ToolCall


MessageSchema

Re-exports MessageSchema


Message

Re-exports Message


TokenUsageSchema

Re-exports TokenUsageSchema


TokenUsage

Re-exports TokenUsage


addUsage

Re-exports addUsage


NamedToolChoiceSchema

Re-exports NamedToolChoiceSchema


NamedToolChoice

Re-exports NamedToolChoice


ToolChoiceSchema

Re-exports ToolChoiceSchema


ToolChoice

Re-exports ToolChoice


FinishReasonSchema

Re-exports FinishReasonSchema


FinishReason

Re-exports FinishReason


ReasoningEffortSchema

Re-exports ReasoningEffortSchema


ReasoningEffort

Re-exports ReasoningEffort


ReasoningConfigSchema

Re-exports ReasoningConfigSchema


ReasoningConfig

Re-exports ReasoningConfig


InferenceRequestSchema

Re-exports InferenceRequestSchema


InferenceRequest

Re-exports InferenceRequest


effortToAnthropicBudgetTokens

Re-exports effortToAnthropicBudgetTokens


InferenceResponseSchema

Re-exports InferenceResponseSchema


InferenceResponse

Re-exports InferenceResponse


StreamChunkKindSchema

Re-exports StreamChunkKindSchema


StreamChunkKind

Re-exports StreamChunkKind


ToolCallPartialSchema

Re-exports ToolCallPartialSchema


ToolCallPartial

Re-exports ToolCallPartial


StreamChunkSchema

Re-exports StreamChunkSchema


StreamChunk

Re-exports StreamChunk


ModelCallOptions

Re-exports ModelCallOptions


Model

Re-exports Model


asToolDef

Re-exports asToolDef


ModelPricingSchema

Re-exports ModelPricingSchema


ModelPricing

Re-exports ModelPricing


ModelSpecSchema

Re-exports ModelSpecSchema


ModelSpec

Re-exports ModelSpec


ModelCatalogUnsupportedError

Re-exports ModelCatalogUnsupportedError


SupportsModelCatalog

Re-exports SupportsModelCatalog


supportsModelCatalog

Re-exports supportsModelCatalog


MemoryRecordSchema

Re-exports MemoryRecordSchema


MemoryRecord

Re-exports MemoryRecord


MemoryQuerySchema

Re-exports MemoryQuerySchema


MemoryQuery

Re-exports MemoryQuery


MemoryScopeSchema

Re-exports MemoryScopeSchema


MemoryScope

Re-exports MemoryScope


Memory

Re-exports Memory


MemorySequencer

Re-exports MemorySequencer


ObservationStatusSchema

Re-exports ObservationStatusSchema


ObservationStatus

Re-exports ObservationStatus


ObservationRecordSchema

Re-exports ObservationRecordSchema


ObservationRecord

Re-exports ObservationRecord


ReflectionRecordSchema

Re-exports ReflectionRecordSchema


ReflectionRecord

Re-exports ReflectionRecord


ObservationStateSchema

Re-exports ObservationStateSchema


ObservationState

Re-exports ObservationState


TokenEstimator

Re-exports TokenEstimator


ObservationalMemoryConfigSchema

Re-exports ObservationalMemoryConfigSchema


ObservationalMemoryConfig

Re-exports ObservationalMemoryConfig


WorkingMemoryConfigSchema

Re-exports WorkingMemoryConfigSchema


WorkingMemoryConfig

Re-exports WorkingMemoryConfig


MemoryRelevanceFilterConfigSchema

Re-exports MemoryRelevanceFilterConfigSchema


MemoryRelevanceFilterConfig

Re-exports MemoryRelevanceFilterConfig


MemoryAccessModeSchema

Re-exports MemoryAccessModeSchema


MemoryAccessMode

Re-exports MemoryAccessMode


RuntimeMemoryAccessSchema

Re-exports RuntimeMemoryAccessSchema


RuntimeMemoryAccess

Re-exports RuntimeMemoryAccess


RuntimeMemoryAccessInput

Re-exports RuntimeMemoryAccessInput


coerceRuntimeMemoryAccess

Re-exports coerceRuntimeMemoryAccess


GuardrailActionSchema

Re-exports GuardrailActionSchema


GuardrailAction

Re-exports GuardrailAction


GuardrailAllowDecision

Re-exports GuardrailAllowDecision


GuardrailRewriteDecision

Re-exports GuardrailRewriteDecision


GuardrailBlockDecision

Re-exports GuardrailBlockDecision


GuardrailRequireApprovalDecision

Re-exports GuardrailRequireApprovalDecision


GuardrailDecisionSchema

Re-exports GuardrailDecisionSchema


GuardrailDecision

Re-exports GuardrailDecision


allow

Re-exports allow


block

Re-exports block


rewrite

Re-exports rewrite


requireApproval

Re-exports requireApproval


LMCallContextSchema

Re-exports LMCallContextSchema


LMCallContext

Re-exports LMCallContext


ToolCallContextSchema

Re-exports ToolCallContextSchema


ToolCallContext

Re-exports ToolCallContext


LMMiddleware

Re-exports LMMiddleware


ToolMiddleware

Re-exports ToolMiddleware


LMGuardrail

Re-exports LMGuardrail


ToolGuardrail

Re-exports ToolGuardrail


GuardrailBlocked

Re-exports GuardrailBlocked


ArgConstraintOpSchema

Re-exports ArgConstraintOpSchema


ArgConstraintOp

Re-exports ArgConstraintOp


ArgConstraintQuantifierSchema

Re-exports ArgConstraintQuantifierSchema


ArgConstraintQuantifier

Re-exports ArgConstraintQuantifier


ArgConstraintSchema

Re-exports ArgConstraintSchema


ArgConstraint

Re-exports ArgConstraint


PermissionScopeSchema

Re-exports PermissionScopeSchema


PermissionScope

Re-exports PermissionScope


PermissionEffectSchema

Re-exports PermissionEffectSchema


PermissionEffect

Re-exports PermissionEffect


PermissionSchema

Re-exports PermissionSchema


Permission

Re-exports Permission


PendingActionSchema

Re-exports PendingActionSchema


PendingAction

Re-exports PendingAction


DecisionSchema

Re-exports DecisionSchema


Decision

Re-exports Decision


PermissionPolicy

Re-exports PermissionPolicy


ReplConfigSchema

Re-exports ReplConfigSchema


ReplConfig

Re-exports ReplConfig


ReplConfigInput

Re-exports ReplConfigInput


ToolSchemaSchema

Re-exports ToolSchemaSchema


ToolSchema

Re-exports ToolSchema


RuntimeToolCallSchema

Re-exports RuntimeToolCallSchema


RuntimeToolCall

Re-exports RuntimeToolCall


ToolResultCauseSchema

Re-exports ToolResultCauseSchema


ToolResultCause

Re-exports ToolResultCause


ToolResultSchema

Re-exports ToolResultSchema


ToolResult

Re-exports ToolResult


Tool

Re-exports Tool


Toolset

Re-exports Toolset

On this page

InterfacesStepContextPropertiesiterationmessagesrolecontentname?tool_calls?tool_call_id?usagepromptcompletioncost_usd?cache_creation_input_tokens?cache_read_input_tokens?elapsedSlastResponseUnion MembersType LiteralIndex Signaturecontentusageusage.promptusage.completionusage.cost_usd?usage.cache_creation_input_tokens?usage.cache_read_input_tokens?finish_reasontool_callsreasoning?lastCellspecIdprincipalStepDecisionPropertiesrequest?Union MembersType Literalmessagesresponse_formatmax_tokens?temperature?top_p?top_k?frequency_penalty?presence_penalty?seed?logit_bias?stoptoolstool_choiceparallel_tool_calls?user?reasoning?Union MembersType Literaleffort?max_tokens?summary?messages?stop?final?reason?ContinuationPropertiesuserMessagereason?StepHookMethodsbeforeStep()ParametersctxReturnsbeforeFinalize()Parametersctxrespcontentusageusage.promptusage.completionusage.cost_usd?usage.cache_creation_input_tokens?usage.cache_read_input_tokens?finish_reasontool_callsreasoning?ReturnsshouldStop()Parametersctxrespcontentusageusage.promptusage.completionusage.cost_usd?usage.cache_creation_input_tokens?usage.cache_read_input_tokens?finish_reasontool_callsreasoning?cellReturnsafterStep()Parametersctxrespcontentusageusage.promptusage.completionusage.cost_usd?usage.cache_creation_input_tokens?usage.cache_read_input_tokens?finish_reasontool_callsreasoning?cellReturnsType AliasesPrepareStepParametersctxReturnsStopWhenParametersctxrespReturnsReferencesAgentBudgetSchemaAgentBudgetRequestContextSchemaRequestContextInstructionsBuilderTraceKindTraceKindSchemaTokenPayloadSchemaTokenPayloadLMCallStartPayloadSchemaLMCallStartPayloadLMCallPayloadSchemaLMCallPayloadToolPhaseSchemaToolPhaseToolResultPreviewSchemaToolResultPreviewToolPayloadSchemaToolPayloadToolCallArgumentsDeltaPayloadSchemaToolCallArgumentsDeltaPayloadCellPhaseSchemaCellPhaseCellPayloadSchemaCellPayloadSubagentPhaseSchemaSubagentPhaseSubagentPayloadSchemaSubagentPayloadAgentPhaseSchemaAgentPhaseAgentPayloadSchemaAgentPayloadApprovalPhaseSchemaApprovalPhaseApprovalSourceSchemaApprovalSourceApprovalDecisionSchemaApprovalDecisionApprovalPayloadSchemaApprovalPayloadMemoryPayloadSchemaMemoryPayloadGuardrailPayloadSchemaGuardrailPayloadBackgroundTaskPayloadSchemaBackgroundTaskPayloadStepPhaseSchemaStepPhaseStepPayloadSchemaStepPayloadRetryPayloadSchemaRetryPayloadFinalPayloadSchemaFinalPayloadErrorPayloadSchemaErrorPayloadContentPartKindSchemaContentPartKindTokenEventSchemaTokenEventLMCallStartEventSchemaLMCallStartEventLMCallEventSchemaLMCallEventToolEventSchemaToolEventToolCallArgumentsDeltaEventSchemaToolCallArgumentsDeltaEventCellEventSchemaCellEventSubagentEventSchemaSubagentEventAgentEventSchemaAgentEventVariantApprovalEventSchemaApprovalEventMemoryEventSchemaMemoryEventGuardrailEventSchemaGuardrailEventBackgroundTaskEventSchemaBackgroundTaskEventStepEventSchemaStepEventRetryEventSchemaRetryEventFinalEventSchemaFinalEventErrorEventSchemaErrorEventStreamGapPayloadSchemaStreamGapPayloadStreamGapEventSchemaStreamGapEventPlanEntryPrioritySchemaPlanEntryPriorityPlanEntryStatusSchemaPlanEntryStatusPlanEntrySchemaPlanEntryPlanPayloadSchemaPlanPayloadPlanEventSchemaPlanEventTraceEventSchemaTraceEventTracePayloadTracePayloadForTraceEventForAgentEventAgentResultSchemaAgentResultAgentAgentSpecnormalizeAgentnormalizeAgentSpecresolveInstructionsmakeCheckpointMakeTraceEventOptionsmakeTraceEventPendingSubActionSchemaPendingSubActionPendingApprovalSchemaPendingApprovalApprovalResponseSchemaApprovalResponseBaseExceptionNeedsApprovalErrorSerializedSessionSchemaSerializedSessionRunCheckpointSchemaRunCheckpointBackgroundStatusSchemaBackgroundStatusBackpressurePolicySchemaBackpressurePolicyTaskHookBackgroundConfigSchemaBackgroundConfigAgentBackgroundConfigSchemaAgentBackgroundConfigBackgroundTasksConfigSchemaBackgroundTasksConfigBackgroundTaskRecordSchemaBackgroundTaskRecordJsonValueSchemaJsonValueJsonDictJsonDictSchemaUnknownRecordSchemanowIsoparseJsonDicttoJsonValuetoJsonDictSafeJsonValueResultsafeToJsonValueCellSchemaCellScratchpadVariableSchemaScratchpadVariableScratchpadStateSchemaScratchpadStateSandboxRunResultSchemaSandboxRunResultSandboxExecutionEnvironmentCacheControlEphemeralSchemaCacheControlEphemeralCacheControlSchemaCacheControlImageBase64SourceSchemaImageBase64SourceImageUrlSourceSchemaImageUrlSourceImageSourceSchemaImageSourceFileSourceSchemaFileSourceTextPartSchemaTextPartImagePartSchemaImagePartFilePartSchemaFilePartContentPartSchemaContentPartMessageContentSchemaMessageContentmessageToTextToolDefSchemaToolDefToolCallSchemaToolCallMessageSchemaMessageTokenUsageSchemaTokenUsageaddUsageNamedToolChoiceSchemaNamedToolChoiceToolChoiceSchemaToolChoiceFinishReasonSchemaFinishReasonReasoningEffortSchemaReasoningEffortReasoningConfigSchemaReasoningConfigInferenceRequestSchemaInferenceRequesteffortToAnthropicBudgetTokensInferenceResponseSchemaInferenceResponseStreamChunkKindSchemaStreamChunkKindToolCallPartialSchemaToolCallPartialStreamChunkSchemaStreamChunkModelCallOptionsModelasToolDefModelPricingSchemaModelPricingModelSpecSchemaModelSpecModelCatalogUnsupportedErrorSupportsModelCatalogsupportsModelCatalogMemoryRecordSchemaMemoryRecordMemoryQuerySchemaMemoryQueryMemoryScopeSchemaMemoryScopeMemoryMemorySequencerObservationStatusSchemaObservationStatusObservationRecordSchemaObservationRecordReflectionRecordSchemaReflectionRecordObservationStateSchemaObservationStateTokenEstimatorObservationalMemoryConfigSchemaObservationalMemoryConfigWorkingMemoryConfigSchemaWorkingMemoryConfigMemoryRelevanceFilterConfigSchemaMemoryRelevanceFilterConfigMemoryAccessModeSchemaMemoryAccessModeRuntimeMemoryAccessSchemaRuntimeMemoryAccessRuntimeMemoryAccessInputcoerceRuntimeMemoryAccessGuardrailActionSchemaGuardrailActionGuardrailAllowDecisionGuardrailRewriteDecisionGuardrailBlockDecisionGuardrailRequireApprovalDecisionGuardrailDecisionSchemaGuardrailDecisionallowblockrewriterequireApprovalLMCallContextSchemaLMCallContextToolCallContextSchemaToolCallContextLMMiddlewareToolMiddlewareLMGuardrailToolGuardrailGuardrailBlockedArgConstraintOpSchemaArgConstraintOpArgConstraintQuantifierSchemaArgConstraintQuantifierArgConstraintSchemaArgConstraintPermissionScopeSchemaPermissionScopePermissionEffectSchemaPermissionEffectPermissionSchemaPermissionPendingActionSchemaPendingActionDecisionSchemaDecisionPermissionPolicyReplConfigSchemaReplConfigReplConfigInputToolSchemaSchemaToolSchemaRuntimeToolCallSchemaRuntimeToolCallToolResultCauseSchemaToolResultCauseToolResultSchemaToolResultToolToolset