@ax-llm/ax 21.0.8 → 21.0.10
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/index.cjs +224 -224
- package/index.cjs.map +1 -1
- package/index.d.cts +65 -5
- package/index.d.ts +65 -5
- package/index.global.js +225 -225
- package/index.global.js.map +1 -1
- package/index.js +209 -209
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/ax-agent-memory-skills.md +10 -4
- package/skills/ax-agent-observability.md +16 -1
- package/skills/ax-agent-optimize.md +1 -1
- package/skills/ax-agent-rlm.md +1 -1
- package/skills/ax-agent.md +1 -1
- package/skills/ax-ai.md +41 -1
- package/skills/ax-audio.md +1 -1
- package/skills/ax-flow.md +20 -1
- package/skills/ax-gen.md +46 -1
- package/skills/ax-gepa.md +1 -1
- package/skills/ax-learn.md +1 -1
- package/skills/ax-llm.md +19 -2
- package/skills/ax-signature.md +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-agent-memory-skills
|
|
3
3
|
description: This skill helps an LLM generate correct AxAgent memory retrieval and dynamic skill-loading code using @ax-llm/ax. Use when the user asks about onMemoriesSearch, recall(...), inputs.memories, onLoadedMemories, onUsedMemories, onSkillsSearch, discover({ skills }), onLoadedSkills, onUsedSkills, preloaded skills, loaded memory/skill IDs, or carrying memories across forward() calls.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Memory And Skills Rules (@ax-llm/ax)
|
|
@@ -138,7 +138,12 @@ import type { AxAgentSkillsSearchFn } from '@ax-llm/ax';
|
|
|
138
138
|
// Each result is { id?: string; name: string; content: string }.
|
|
139
139
|
// If id is omitted, Ax falls back to name.
|
|
140
140
|
const onSkillsSearch: AxAgentSkillsSearchFn = async (searches) => {
|
|
141
|
-
return mySkillStore.
|
|
141
|
+
return mySkillStore.resolveBatch(searches, {
|
|
142
|
+
// Recommended backend order: exact id, exact name, then broader search.
|
|
143
|
+
// This lets the actor pass one simple string and keeps lookup policy host-side.
|
|
144
|
+
strategy: ['id', 'name', 'search'],
|
|
145
|
+
topK: 2,
|
|
146
|
+
});
|
|
142
147
|
};
|
|
143
148
|
|
|
144
149
|
const myAgent = agent('task:string -> answer:string', {
|
|
@@ -170,6 +175,7 @@ await discover({ skills: ['release-checklist', 'incident-response'] });
|
|
|
170
175
|
Rules:
|
|
171
176
|
|
|
172
177
|
- `discover({ skills })` invokes `onSkillsSearch` with the raw search strings and returns `void`.
|
|
178
|
+
- Resolve each raw string backend-side: prefer an exact `id` match, then an exact `name` match, then fuzzy/full-text search. The actor should not have to choose `id:` vs `name:` syntax.
|
|
173
179
|
- Matched skills land under "Loaded Skills" for the next turn.
|
|
174
180
|
- Entries are deduped by `id` (last-write-wins) and sorted by `id` for prefix-cache stability.
|
|
175
181
|
- If a skill result omits `id`, its trimmed `name` is used as the id for backwards compatibility.
|
|
@@ -192,7 +198,7 @@ const releaseAgent = agent('task:string -> answer:string', {
|
|
|
192
198
|
contextFields: [],
|
|
193
199
|
skills: [
|
|
194
200
|
{
|
|
195
|
-
id: '
|
|
201
|
+
id: 'release-checklist',
|
|
196
202
|
name: 'release-checklist',
|
|
197
203
|
content: '...',
|
|
198
204
|
},
|
|
@@ -205,7 +211,7 @@ await releaseAgent.forward(
|
|
|
205
211
|
{
|
|
206
212
|
skills: [
|
|
207
213
|
{
|
|
208
|
-
id: '
|
|
214
|
+
id: 'incident-response',
|
|
209
215
|
name: 'incident-response',
|
|
210
216
|
content: '...',
|
|
211
217
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-agent-observability
|
|
3
3
|
description: This skill helps an LLM generate correct AxAgent observability code using @ax-llm/ax. Use when the user asks about actorTurnCallback, executorTurnCallback, onContextEvent, agentStatusCallback, onFunctionCall, reportSuccess, reportFailure, getChatLog(), getUsage(), resetUsage(), debug traces, progress updates, or telemetry for AxAgent runs.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Observability Rules (@ax-llm/ax)
|
|
@@ -21,6 +21,21 @@ Use this skill when an agent needs runtime visibility, progress reporting, traci
|
|
|
21
21
|
- Need Ax program traces -> use `getTraces()`.
|
|
22
22
|
- Do not add multiple hooks unless the user clearly needs each output stream.
|
|
23
23
|
|
|
24
|
+
## Global Runtime Defaults
|
|
25
|
+
|
|
26
|
+
OpenTelemetry and debug defaults come from the shared Ax runtime surface:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { axGlobals, axCreateDefaultColorLogger } from '@ax-llm/ax';
|
|
30
|
+
import { trace } from '@opentelemetry/api';
|
|
31
|
+
|
|
32
|
+
axGlobals.tracer = trace.getTracer('agent-app');
|
|
33
|
+
axGlobals.debug = true;
|
|
34
|
+
axGlobals.logger = axCreateDefaultColorLogger();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
These globals are live defaults for future AI, AxGen, AxFlow, and agent-internal model calls. Per-call or explicitly configured options still override `axGlobals`. Use AxAgent callbacks below when the caller needs structured agent-turn events rather than OpenTelemetry spans or debug logs.
|
|
38
|
+
|
|
24
39
|
## Actor Turn Callback
|
|
25
40
|
|
|
26
41
|
Use `actorTurnCallback` when the caller needs structured telemetry for each actor turn. `executorTurnCallback` is still accepted as a deprecated alias for older code.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-agent-optimize
|
|
3
3
|
description: This skill helps an LLM generate correct AxAgent tuning and evaluation code using @ax-llm/ax. Use when the user asks about agent.optimize(...), judgeOptions, eval datasets, optimization targets, saved optimizedProgram artifacts, or recursive optimization guidance.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Optimize Codegen Rules (@ax-llm/ax)
|
package/skills/ax-agent-rlm.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-agent-rlm
|
|
3
3
|
description: This skill helps an LLM generate correct AxAgent RLM/runtime code using @ax-llm/ax. Use when the user asks about RLM code execution, AxJSRuntime, contextFields, contextPolicy, liveRuntimeState, promptLevel, stage prompt controls, executorModelPolicy, maxRuntimeChars, agent.test(...), llmQuery(...), mode: 'advanced', recursionOptions, or long-running agent runtime behavior.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent RLM Runtime Rules (@ax-llm/ax)
|
package/skills/ax-agent.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-agent
|
|
3
3
|
description: This skill helps an LLM generate correct core AxAgent code using @ax-llm/ax. Use when the user asks about agent(), child agents, namespaced functions, discovery mode, clarification, bubbleErrors, host-side final/clarification protocol, or ordinary agent runtime behavior. For RLM/code-runtime work use ax-agent-rlm; for callbacks and telemetry use ax-agent-observability; for recall/memory/skill loading use ax-agent-memory-skills; for agent.optimize(...) use ax-agent-optimize.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Codegen Rules (@ax-llm/ax)
|
package/skills/ax-ai.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-ai
|
|
3
3
|
description: This skill helps an LLM generate correct AI provider setup and configuration code using @ax-llm/ax. Use when the user asks about ai(), providers, models, presets, embeddings, extended thinking, context caching, or mentions OpenAI/Anthropic/Google/Azure/Groq/DeepSeek/Mistral/Cohere/Together/Ollama/HuggingFace/Reka/OpenRouter with @ax-llm/ax.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AI Provider Codegen Rules (@ax-llm/ax)
|
|
@@ -86,6 +86,46 @@ console.log(res.results[0]?.content);
|
|
|
86
86
|
- `functionCallMode`: `'auto'` | `'native'` | `'prompt'`
|
|
87
87
|
- `debug`, `logger`, `tracer`, `rateLimiter`, `timeout`
|
|
88
88
|
|
|
89
|
+
## Global Runtime Defaults
|
|
90
|
+
|
|
91
|
+
Use `axGlobals` when the app wants one live default for AI requests, generator runs, flows, or metrics:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { ai, axGlobals, axCreateDefaultColorLogger } from '@ax-llm/ax';
|
|
95
|
+
import { trace } from '@opentelemetry/api';
|
|
96
|
+
|
|
97
|
+
axGlobals.tracer = trace.getTracer('my-app');
|
|
98
|
+
axGlobals.debug = true;
|
|
99
|
+
axGlobals.logger = axCreateDefaultColorLogger();
|
|
100
|
+
axGlobals.customLabels = { service: 'api' };
|
|
101
|
+
|
|
102
|
+
const llm = ai({ name: 'openai', apiKey: process.env.OPENAI_APIKEY! });
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Rules:
|
|
106
|
+
|
|
107
|
+
- `axGlobals.tracer`, `meter`, `logger`, `debug`, `abortSignal`, and `customLabels` are live runtime defaults; future calls read the current value even if the AI instance already exists.
|
|
108
|
+
- Precedence is: per-call options, then explicit AI/service options, then current `axGlobals`, then built-in defaults.
|
|
109
|
+
- `customLabels` merge from globals to service to call options; later sources override earlier keys.
|
|
110
|
+
- `abortSignal` values are merged, so either a global shutdown signal or a local request signal can cancel the request.
|
|
111
|
+
|
|
112
|
+
## DeepSeek Notes
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
import { ai, AxAIDeepSeekModel } from '@ax-llm/ax';
|
|
116
|
+
|
|
117
|
+
const deepseek = ai({
|
|
118
|
+
name: 'deepseek',
|
|
119
|
+
apiKey: process.env.DEEPSEEK_APIKEY!,
|
|
120
|
+
config: { model: AxAIDeepSeekModel.DeepSeekV4Pro },
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
DeepSeek V4 thinking models support tools, but reject the `tool_choice`
|
|
125
|
+
request parameter. Ax omits forced/auto tool choice for `deepseek-v4-pro`,
|
|
126
|
+
`deepseek-v4-flash`, and `deepseek-reasoner` while still sending tool
|
|
127
|
+
definitions.
|
|
128
|
+
|
|
89
129
|
## Extended Thinking
|
|
90
130
|
|
|
91
131
|
```typescript
|
package/skills/ax-audio.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-audio
|
|
3
3
|
description: This skill helps an LLM generate correct conversational audio I/O code with @ax-llm/ax. Use when the user asks about .chat() audio input, audio output, OpenAI gpt-audio or realtime models, Gemini Live native audio, Grok Voice Agent models, voices, formats, transcripts, or how audio fits with signatures and structured outputs.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Audio I/O Codegen Rules (@ax-llm/ax)
|
package/skills/ax-flow.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-flow
|
|
3
3
|
description: This skill helps an LLM generate correct AxFlow workflow code using @ax-llm/ax. Use when the user asks about flow(), AxFlow, workflow orchestration, parallel execution, DAG workflows, conditional routing, map/reduce patterns, or multi-node AI pipelines.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxFlow Codegen Rules (@ax-llm/ax)
|
|
@@ -343,6 +343,25 @@ const result = await wf.forward(llm, { userQuestion: 'hi' }, {
|
|
|
343
343
|
});
|
|
344
344
|
```
|
|
345
345
|
|
|
346
|
+
Flow tracing also respects live app-wide defaults:
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
import { axGlobals } from '@ax-llm/ax';
|
|
350
|
+
import { metrics } from '@opentelemetry/api';
|
|
351
|
+
|
|
352
|
+
axGlobals.tracer = tracer;
|
|
353
|
+
axGlobals.meter = metrics.getMeter('axflow');
|
|
354
|
+
|
|
355
|
+
const result = await wf.forward(llm, { userQuestion: 'hi' });
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Rules:
|
|
359
|
+
|
|
360
|
+
- `wf.forward(..., { tracer, meter })` overrides flow defaults and `axGlobals`.
|
|
361
|
+
- Constructor/factory flow defaults override `axGlobals`.
|
|
362
|
+
- If no local tracer or meter is provided, `AxFlow` reads current `axGlobals.tracer` and `axGlobals.meter`, creates a parent flow span, and propagates tracer/meter plus trace context to node forwards.
|
|
363
|
+
- `axGlobals.abortSignal` is merged with flow-level abort signals.
|
|
364
|
+
|
|
346
365
|
## Program IDs and Demos
|
|
347
366
|
|
|
348
367
|
```typescript
|
package/skills/ax-gen.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-gen
|
|
3
3
|
description: This skill helps an LLM generate correct AxGen code using @ax-llm/ax. Use when the user asks about ax(), AxGen, generators, forward(), streamingForward(), assertions, field processors, step hooks, self-tuning, or structured outputs.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxGen Codegen Rules (@ax-llm/ax)
|
|
@@ -114,6 +114,34 @@ const result = await gen.forward(llm, { input: '...' }, {
|
|
|
114
114
|
});
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
+
### Live Global Defaults
|
|
118
|
+
|
|
119
|
+
`AxGen` respects `axGlobals` for app-wide runtime defaults:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { axGlobals } from '@ax-llm/ax';
|
|
123
|
+
import { trace } from '@opentelemetry/api';
|
|
124
|
+
|
|
125
|
+
const responseCache = new Map<string, any>();
|
|
126
|
+
|
|
127
|
+
axGlobals.tracer = trace.getTracer('my-app');
|
|
128
|
+
axGlobals.debug = true;
|
|
129
|
+
axGlobals.cachingFunction = async (key, value?) => {
|
|
130
|
+
if (value !== undefined) {
|
|
131
|
+
responseCache.set(key, value);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
return responseCache.get(key);
|
|
135
|
+
};
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Rules:
|
|
139
|
+
|
|
140
|
+
- Tracing/logging precedence is: forward options, then generator options, then AI service options, then current `axGlobals`, then built-in defaults.
|
|
141
|
+
- `abortSignal` from `axGlobals` is merged with local forward signals.
|
|
142
|
+
- `customLabels` merge from globals to AI service to forward options.
|
|
143
|
+
- `cachingFunction` and `functionResultFormatter` also fall back to current `axGlobals` when local options do not provide them.
|
|
144
|
+
|
|
117
145
|
### `streamingForward()`
|
|
118
146
|
|
|
119
147
|
```typescript
|
|
@@ -264,6 +292,23 @@ Rules:
|
|
|
264
292
|
- `thinkingTokenBudget` can be `'low'`, `'medium'`, `'high'`, or a number.
|
|
265
293
|
- Set `showThoughts: true` to include the model's reasoning in `result.thought`.
|
|
266
294
|
|
|
295
|
+
## Structured Outputs
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
const sig = f()
|
|
299
|
+
.input('text', f.string())
|
|
300
|
+
.output('summary', f.string())
|
|
301
|
+
.output('metadata', f.json().optional())
|
|
302
|
+
.useStructured()
|
|
303
|
+
.build();
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Rules:
|
|
307
|
+
|
|
308
|
+
- `.useStructured()` asks providers with native support, including OpenAI, Anthropic, and Gemini, for schema-constrained JSON.
|
|
309
|
+
- Native structured-output schemas list every object property in `required`, set `additionalProperties: false` on objects, and express optional fields as nullable types.
|
|
310
|
+
- Flexible `json` fields and unshaped `object` fields are sent as JSON-encoded strings for native structured outputs, then parsed back into normal JavaScript values.
|
|
311
|
+
|
|
267
312
|
## Step Hooks
|
|
268
313
|
|
|
269
314
|
```typescript
|
package/skills/ax-gepa.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-gepa
|
|
3
3
|
description: This skill helps an LLM generate correct AxGEPA optimization code using @ax-llm/ax. Use when the user asks about AxGEPA, GEPA, Pareto optimization, multi-objective prompt tuning, reflective prompt evolution, validationExamples, maxMetricCalls, or optimizing a generator, flow, or agent tree.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxGEPA Codegen Rules (@ax-llm/ax)
|
package/skills/ax-learn.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-learn
|
|
3
3
|
description: This skill helps an LLM generate correct AxLearn code using @ax-llm/ax. Use when the user asks about self-improving agents, trace-backed learning, feedback-aware updates, or AxLearn modes.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxLearn Codegen Rules (@ax-llm/ax)
|
package/skills/ax-llm.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-llm
|
|
3
3
|
description: This skill helps with using the @ax-llm/ax TypeScript library for building LLM applications. Use when the user asks about ax(), ai(), f(), s(), agent(), flow(), AxGen, AxAgent, AxFlow, signatures, streaming, or mentions @ax-llm/ax.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Ax Library (@ax-llm/ax) Quick Reference
|
|
@@ -106,6 +106,19 @@ for await (const chunk of gen.streamingForward(llm, { question: 'Tell a story' }
|
|
|
106
106
|
| Stop function | `stopFunction` | `{ stopFunction: 'finalAnswer' }` |
|
|
107
107
|
| Function mode | `functionCallMode` | `{ functionCallMode: 'auto' }` |
|
|
108
108
|
|
|
109
|
+
Global runtime defaults can be set with `axGlobals` and are read live by future AI, AxGen, and AxFlow calls:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { axGlobals, axCreateDefaultColorLogger } from '@ax-llm/ax';
|
|
113
|
+
import { trace } from '@opentelemetry/api';
|
|
114
|
+
|
|
115
|
+
axGlobals.tracer = trace.getTracer('my-app');
|
|
116
|
+
axGlobals.debug = true;
|
|
117
|
+
axGlobals.logger = axCreateDefaultColorLogger();
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Precedence is: per-call options, then explicit instance/program options, then current `axGlobals`, then built-in defaults. `customLabels` merge in that order, and `abortSignal` values are combined so either global or local cancellation works.
|
|
121
|
+
|
|
109
122
|
## Memory and Context
|
|
110
123
|
|
|
111
124
|
```typescript
|
|
@@ -208,7 +221,7 @@ try {
|
|
|
208
221
|
## Debugging
|
|
209
222
|
|
|
210
223
|
```typescript
|
|
211
|
-
import { axCreateDefaultColorLogger } from '@ax-llm/ax';
|
|
224
|
+
import { axCreateDefaultColorLogger, axGlobals } from '@ax-llm/ax';
|
|
212
225
|
|
|
213
226
|
const result = await gen.forward(llm, { input: 'test' }, {
|
|
214
227
|
debug: true,
|
|
@@ -217,6 +230,10 @@ const result = await gen.forward(llm, { input: 'test' }, {
|
|
|
217
230
|
tracer: openTelemetryTracer,
|
|
218
231
|
meter: openTelemetryMeter,
|
|
219
232
|
});
|
|
233
|
+
|
|
234
|
+
// Or set live app-wide defaults for future calls:
|
|
235
|
+
axGlobals.tracer = openTelemetryTracer;
|
|
236
|
+
axGlobals.meter = openTelemetryMeter;
|
|
220
237
|
```
|
|
221
238
|
|
|
222
239
|
## MCP Integration
|
package/skills/ax-signature.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-signature
|
|
3
3
|
description: This skill helps an LLM generate correct DSPy signature code using @ax-llm/ax. Use when the user asks about signatures, s(), f(), field types, string syntax, fluent builder API, validation constraints, or type-safe inputs/outputs.
|
|
4
|
-
version: "21.0.
|
|
4
|
+
version: "21.0.10"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Ax Signature Reference
|