Core
Core calls providers and handles their failures. Use it under your own loop or with Agents. This site documents 0.36.7.
isTransient("overload"); // trueImport and run this function. It reports whether a kind of failure can pass with time, not whether a particular request is safe to replay.
Make a provider call
Section titled “Make a provider call”The quickstart installs Core and streams a first answer. The main entry
uses fetch, with no runtime dependencies or vendor SDKs. It runs in Node 22+, Bun, Deno,
Cloudflare Workers and Chrome MV3 service workers.
Keep secret keys on a trusted server unless the person supplies their own key in a local app.
Find the part you need
Section titled “Find the part you need”| Job | Guide |
|---|---|
| Switch providers without rewriting your loop | Providers and registry |
| Diagnose a failure | Errors and the classifier demo |
| Retry without repeating a partial answer | Retries |
| Stop stalled calls and cap concurrency | Streaming and limits |
| Run your tools or provider-hosted tools | Tools |
| Fit a long conversation into a model’s window | Context |
| Restore messages after an interruption | Provider history |
| Measure usage | Usage and cost |
| Make or transcribe audio | Speech and transcription |
Optional entries
Section titled “Optional entries”Import only the capability you use. The Core reference lists the import paths,
including /hosted for provider-run tools and /otel for opt-in OpenTelemetry tracing.
Core does not own your prompts, permissions, agent loop or stored conversations.
Continue with examples or package boundaries.