Fuze Agent

Fuze Agent is a TypeScript framework for building AI agents that produce EU AI Act and GDPR-grade runtime evidence. Compliance fields are type invariants on every tool, a tool that handles special-category data without an art9Basis field will not compile. Every model call, tool execution, and policy decision is recorded as a span in a hash-chained audit log whose head is the run-root.

The loop is non-bypassable: tools cannot call siblings directly, providers run with maxRetries: 0, and a policy engine error halts the run with fuze.policy.engine_error=true.

Install

bash
npm install @fuze-ai/agent zod

Run an agent

ts
import { z } from 'zod'
import {
  defineAgent,
  defineTool,
  inMemorySecrets,
  runAgent,
  StaticPolicyEngine,
  verifyChain,
  makeTenantId,
  makePrincipalId,
  Ok,
  type ThreatBoundary,
} from '@fuze-ai/agent'

const threatBoundary: ThreatBoundary = {
  trustedCallers: ['agent-loop'],
  observesSecrets: false,
  egressDomains: 'none',
  readsFilesystem: false,
  writesFilesystem: false,
}

const greet = defineTool.public({
  name: 'greet',
  description: 'returns a greeting for the given name',
  input: z.object({ name: z.string() }),
  output: z.object({ greeting: z.string() }),
  threatBoundary,
  retention: { id: 'demo.v1', hashTtlDays: 30, fullContentTtlDays: 7, decisionTtlDays: 90 },
  run: async (input) => Ok({ greeting: `hello, ${input.name}` }),
})

const agent = defineAgent({
  purpose: 'demo-greeter',
  lawfulBasis: 'consent',
  annexIIIDomain: 'none',
  producesArt22Decision: false,
  model: yourFuzeModel, // replace with a model from @fuze-ai/agent-providers
  tools: [greet],
  output: z.object({ final: z.string() }),
  maxSteps: 5,
  retryBudget: 0,
  deps: {},
})

const records: any[] = []
const policy = new StaticPolicyEngine([
  { id: 'allow.greet', toolName: 'greet', effect: 'allow' },
])

const result = await runAgent(
  { definition: agent, policy, evidenceSink: (r) => records.push(r) },
  {
    tenant: makeTenantId('demo-tenant'),
    principal: makePrincipalId('demo-user'),
    secrets: inMemorySecrets({}),
    userMessage: 'please greet world',
  },
)

console.log({
  status: result.status,
  hashChainHead: result.evidenceHashChainHead,
  hashChainValid: verifyChain(records),
})

A complete runnable version lives at examples/typescript/agent-hello-world/index.ts.

Next steps