@ax-llm/ax 21.0.6 → 21.0.7

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.6",
3
+ "version": "21.0.7",
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-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.6"
4
+ version: "21.0.7"
5
5
  ---
6
6
 
7
7
  # AxAgent Optimize Codegen 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 AxAgent code using @ax-llm/ax. Use when the user asks about agent(), child agents, namespaced functions, discovery mode, shared fields, llmQuery(...), RLM code execution, recursionOptions, or agent runtime behavior. For tuning and eval with agent.optimize(...), use ax-agent-optimize.
4
- version: "21.0.6"
4
+ version: "21.0.7"
5
5
  ---
6
6
 
7
7
  # AxAgent Codegen Rules (@ax-llm/ax)
@@ -28,7 +28,7 @@ Your job is not just to write valid code. Your job is to choose the smallest cor
28
28
  - Default to `contextPolicy: { preset: 'checkpointed', budget: 'balanced' }` for most RLM tasks.
29
29
  - Prefer `contextPolicy: { preset: 'adaptive', budget: 'balanced' }` when older successful turns should collapse sooner while live runtime state stays visible.
30
30
  - Prefer `executorModelPolicy` when the actor may need to upgrade after repeated error turns or discovery in specific namespaces without also upgrading the responder.
31
- - Use `executorTurnCallback` when the user needs per-turn observability into generated code, raw runtime result, formatted output, or provider thoughts.
31
+ - Use `actorTurnCallback` when the user needs per-turn observability into generated code, raw runtime result, formatted output, provider thoughts, or the actor stage (`distiller` vs `executor`). `executorTurnCallback` is the deprecated alias.
32
32
  - Use `agentStatusCallback` when the user wants real-time task progress updates from the actor via `await reportSuccess(message)` and `await reportFailure(message)` calls.
33
33
  - Use `onFunctionCall` when the user wants to observe every function the actor invokes from the JS runtime (their own registered functions plus internal globals like child agents, `discoverModules`, `discoverFunctions`, `consult`).
34
34
  - Use `onContextEvent` when the caller needs context-pressure and compaction telemetry (`budget_check`, `checkpoint_created`, `checkpoint_cleared`, `tombstone_created`); callback failures are ignored.
@@ -43,7 +43,7 @@ Map user intent to agent shape before writing code:
43
43
  - "Need child agents with distinct responsibilities" -> add the child agents to the parent's `functions: [...]` list. Set `agentIdentity.namespace` on each child to control where it lands in the JS runtime (e.g. `team.writer(...)`); otherwise it lands under `utils.<name>` like any other tool.
44
44
  - "Need tool discovery because names/schemas are not stable" -> use `functions.discovery: true` and generate discovery-first code.
45
45
  - "Need a stronger actor only when the run gets noisy or large" -> use `executorModelPolicy` and keep the responder model separate.
46
- - "Need debugging or traceability" -> start with `debug: true` or `executorTurnCallback`; do not add both unless the user clearly wants both prompt/runtime visibility and structured telemetry.
46
+ - "Need debugging or traceability" -> start with `debug: true` or `actorTurnCallback`; do not add both unless the user clearly wants both prompt/runtime visibility and structured telemetry.
47
47
  - "Need real-time progress updates" -> add `agentStatusCallback` so the actor can call `await reportSuccess(message)` and `await reportFailure(message)` to report sub-task progress.
48
48
  - "Need to log/trace every tool call" -> add `onFunctionCall` to receive `{ name, qualifiedName, args, kind }` for each function invoked by the runtime; `kind` is `'external'` for caller-registered functions and `'internal'` for agent-injected ones (child agents, discovery, skills loader).
49
49
  - "Need to observe compaction or prompt pressure" -> add `onContextEvent`; do not scrape actor prompts for pressure metrics.
@@ -820,15 +820,16 @@ await final("Summarize the severity-related snippets found", { snippets });
820
820
 
821
821
  ## Actor Turn Observability
822
822
 
823
- Use `executorTurnCallback` when the caller needs structured telemetry for each actor turn.
823
+ Use `actorTurnCallback` when the caller needs structured telemetry for each actor turn. `executorTurnCallback` is still accepted as a deprecated alias for older code.
824
824
 
825
825
  What it gives you:
826
826
 
827
827
  - `code`: the normalized JavaScript code the actor produced
828
+ - `stage`: which actor produced the turn (`distiller` or `executor`)
828
829
  - `result`: the raw untruncated runtime return value from executing that code
829
830
  - `output`: the formatted action-log output string after Ax normalizes and truncates it for prompt replay
