| Requirement | Version |
|---|---|
Agent Assembly Node.js SDK (@agent-assembly/sdk) |
0.0.1-rc.3 |
Install:
pnpm add @agent-assembly/sdk@0.0.1-rc.3
# or
npm install @agent-assembly/sdk@0.0.1-rc.3
# or
yarn add @agent-assembly/sdk@0.0.1-rc.3A TypeScript example showing how to govern a LangGraph.js-style state machine with Agent Assembly.
- A minimal
StateGraph(typed state, named nodes, edges) that mirrors LangGraph.js - Governing the tool calls inside graph nodes with
withAssembly()+ a local-policyGatewayClient - One allowed tool call (
search_docs) in thesearchnode - One denied tool call (
execute_shell) in theescalatenode — blocked withPolicyViolationError - Runs fully offline — no provider key, no live LLM, and no
@langchain/core
The real @langchain/langgraph package transitively installs @langchain/core.
These non-LangChain examples deliberately avoid that dependency so they run offline
in CI with no API keys. src/graph.ts replays the LangGraph.js shape — a typed
state, addNode/addEdge/setEntryPoint/compile/invoke — so the example reads
like a LangGraph.js graph while staying dependency-free. The governance path is
identical to a real graph: each node calls a tool wrapped by withAssembly.
- Node.js >= 20 LTS
- pnpm (
npm install -g pnpm)
pnpm installpnpm start=== LangGraph.js-style Graph — Agent Assembly Governance Example ===
A two-node state machine whose tool calls are governed by withAssembly.
Node "search" — calling allowed tool: search_docs
[ALLOW] Top result for "How does Agent Assembly work?": Agent Assembly governs every tool call. [mock]
Node "escalate" — calling denied tool: execute_shell
[BLOCKED] Tool 'execute_shell' blocked: Arbitrary shell execution is never allowed from a graph node.
Graph finished with 2 logged steps.
Done. Graph-node tool calls governed by withAssembly + the local policy.
pnpm testNo gateway or API key required. All tests run offline.
pnpm typecheckThis example uses only mock/offline mode. No provider keys or gateway URL are needed.
To connect to a real gateway, set AAASM_GATEWAY_URL in your environment directly.
| Problem | Solution |
|---|---|
Cannot find module '@agent-assembly/sdk' |
Run pnpm install |
| TypeScript errors | Run pnpm typecheck and check the Node.js version |