Skip to content

Custom Agent Integration

For any agent framework not listed, use the SDK directly or call the REST API.

TypeScript

import { AgentGovernance } from '@agentgovernance/sdk'

const client = new AgentGovernance({ apiKey: 'ag_...' })

const agent = await client.registerAgent({
  name: 'my-custom-agent',
  framework: 'custom',
})

// Your agent produces output
const output = await myAgent.run(task)

// Assess it
const result = await client.assess({ text: output, agentId: agent.id })

REST API

# Register
curl -X POST /api/v1/agents/register \
  -H "Authorization: Bearer ag_..." \
  -d '{"name": "my-agent", "framework": "custom"}'

# Assess
curl -X POST /api/v1/observe/assess \
  -H "Authorization: Bearer ag_..." \
  -d '{"text": "agent output here", "agentId": "uuid"}'

Governance as Middleware

Wrap your agent's execution in governance lifecycle calls:

async function governedExecution(task: string) {
  const run = await client.startRun(agent.id)

  // PLAN gate
  const plan = await myAgent.plan(task)
  await client.approveGate({ runId: run.id, actor: 'operator' })

  // BUILD gate
  const result = await myAgent.execute(plan)
  const assessment = await client.assess({ text: result, agentId: agent.id, runId: run.id })

  if (assessment.summary.highestSeverity === 'P1') {
    throw new Error('Critical pattern detected — halting')
  }

  await client.approveGate({ runId: run.id, actor: 'operator' })
  return result
}