From "I understand bundles" to
"I've built a production app with Amplifier"
You understand YAML frontmatter, tools, hooks, and the prepare/session lifecycle. The concepts make sense.
How does FastAPI talk to Amplifier? Where do WebSocket events go? What about Slack threads? Voice streams?
Direct API calls. Hand-rolled tool loops. Duplicated conversation state. All the benefits of Amplifier — lost.
This guide gives you the one architectural principle and five session patterns that make every integration clean.
Your app and Amplifier meet at a clean boundary — a thin bridge where app events become Amplifier operations and Amplifier events become app outputs. Neither side knows the other's internals.
Amplifier → App
Called when a tool or hook requests human confirmation. Your app decides how to present the approval — modal dialog, Slack button, CLI prompt — and returns the decision.
Amplifier → App
Called when an agent wants to show something to the user. Your app decides the rendering medium — WebSocket message, Slack block, terminal output.
Amplifier → App
A hook that receives all session events — content deltas, tool status, thinking, errors — and forwards them over your transport: WebSocket, SSE, Slack.
Amplifier → App
Called when any component needs a new session — agent delegation, sub-tasks, recipe steps, parallel analysis. The universal “create a new session” entry point.
Mock either side independently. Test Amplifier without your web framework. Test your web framework without Amplifier.
Same Amplifier session behind web, voice, CLI, or Slack. The boundary adapts; the intelligence stays the same.
Know which side to debug when something breaks. App-side or Amplifier-side — never both tangled together.
Swap your web framework without touching Amplifier. Swap your orchestrator without touching your web framework.
Every Amplifier application follows these 7 steps, regardless of app type.
| Step | Required | When |
|---|---|---|
| Load | Yes | File, name, or git URI |
| Compose | No | Runtime overlays needed |
| Prepare | Yes | Once at startup |
| Create | Yes | Per-request or per-user |
| Mount | No | Runtime-dependent tools |
| Hook | No | App-specific events |
| Execute | Yes | Runs the agent loop |
Sessions are ephemeral.
Expensive — downloads modules, resolves dependencies, activates everything
Do once at startupCheap — produces an AmplifierSession from the cached PreparedBundle
Do per-requestEverything in bundle.md YAML. Good for stable configs that rarely change at runtime.
Build bundles in Python at startup. Good for dynamic config based on environment or user.
Load stable base from file, compose runtime overlays in code. Versioned YAML + dynamic injection.
Declared in YAML frontmatter. Resolved during prepare(), mounted automatically. For tools fundamental to the bundle's identity.
Mounted via coordinator.mount() after the session exists. For tools that depend on runtime state.
Declared in YAML. Live for the session lifetime. Cross-cutting concerns that should always be active.
Registered before execution, unregistered in finally. App-specific event handling per interaction.
Implement a hook that receives ALL session events and forwards them over your transport — this makes the agent's work visible in real-time.
Each request is independent. Create → execute → discard. REST APIs, webhooks, document processing.
SecondsMultiple messages form a conversation. Session map keyed by channel ID. Chat bots, messaging.
Minutes–HoursOne user, one agent, continuous context. The session IS the app. Personal AI assistants.
Days–WeeksVoice model handles audio I/O. Amplifier handles tools and reasoning. They meet at the tool boundary.
Session DurationMultiple bundles, multiple sessions, routing logic. Multi-tenant, A/B testing, ensemble agents.
Varies| Application Type | Pattern | Lifespan | Key Concern |
|---|---|---|---|
| REST API / webhook | A: Per-Request | Seconds | PreparedBundle singleton |
| Chat bot / messaging | B: Per-Conversation | Min–Hours | Session map + per-session locks |
| Personal AI assistant | C: Singleton | Days–Weeks | Persistence + compound intelligence |
| Voice assistant + tools | D: Voice Bridge | Session | Tool boundary, not orchestrator replacement |
| Multi-persona / tenant | E: Multi-Session | Varies | Routing + resource management |
| Voice + web + proactive | C + D | Process lifetime | Singleton provides tools to voice bridge |
The voice model is NOT inside AmplifierSession. It has its own connection, its own session state. Amplifier is a tool backend, not the orchestrator of the voice conversation. Audio never touches Amplifier — only text (tool calls, results) crosses the boundary.
Pass the same session_id across restarts. The context module recognizes the ID and reconnects. Lightest touch — works out of the box.
Reach into the context module to save and restore conversation history. Full control over serialization and storage.
The context module handles persistence transparently. Declare in YAML, storage is automatic.
Session ID reuse also enables hot reconfiguration — tear down and recreate with the same ID but different providers, tools, hooks, or orchestrator. Context persists; configuration evolves.
Calling anthropic.messages.create() directly, parsing tool calls manually. You've reimplemented the orchestrator — without hooks, streaming, or error recovery.
A valid bundle.md exists but the app never calls load_bundle(). Code constructs everything independently. The bundle drifts from reality.
A while True loop that calls the provider, checks for tool calls, executes them. This is the orchestrator's job — it handles streaming, hooks, error recovery.
A FastAPI handler directly accesses coordinator.mount_points, manages conversation state. App and Amplifier layers become entangled.
Calling prepare() per request. It downloads modules every time. Fix: prepare once at startup, create sessions cheaply.
A multi-user chat bot with one shared session. User A's context bleeds into User B's conversation. Fix: Pattern B — one session per conversation.
Data as of: February 26, 2026
Feature status: Active
Source document: amplifier-foundation/docs/APPLICATION_INTEGRATION_GUIDE.md
Content derived from:
Referenced modules (all reference implementations):
context-simple, context-persistent, loop-streaming, loop-interactive, hooks-logging, hooks-redactionNote: All modules referenced in this deck are reference implementations. The Amplifier ecosystem encourages developers to study them for understanding, then build custom implementations tailored to their specific needs.
One boundary. Four protocols. Five patterns.
Pick the one that fits your app and go.
APPLICATION_INTEGRATION_GUIDE.md in amplifier-foundation/docs
Examples 07, 08, 14, 18 show real integration patterns
load_bundle → prepare → create_session → execute