| 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 typecheckCopy .env.example to .env and fill in your values:
cp .env.example .env
# Edit .env: set AAASM_GATEWAY_URL and optionally OPENAI_API_KEYThen pnpm start will connect to the real gateway and real OpenAI API if configured.
| Problem | Solution |
|---|---|
Cannot find module '@agent-assembly/sdk' |
Run pnpm install |
| Gateway connection refused | Omit AAASM_GATEWAY_URL to use offline mode |
| TypeScript errors | Run pnpm typecheck and check Node.js version |