Extensions#
Build extensions, choose hooks, and manage request-scoped state.
Read the walkthrough before consulting individual signatures.
Interface |
Purpose |
|---|---|
Inject AGENTS.md files discovered from the working directory. |
|
CUSTOM AgentEvent requesting user input from a streaming client. |
|
Register ask_user and suspend its execution until accept() receives a reply. |
|
Validated question rendered by a UI for one ask_user tool call. |
|
Accepted external response returned to the model as a tool result. |
|
Run subagents in the background and let the model manage them with tools. |
|
One background task owned by an |
|
Model-facing snapshot of one background task. |
|
Lifecycle of one background subagent task. |
|
Hooks for internal notifications and external input. |
|
Combine all optional hooks for the model-tool request lifecycle. |
|
Hooks immediately before and after each primary model invocation. |
|
Hooks around one complete request and its terminal outcome. |
|
Hooks that prepare request-scoped tools and conversation context. |
|
Hooks immediately before and after each requested tool invocation. |
|
Hooks around one model/tool turn inside a request. |
|
Wrap provider requests and local tool handlers for one extension. |
|
Register the |
|
Register writable filesystem tools followed by shell execution. |
|
Summarize older dialogue before a model step when context exceeds a limit. |
|
Provider-neutral envelope whose payload protocol belongs to its receiver. |
|
Base class for extensions that suspend until an external response arrives. |
|
Register |
|
Register |
|
Register filesystem tools with an optional read-only boundary. |
|
Register |
|
Register |
|
Register |
|
Register |
|
Register |
|
Register |
|
Structured decision reported by the private evaluator Agent. |
|
Continue externally selected Goal Mode requests until verification passes. |
|
Build the standard goal evaluator with complete coding workspace access. |
|
Receive internal instructions from publish() or external event delivery. |
|
Append each complete Agent turn as one line in a session JSONL file. |
|
Small client surface consumed by McpExtension. |
|
Validated MCP servers loaded from a JSON configuration document. |
|
Discover and register namespaced tools from configured MCP servers. |
|
Configure one MCP server reached through Streamable HTTP. |
|
Configure one local MCP server launched as a child process. |
|
Retain replayable conversation messages for reuse by later requests. |
|
Exact tool metadata supplied to one provider request. |
|
Persist exact tool definitions through the assistant response attributes. |
|
JSON-safe provider-hosted tool definition persisted beside one response. |
|
JSON-safe local tool definition persisted beside one model response. |
|
Return the exact local and provider tool definitions sent to the model. |
|
CUSTOM event asking a streaming UI to confirm model-proposed Plan Mode. |
|
Validated rationale displayed before the user approves Plan Mode. |
|
Strict external response correlated with one pending Tool Call. |
|
Decision returned to the model after external confirmation. |
|
CUSTOM event asking a streaming UI to approve the submitted plan. |
|
Validated final plan displayed before the user approves exiting. |
|
Strict external response correlated with one pending exit Tool Call. |
|
Decision returned to the model after external exit confirmation. |
|
CUSTOM event notifying a streaming UI that Plan Mode is now active. |
|
CUSTOM event notifying a streaming UI that normal mode is restored. |
|
Require user approval for model-proposed entry and exit transitions. |
|
Declare one versioned tool executed by Anthropic. |
|
Register one or more provider-hosted tools for every request. |
|
Declare one DeepSeek Responses API hosted tool. |
|
Declare one server-executed Gemini tool. |
|
Declare one OpenAI Responses API hosted tool. |
|
Declare one tool hosted by an OpenRouter-compatible endpoint. |
|
Intercept bash and pause until a trusted external decision arrives. |
|
Persisted approval policy for one Agent session. |
|
CUSTOM event asking a UI to approve or abort one shell command. |
|
External decision for one pending shell command. |
|
Persistence boundary for session policy and remembered commands. |
|
Raised into normal tool failure handling when the user aborts a command. |
|
Validated metadata for one discovered SKILL.md file. |
|
Advertise valid local skills and register a tool that reads one in full. |
|
Validate and parse one Agent Skills-compatible SKILL.md file. |
|
Agent-owned urgent user inbox, checked after each model and tool call. |
|
What later requests do with an assistant message that was refused. |
|
Decide whether the model reads its own refused answers on later turns. |
|
Configure one isolated agent exposed through the task tool. |
|
Register a task tool that runs one configured subagent in a child session. |
|
Final report and durable child-session identity returned to the parent. |
|
Return built-in profiles with their complete extension configuration. |
|
Return a subagent’s report, with a leading notice when it did not finish. |
|
One ordered task in the request-scoped list submitted through todo_write. |
|
Allowed lifecycle states for one ordered todo item. |
|
Register todo_write and enforce strictly sequential task progress. |
|
Validated list state returned to the model after each update. |
|
Register exactly one tool for every request. |
|
Where a tool’s snippet and guidelines are shown to the model. |
|
Show registered tool snippets and guidelines to the model. |
|
Rank a set of tools with BM25 over their names and descriptions. |
|
Where the list of searchable tools is shown to the model. |
|
Search registered local tools with BM25 through the Responses or Anthropic API. |
|
Async key/value boundary used to remember one session’s sent definitions. |
|
Render the deferred tools a model can search for, one entry per tool. |
|
Aggregated model usage for one UTC calendar day. |
|
One completed model request recorded for activity visualization. |
|
Persistence boundary consumed by |
|
Record every completed model request through an injected storage adapter. |