830
831
  - `thought`: the actor model's `thought` field when `showThoughts` is enabled and the provider returns one
831
- - `executorResult`: the full actor payload returned by the executor stage
832
+ - `executorResult`: the full actor payload returned by the current actor stage (kept under this historical field name for compatibility)
832
833
  - `isError`: whether the execution path for that turn was treated as an error
833
834
 
834
835
  Use it for:
@@ -851,7 +852,8 @@ Good pattern:
851
852
  const supportAgent = agent('query:string -> answer:string', {
852
853
  contextFields: ['query'],
853
854
  runtime,
854
- executorTurnCallback: ({
855
+ actorTurnCallback: ({
856
+ stage,
855
857
  turn,
856
858
  actionLogEntryCount,
857
859
  guidanceLogEntryCount,
@@ -863,6 +865,7 @@ const supportAgent = agent('query:string -> answer:string', {
863
865
  }) => {
864
866
  console.log({
865
867
  turn,
868
+ stage,
866
869
  actionLogEntryCount,
867
870
  guidanceLogEntryCount,
868
871
  isError,
@@ -1504,7 +1507,8 @@ Use `promptMaxChars` when partial data is worse than no data (e.g. JSON objects)
1504
1507
  maxRuntimeChars?: number;
1505
1508
  contextPolicy?: AxContextPolicyConfig;
1506
1509
  summarizerOptions?: Omit<AxProgramForwardOptions<string>, 'functions'>;
1507
- executorTurnCallback?: (turn: {
1510
+ actorTurnCallback?: (turn: {
1511
+ stage: 'distiller' | 'executor';
1508
1512
  turn: number;
1509
1513
  actionLogEntryCount: number;
1510
1514
  guidanceLogEntryCount: number;
@@ -1515,6 +1519,18 @@ Use `promptMaxChars` when partial data is worse than no data (e.g. JSON objects)
1515
1519
  isError: boolean;
1516
1520
  thought?: string;
1517
1521
  }) => void | Promise<void>;
1522
+ executorTurnCallback?: (turn: {
1523
+ stage: 'distiller' | 'executor';
1524
+ turn: number;
1525
+ actionLogEntryCount: number;
1526
+ guidanceLogEntryCount: number;
1527
+ executorResult: Record<string, unknown>;
1528
+ code: string;
1529
+ result: unknown;
1530
+ output: string;
1531
+ isError: boolean;
1532
+ thought?: string;
1533
+ }) => void | Promise<void>; // deprecated alias; use actorTurnCallback
1518
1534
  onContextEvent?: (event: AxAgentContextEvent) => void | Promise<void>;
1519
1535
  inputUpdateCallback?: (currentInputs: Record<string, unknown>) => Promise<Record<string, unknown> | undefined> | Record<string, unknown> | undefined;
1520
1536
  onFunctionCall?: (call: {
@@ -1564,7 +1580,7 @@ Use `promptMaxChars` when partial data is worse than no data (e.g. JSON objects)
1564
1580
  }
1565
1581
  ```
1566
1582
 
1567
- - `executorTurnCallback` fires for the root agent and for recursive child agents that run actor turns.
1583
+ - `actorTurnCallback` fires for the root agent and for recursive child agents that run actor turns.
1568
1584
  - `executorModelPolicy` applies to the actor loop and can be inherited by recursive child agents unless you override it there.
1569
1585
  - `namespaces` matches exact discovery namespaces from successful `discoverFunctions(...)` lookups and starts affecting model choice on the next actor turn.
1570
1586
  - Consecutive error turns reset after a successful non-error turn and when checkpoint summarization refreshes to a new fingerprint.
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.6"
4
+ version: "21.0.7"
5
5
  ---
6
6
 
7
7
  # AI Provider Codegen Rules (@ax-llm/ax)
@@ -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.6"
4
+ version: "21.0.7"
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.6"
4
+ version: "21.0.7"
5
5
  ---
6
6
 
7
7
  # AxFlow Codegen Rules (@ax-llm/ax)
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.6"
4
+ version: "21.0.7"
5
5
  ---
6
6
 
7
7
  # AxGen Codegen Rules (@ax-llm/ax)
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.6"
4
+ version: "21.0.7"
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.6"
4
+ version: "21.0.7"
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.6"
4
+ version: "21.0.7"
5
5
  ---
6
6
 
7
7
  # Ax Library (@ax-llm/ax) Quick Reference
@@ -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.6"
4
+ version: "21.0.7"
5
5
  ---
6
6
 
7
7
  # Ax Signature Reference