Skip to main content
Version: pre-release (0.0.1-beta.4)

Examples

This section walks through the runnable Node examples that ship in the central agent-assembly-examples repository, under its node/ directory. Each example is a self-contained TypeScript project with its own README; the pages here explain what each one demonstrates, how the governance flow works, and walk through the real source.

The shared governance pattern

Every Node example uses the same wrapping pattern documented in the Guides: you wrap your tools with withAssembly() so each tool call is policy-checked before it runs. A denied call never executes its tool body — withAssembly throws a PolicyViolationError whose message carries the tool name and the policy's reason.

To keep the examples deterministic and runnable offline in CI, each one supplies a small in-process GatewayClient (mode: "sdk-only") that enforces a local allow/deny policy without a running gateway. The examples differ only in which framework (or none) defines the tools that withAssembly governs.

Before running any example, see Preparing the runtime environment for the shared prerequisites, install/run commands, and mock vs. real-provider mode.

Node examples

ExampleFrameworkPageSource
custom-tool-policy— (none)Custom tool policydir
openai-node-tool-policyOpenAI Node SDKOpenAI Node tool policydir
langchain-js-basic-agentLangChain.jsLangChain.js basic agentdir
vercel-aiVercel AI SDKVercel AI SDKdir
langgraph-jsLangGraph.jsLangGraph.jsdir
mastraMastraMastradir

For the exact run steps, follow the per-example pages above or the README inside each example directory.

Cross-cutting scenarios

Beyond the per-framework examples, the scenarios/ directory contains cross-cutting demos that exercise governance end to end.