@ax-llm/ax 21.0.9 → 21.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ax-llm/ax",
3
- "version": "21.0.9",
3
+ "version": "21.0.11",
4
4
  "type": "module",
5
5
  "description": "The best library to work with LLMs",
6
6
  "repository": {
@@ -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.9"
4
+ version: "21.0.11"
5
5
  ---
6
6
 
7
7
  # AxAgent Memory And Skills Rules (@ax-llm/ax)
@@ -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.9"
4
+ version: "21.0.11"
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.9"
4
+ version: "21.0.11"
5
5
  ---
6
6
 
7
7
  # AxAgent Optimize Codegen Rules (@ax-llm/ax)
@@ -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.9"
4
+ version: "21.0.11"
5
5
  ---
6
6
 
7
7
  # AxAgent RLM Runtime Rules (@ax-llm/ax)
@@ -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.9"
4
+ version: "21.0.11"
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.9"
4
+ version: "21.0.11"
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
@@ -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.9"
4
+ version: "21.0.11"
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.9"
4
+ version: "21.0.11"
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.9"
4
+ version: "21.0.11"
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
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.9"
4
+ version: "21.0.11"
5
5
  ---
6
6
 
7
7
  # AxGEPA Codegen Rules (@ax-llm/ax)
@@ -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.9"
4
+ version: "21.0.11"
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.9"
4
+ version: "21.0.11"
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
@@ -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.9"
4
+ version: "21.0.11"
5
5
  ---
6
6
 
7
7
  # Ax Signature Reference