Skip to main content

Jobs, streaming, and errors

AUVY execution is job-centric: neuron invokes and receptor fires return a job_id. Long work streams over SSE or is polled via jobs.getStatus.
Are you an AI agent? See SDK source of truth for exact method names.

Pattern matrix

PatternWhenSDKCLI
Fire-and-forgetYou manage stream or statusreceptors.fire(id, { stream: true })createStream(auvy, job_id)auvy receptors execute SLUG --async --output json
WaiterScripts that need full outputreceptors.invokeAndStream(...) or streamJobUntilCompleteauvy receptors execute SLUG --stream --output jsonl
Poll loopCustom UI or interventionsjobs.getStatus + jobs.provideInput when waitingauvy jobs get JOB_ID, auvy jobs input JOB_ID

Streaming helpers

When stream: true on invoke, tokens arrive at GET /v1/jobs/:jobId/stream. The SDK wraps SSE:
  • createStream(auvy, jobId) — async iterable
  • streamJobUntilComplete(auvy, jobId, callbacks) — runs until terminal state
  • subscribeJobStream(auvy, jobId, callbacks, { reconnect: true, resumeAfter }) — reconnect-safe
import { fromApiKey, createStream, isTokenChunk } from '@auvy-synapse/client'

const auvy = await fromApiKey()
const { receptor } = await auvy.receptors.get('workspace-slug', 'receptor-slug')
const { job_id } = await auvy.receptors.fire(receptor.id, { message: 'Hello', stream: true })

for await (const chunk of createStream(auvy, job_id)) {
  if (isTokenChunk(chunk) && chunk.token) process.stdout.write(chunk.token)
}
Pass signal: AbortController.signal to cancel. For share flows, use shareCredentialToStreamOptions — see Public API.

Pagination

List endpoints accept limit and offset. The SDK provides paginate() and listAll():
for await (const receptor of auvy.receptors.paginate({ pageSize: 20 })) {
  console.log(receptor.slug)
}

const all = await auvy.receptors.listAll({ target_type: 'neuron' })

Errors and retries

Both SDK packages throw typed errors with stable code fields. Treat the Retryable column as authoritative.
import { AUVYError, ERROR_CODES, withRetry } from '@auvy-synapse/client'

try {
  await auvy.receptors.get('missing-id')
} catch (e) {
  if (e instanceof AUVYError) {
    if (AUVYError.isRateLimitError(e)) { /* backoff */ }
    if (AUVYError.isRetryableError(e)) { /* retry */ }
  }
}

const receptors = await withRetry(() => auvy.receptors.list({ limit: 20 }), { maxRetries: 3 })
HTTPcodeRetryable
400VALIDATION_ERRORNo
401AUTH_REQUIREDNo
403FORBIDDEN, trial_expired, cost_capNo
404NOT_FOUND, RESOURCE_NOT_FOUNDNo
429RATE_LIMITYes
5xxINTERNAL_SERVER_ERRORYes
0NETWORK_ERRORYes
Connect client: ConnectError with CONNECT_ERROR_CODES — see Connect SDK.
Job statusMeaning
completedSuccess — read result
failedTerminal — fix input and re-invoke
waitingNeeds jobs.provideInput