Recipes¶
Grouped by the problem you're trying to solve, not by the primitive you're trying to use. Each recipe is a self-contained page: the question, one runnable script, an explanation, gotchas.
If you want a linear walkthrough, use the Tutorial; if you want the mental model of a primitive, use the Concepts; if you're about to write code and want the tightest possible menu, use the Cheatsheet. This page is what you reach for after you've hit one specific wall.
I need to control cost¶
Hard ceiling on a single run and a rolling window per tenant.
Budget, Quota, MeterExceeded, meter() middleware.
Cap spend with Budget and Quota :octicons-arrow-right-24:
I need to pause for a human¶
Any tool that mutates the world — publishing, spending, sending — should not run without a human saying yes. Real pause, snapshot, resume from a fresh process.
Human-in-the-loop tool approval :octicons-arrow-right-24:
I need to survive a crash¶
The worker died mid-flight. A fresh worker picks up where the last
one left off — same run_id, same CheckpointPort, hydrated
transcript.
Resume from a checkpoint after a crash :octicons-arrow-right-24:
I need parallel agents that fail-fast together¶
Fan out N children under a shared budget + cancel. One failure
cancels the siblings; best_effort=True isolates failures instead.
Parallel agents with cooperative cancellation :octicons-arrow-right-24:
I need to plug in a custom concern¶
Redact a secret before it goes on the wire. Time every call. Cache
on a custom key. Two shapes: BaseMiddleware for
transform/guard/observe; raw (call, next) for
resilience/caching/instrumentation.
Write a custom middleware :octicons-arrow-right-24:
I need OpenTelemetry¶
Real traces and metrics in Tempo / Jaeger / Datadog / Honeycomb —
any OTLP backend. TracePort + MetricsPort, one adapter each in
arc-agentkit[observability].
Wire OpenTelemetry :octicons-arrow-right-24:
I need to use my local Claude Code (no API key)¶
ClaudeCliCognition subprocesses your locally-installed claude
CLI per run. Auth is the CLI's problem; you get its full tool surface
and permission modes.
Plug the claude CLI into FastAPI code-gen :octicons-arrow-right-24:
I need to consume any MCP server¶
MCPClient(StdioServer(...)) plus three adapters that surface an
MCP server's tools, resources, and prompts through agentkit's
canonical Tool, MemorySource, and Prompt Protocols.