Integration Patterns
Common patterns when integrating the AUVY API: streaming, pagination, and error handling. For setup, see Authentication.Streaming
Stream receptor execution in real time via Server-Sent Events. Invoke withstream: true, then consume the job stream.
Setup
Invoke with stream, then consume
Stream until complete (callbacks)
Event types
token– Individual tokenscontent_block– Structured content blocksreflex_call– When a reflex (tool) is calledsignal– System signalsstate_update– Trace state updateserror– Execution errorscomplete– Execution completed
Cancellation
Best practices
- Handle error events and use
AbortControllerfor user cancellation. - Abort streams on component unmount or when done.
- Invoke with
stream: true, then usereceptors.createStream(job_id)orstreamJobUntilComplete(job_id, callbacks).
Pagination
List endpoints supportlimit and offset. The SDK provides paginate() and listAll().
Async iterable (paginate())
Best for memory-efficient iteration.
Fetch all (listAll())
Best when you need the full set in memory (small to medium datasets).
Response shape
Error handling
UseAUVYError for typed handling, retries, and rate limits.
Catching and classifying errors
Error type helpers
Automatic retry
Rate limiting
On 429, useretryAfter or headers to back off:
Common issues
| Issue | What to do |
|---|---|
| Invalid or missing key (401) | Use a valid API key from Settings → API Keys; send as Authorization: Bearer KEY. |
| Wrong base URL | Default https://api.auvy.ai. Override with AUVY_API_URL or baseUrl (no trailing slash). |
| CORS in browser | Call API from backend or allow your origin. |
| 429 Rate limit | Back off; use SDK retry options. |
| Endpoint requires JWT | Some routes (e.g. integrations) need user session; see Authentication. |
Related
- Receptors API – List, get, invoke, share
- API Reference – Auth, pagination, and error format
- Integrate the API – First request and troubleshooting