@axlsdk/axl 0.18.2 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -2
- package/dist/index.cjs +1947 -522
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +815 -42
- package/dist/index.d.ts +815 -42
- package/dist/index.js +1916 -522
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -58,6 +58,17 @@ export const config = defineConfig({
|
|
|
58
58
|
|
|
59
59
|
Provider API keys are also read automatically from environment variables (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`/`GEMINI_API_KEY`), so for local development you can skip the `providers` block entirely.
|
|
60
60
|
|
|
61
|
+
**Beyond the big three**, Axl ships presets for any OpenAI-compatible endpoint — pick a model with `preset:model` and set the matching env var:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
agent({ model: 'openrouter:anthropic/claude-opus-4.7' }); // OPENROUTER_API_KEY — 300+ models, one key
|
|
65
|
+
agent({ model: 'groq:openai/gpt-oss-120b' }); // GROQ_API_KEY — fastest inference
|
|
66
|
+
agent({ model: 'deepseek:deepseek-reasoner' }); // DEEPSEEK_API_KEY
|
|
67
|
+
agent({ model: 'ollama:llama3' }); // local — no key, $0
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Presets: `openrouter`, `azure`, `xai`, `deepseek`, `mistral`, `groq`, `bedrock`, and self-hosted `ollama` / `vllm` / `lmstudio` / `llamacpp` / `sglang`. The unified `effort` knob and per-call cost tracking work across them. Build your own by cloning a `ProviderProfile`. See [docs/providers.md](../../docs/providers.md#openai-compatible-providers--presets).
|
|
71
|
+
|
|
61
72
|
Each provider also accepts an opt-in `rateLimit` (`{ maxConcurrent?, minIntervalMs?, acquireTimeoutMs? }`) for proactive client-side pacing on top of the automatic 429/503/529 backoff — useful when a large fan-out (e.g. an eval) shares one API key. It caps in-flight request concurrency (not token throughput) for that provider's chat calls. See [Providers → Rate limiting](../../docs/providers.md#rate-limiting-opt-in).
|
|
62
73
|
|
|
63
74
|
State store options: `'memory'` (default), `'sqlite'` (requires `better-sqlite3`), or a `RedisStore` instance for multi-process deployments. See [State Stores](#state-stores).
|
|
@@ -151,9 +162,14 @@ const calculator = tool({
|
|
|
151
162
|
// handler also accepts (input, ctx) for nested agent invocations — see below
|
|
152
163
|
retry: { attempts: 3, backoff: 'exponential' },
|
|
153
164
|
sensitive: false,
|
|
165
|
+
// Keep the complete handler result for the host while sending only this
|
|
166
|
+
// allowlisted projection back to the model:
|
|
167
|
+
toModelOutput: (result) => ({ answer: result.result }),
|
|
154
168
|
});
|
|
155
169
|
```
|
|
156
170
|
|
|
171
|
+
`toModelOutput` is an opt-in, synchronous mapper for successful agent-invoked local tools. Strings are sent verbatim; JSON-compatible values are strictly validated and serialized once. The full post-hook result stays on `tool_call_end.data.result` for host rendering (subject to `trace.redact`). `sensitive: true` and thrown handler/hook/mock failures skip projection, and projection errors fail closed with `ToolModelOutputError`—there is no raw fallback. Direct `tool.run()`/`_execute()`, MCP tools, and handoffs are unchanged. See the [API reference](../../docs/api-reference.md#model-facing-tool-output) for the exact type, validation, mock, and delivery contract.
|
|
172
|
+
|
|
157
173
|
Tool handlers receive a second parameter `ctx: WorkflowContext` (a child context), enabling the "agent-as-tool" composition pattern:
|
|
158
174
|
|
|
159
175
|
```typescript
|
|
@@ -738,12 +754,12 @@ import {
|
|
|
738
754
|
|
|
739
755
|
### Provider URIs
|
|
740
756
|
|
|
741
|
-
Four
|
|
757
|
+
Four native adapters using the `provider:model` URI scheme (plus the OpenAI-compatible presets above):
|
|
742
758
|
|
|
743
759
|
```
|
|
744
760
|
openai-responses:gpt-5.5 # OpenAI Responses API (preferred over Chat Completions)
|
|
745
761
|
openai:gpt-5.4 # OpenAI Chat Completions
|
|
746
|
-
anthropic:claude-opus-4-
|
|
762
|
+
anthropic:claude-opus-4-8 # Anthropic (supports effort: 'xhigh' and 'max')
|
|
747
763
|
google:gemini-3.1-pro-preview # Google Gemini
|
|
748
764
|
```
|
|
749
765
|
|