Claude Agent SDK — harness with subagents, hooks, session store
orchestrator spawns three subagents; each runs in its own context
orchestrator
session: session_main
context bounded — only results return
tool calls: list_dir(/project)
spawn 3 subs; wait for results
aggregate; emit final response
session persists through SessionStore
subagent 1
session: session_main.sub01
read_file(a.py) result
subagent 2
session: session_main.sub02
read_file(b.py) result
subagent 3
session: session_main.sub03
read_file(c.py) result
aggregator
merge 3 results
orchestrator context +=
lifecycle hooks
SessionStart, SessionEnd
PreToolUse, PostToolUse
UserPromptSubmit
PreCompact, Stop, Notification
cross-cutting behavior:
rate-limits, audits, logging, evals, rule enforcement
session store
append(session_id, message)
load(session_id) list of turns
list_sessions()
delete(session_id) cascades to subagent sessions
list_subkeys(parent) + --session-mirror
full TypeScript parity in the Python SDK
W3C trace context propagates into CLI subprocess; entire multi-process run is one trace.