Skip to main content

Support agent example

A minimal support flow: resolve a receptor, fire with the user message, stream tokens to your UI.

TypeScript (SDK)

import { fromApiKey } from '@auvy-synapse/client'

const auvy = await fromApiKey()
const slug = 'support-bot'

const { receptor } = await auvy.receptors.get(auvy.workspaceSlug!, slug)

const { job_id } = await auvy.receptors.fire(receptor.id, {
  message: 'Customer asks about refund policy for order #1234',
})

for await (const event of auvy.jobs.stream(job_id)) {
  if (event.type === 'token') process.stdout.write(event.text ?? '')
}

With brain scope

Pass brain_id when the receptor is brain-scoped:
await auvy.receptors.fire(
  receptor.id,
  { message: 'Hello', brain_id: process.env.AUVY_BRAIN_ID },
)

CLI equivalent

auvy receptors execute support-bot \
  --message "Customer asks about refund policy" \
  --stream --output jsonl

Add retrieval

Combine invoke with workspace search — see Resources and search and SDK recipes.