Extension lifecycle
Extensions become graph arguments through discovery, compilation, and refresh between turns.
Compilation
prepare_runtime locates extensions, resolves plugin dependencies, and binds declaration origins. During Agent assembly, compile_extensions consumes selected plugins in dependency-first order:
- Read and concatenate
system_prompt_filecontent. - Compile plugin Skills, then standalone Home Skills.
- Load tools, naming them
<plugin-id>__<local-id>. - Collect plugin Hooks.
- Read subagent YAML.
Root Hooks are then compiled with plugin entries before standalone entries. Each subagent compiles its own Hooks, tool subset, and Skill subset.
The Python loader caches modules by file within one compilation. Entry points must remain inside their corresponding root directory.
The host discovers MCP tools first and supplies them as BaseTool objects. The compiler registers MCP and A2A tools before local plugin tools. Duplicate registered names fail assembly. See extension declarations for public declarations and names.
Fingerprints
extension_revision fingerprints configuration files, the selected environment file, enabled plugin directories, Home skills/, Home .mcp.yaml, and bound Agent/compiled-workflow Hook entries with SHA-256. It hashes paths, directory membership, and file metadata: nanosecond mtime, ctime, and size. Traversal skips directory-symlink cycles. Business inputs and generated session outputs do not participate.
Ignored directory names include __pycache__, .git, .venv, node_modules, .pytest_cache, and .ruff_cache.
Caching and consistency
REST caches by thread ID plus input binding. An unchanged fingerprint and an existing cache key reuse the Agent directly.
When the fingerprint changes and the invocation permits session creation:
- Call
refresh_extensions. - Rediscover tools if MCP mappings changed.
- Call
create_agentwith the newextension_revision. - If extensions change again during loading, discard the candidate and report an error.
- After success, clear the previous Agent cache and accept the new PreparedRuntime, MCP tools, and fingerprint. Add the new Agent to the cache; above 32 entries, evict the least recently used handle.
An active stream keeps its original graph. Failed refreshes do not replace PreparedRuntime.
Skill middleware keeps the revision in private state. Metadata is rescanned only after a revision change, avoiding a full Skill-body read on every turn.
SDK callers decide when to rebuild Agents. Custom hosts can use dataagent.host to compare fingerprints and prepare candidate runtimes, publishing only after tool discovery and graph assembly succeed. Plugin authors can follow the plugin guide when updating installed extensions.
Changes that still require restarting
refresh_extensions rereads plugins, root Hooks, MCP, and outbound A2A configuration. Model connections, limits, dataagent.entry, server, semantic, Home, and default input directories retain the original PreparedRuntime values. The host determines the inbound A2A Card and authentication at startup. Restart the host after changing those settings; SDK callers rerun prepare_runtime.