Docs

Streaming

Get events from a run as they happen.

axerity.runs.create() waits for the run to finish. axerity.runs.stream() returns events as the agent works, so you can show progress to your users.

Coming Q4 2026

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

Stream a run

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

const axerity = new Axerity()

const stream = axerity.runs.stream({
  agent: agent.id,
  input: 'Fix the failing tests in acme/web',
})

for await (const event of stream) {
  switch (event.type) {
    case 'plan.created':
      console.log('plan', event.steps)
      break
    case 'tool.called':
      console.log('→', event.tool, event.input)
      break
    case 'tool.completed':
      console.log('←', event.tool, event.output)
      break
    case 'text.delta':
      process.stdout.write(event.delta)
      break
  }
}

const run = await stream.finalRun()

Events

EventWhen it is sentFields
plan.createdThe agent has planned the tasksteps
tool.calledThe agent calls a tooltool, input
tool.completedA tool call returnstool, output
text.deltaThe agent writes textdelta
subagent.startedA subagent startssubagent.id, subagent.input
subagent.completedA subagent completessubagent.id

Use event.type to tell events apart. TypeScript narrows the event type in each branch.

Get the final run

After the loop ends, stream.finalRun() returns the same run object that axerity.runs.create() returns.

const run = await stream.finalRun()

console.log(run.text)
console.log(run.usage)

On this page