| Requirement | Version |
|---|---|
Agent Assembly Node.js SDK (@agent-assembly/sdk) |
0.0.1-rc.4 |
Install:
pnpm add @agent-assembly/sdk@0.0.1-rc.4
# or
npm install @agent-assembly/sdk@0.0.1-rc.4
# or
yarn add @agent-assembly/sdk@0.0.1-rc.4A TypeScript example showing how to govern Mastra tools with Agent Assembly.
- Defining tools with Mastra's
createTool(the real@mastra/corepackage) - Wrapping those tools with
withAssembly()from@agent-assembly/sdk+ a local-policyGatewayClient - One allowed tool call (
get_stock_price) — executes and returns mock output - One denied tool call (
place_trade) — blocked at the policy layer withPolicyViolationError - Runs fully offline — no provider key, no live LLM, and no
@langchain/core
The published @agent-assembly/sdk release candidate exposes governance through the public
withAssembly(tools, { gatewayClient }) API. We define real Mastra tools with
createTool and govern their execute through withAssembly + a local policy
gateway client, so the governance path runs deterministically in CI with no
gateway and no live model.
- Node.js >= 20 LTS
- pnpm (
npm install -g pnpm)
pnpm installpnpm start=== Mastra — Agent Assembly Governance Example ===
Tools defined with Mastra's createTool, governed by withAssembly.
Running allowed tool: get_stock_price
[ALLOW] {"text":"AASM: $123.45 [mock]"}
Running denied tool: place_trade
[BLOCKED] Tool 'place_trade' blocked: Placing trades moves real money — requires human approval.
Done. Mastra 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; to
drive a real LLM with a Mastra Agent, set OPENAI_API_KEY.
| Problem | Solution |
|---|---|
Cannot find module '@agent-assembly/sdk' |
Run pnpm install |
Cannot find module '@mastra/core' |
Run pnpm install |
| TypeScript errors | Run pnpm typecheck and check the Node.js version |