Skip to content

AgentContext

Context available during the agent onion hook.

Provides access to the agent definition and tool registration. This is the shallowest context — all deeper contexts inherit from it.

agent: object

Agent definition: name, model, instructions.

instructions: string

model: string

name: string


config: Record<string, unknown>

Middleware-specific configuration from the agent definition.

registerTool(tool): void

Register a tool on the agent. Call in the agent hook before next().

Tool

void