Docs

Webhooks

Get notified on your server when something happens in AxAgent.

Webhooks send events to your server, so you do not need to keep a connection open while a run works. Use them for long tasks and for runs started from chat apps.

Coming Q4 2026

The SDK ships with AxAgent. The API below may change before launch.

Handle a webhook

Pass the raw request body and headers to axerity.webhooks.unwrap(). It verifies the webhook and returns a typed event.

webhook.ts
import Axerity from '@axerity/sdk'

const axerity = new Axerity()

export async function POST(request: Request) {
  const event = await axerity.webhooks.unwrap(
    await request.text(),
    request.headers,
  )

  if (event.type === 'run.completed') {
    await notify(event.data.agent, event.data.text)
  }

  return new Response(null, { status: 204 })
}

Pass the raw body as text. Parsing it as JSON first changes the bytes and verification fails.

Events

EventWhen it is sentData
run.completedA run is finishedevent.data.agent, event.data.text

On this page