| Requirement | Version |
|---|---|
Agent Assembly Node.js SDK (@agent-assembly/sdk) |
0.0.1-rc.6 |
Install:
pnpm add @agent-assembly/sdk@0.0.1-rc.6
# or
npm install @agent-assembly/sdk@0.0.1-rc.6
# or
yarn add @agent-assembly/sdk@0.0.1-rc.6A LangChain.js-style agent example showing how to integrate the Agent Assembly Node.js SDK for tool governance.
- Wrapping tools with
withAssembly()+ a customGatewayClientthat enforces a local policy - Governing every tool call through a local policy before execution
- One allowed tool call (
get_weather) — executes and logs output - One denied tool call (
delete_file) — blocked at the policy layer - A denied tool throws
PolicyViolationError; runs fully offline (no gateway, no@langchain/core)
- Node.js >= 20 LTS
- pnpm (
npm install -g pnpm)
pnpm installpnpm start=== LangChain.js-style Agent Assembly Example ===
Running allowed tool: get_weather
[ALLOW] Weather in Taipei: 22°C, partly cloudy. [mock]
Running denied tool: delete_file
[BLOCKED] Tool 'delete_file' blocked: Destructive filesystem operations require human approval.
Done. Tool calls governed by withAssembly + the local policy.
pnpm testTests run in offline mode — no gateway or API keys required.
pnpm typecheckThis example runs fully offline. Tool calls are governed in-process by a
local fail-closed policy stub (createPolicyGatewayClient in src/policy.ts) —
no gateway, no API key, and no network are involved. The example reads no
environment variables: AAASM_GATEWAY_URL, OPENAI_API_KEY, and friends have
no effect here, so there is no "real-provider" mode to switch into. Wiring these
examples to a real gateway/LLM via the SDK's initAssembly is a possible future
enhancement, tracked separately — not current behavior.
| Problem | Solution |
|---|---|
Cannot find module '@agent-assembly/sdk' |
Run pnpm install |
| TypeScript errors | Run pnpm typecheck and check Node.js version |