Skip to content

Examples

End-to-end, runnable examples that govern real AI agent frameworks with Agent Assembly. Each example is a self-contained project in the agent-assembly-examples repository, and each page below walks through what it demonstrates, how the init_assembly() adapter flow wires the framework, an annotated code walkthrough, and the expected output.

Everything here runs offline

Every example is designed to run with no API keys and no running gateway — it executes in sdk-only mode and simulates the gateway's policy enforcement locally. Connecting to a real gateway is an optional production-mode step documented on each page.

Start here

  1. Preparing the runtime environment — the shared prerequisites, install steps, and run commands that apply to every example. Read this first.
  2. Framework support — the adapter ↔ example status reference and the universal init_assembly() pattern.

The examples

Example Framework Governance focus
LangChain — basic agent LangChain Allow / deny / pending on tool calls via AssemblyCallbackHandler.
LangChain — research agent LangChain A balanced policy: network allowlist, daily budget, tool-call logging, and credential-leak blocking.
LangGraph — node-level governance LangGraph Node-level hooks on a compiled StateGraph; a denied tool halts the graph mid-execution.
CrewAI — multi-agent research crew CrewAI Multi-agent delegation tracking, file-write approval, and a shared budget across agents.
OpenAI Agents SDK OpenAI Agents SDK Approval-gated and denied tool calls, intercepting FunctionTool.__call__.
Pydantic AI Pydantic AI Tool-call governance driven offline by the built-in TestModel.
Google ADK Google ADK A scripted offline tool trajectory governing BaseTool.run_async — no cloud credentials.
LlamaIndex — manual tool policy LlamaIndex The manual wrapper pattern (GovernedToolRunner) for a framework with no native adapter.
Custom tool policy (no framework) Govern plain Python functions with the minimal governed() helper — no AI framework required.

How the examples fit together

  • No native adapter? Custom tool policy shows the minimal governed() building block; LlamaIndex — manual tool policy builds on it with GovernedToolRunner. Use these patterns for any framework Agent Assembly does not hook automatically.
  • Native adapter? The LangChain, LangGraph, CrewAI, OpenAI Agents, Pydantic AI, and Google ADK examples each rely on init_assembly() detecting the framework and installing its governance hooks for you — see Framework support for the full adapter list and priority order.