@ax-llm/ax 19.0.36 → 19.0.37
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 +172 -172
- package/index.cjs.map +1 -1
- package/index.d.cts +22 -31
- package/index.d.ts +22 -31
- package/index.global.js +163 -163
- package/index.global.js.map +1 -1
- package/index.js +157 -157
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/ax-agent-optimize.md +1 -1
- package/skills/ax-agent.md +21 -31
- package/skills/ax-ai.md +1 -1
- package/skills/ax-flow.md +1 -1
- package/skills/ax-gen.md +1 -1
- package/skills/ax-gepa.md +1 -1
- package/skills/ax-learn.md +1 -1
- package/skills/ax-llm.md +1 -1
- package/skills/ax-signature.md +1 -1
package/package.json
CHANGED
|
@@ -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: "19.0.
|
|
4
|
+
version: "19.0.37"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Optimize Codegen 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 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: "19.0.
|
|
4
|
+
version: "19.0.37"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Codegen Rules (@ax-llm/ax)
|
|
@@ -117,14 +117,13 @@ Practical rule:
|
|
|
117
117
|
- If `functions.discovery` is `true`, call `discoverModules(...)` first, then `discoverFunctions(...)`, then call only discovered functions.
|
|
118
118
|
- In stdout-mode RLM, non-final turns must emit exactly one `console.log(...)` and stop immediately after it.
|
|
119
119
|
- Never combine `console.log(...)` with `await final(...)` or `await askClarification(...)` in the same actor turn.
|
|
120
|
-
- Inside actor-authored JavaScript, `await final(
|
|
121
|
-
- If a host-side `AxAgentFunction` needs to end the current actor turn, use `extra.protocol.final(...)
|
|
120
|
+
- Inside actor-authored JavaScript, `await final(...)` and `await askClarification(...)` end the current turn immediately; code after them is dead code.
|
|
121
|
+
- If a host-side `AxAgentFunction` needs to end the current actor turn, use `extra.protocol.final(...)` or `extra.protocol.askClarification(...)`.
|
|
122
122
|
- If a child agent needs parent inputs such as `audience`, use `fields.shared` or `fields.globallyShared`.
|
|
123
123
|
- `llmQuery(...)` failures may come back as `[ERROR] ...`; do not assume success.
|
|
124
124
|
- If `contextPolicy.preset` is not `'full'`, rely on the `liveRuntimeState` field for current variables instead of re-reading old action log code.
|
|
125
125
|
- If `contextPolicy.preset` is `'adaptive'`, `'checkpointed'`, or `'lean'`, assume older successful turns may be replaced by a `Checkpoint Summary` and that replay-pruned successful turns may appear as compact summaries instead of full code blocks.
|
|
126
126
|
- In public `forward()` and `streamingForward()` flows, `askClarification(...)` does not go through the responder; it throws `AxAgentClarificationError`.
|
|
127
|
-
- In public `forward()` and `streamingForward()` flows, `respond(message)` does not go through the responder; it throws `AxAgentRespondError`.
|
|
128
127
|
- When resuming after clarification, prefer `error.getState()` from the thrown `AxAgentClarificationError`, then call `agent.setState(savedState)` before the next `forward(...)`.
|
|
129
128
|
- For offline tuning, hand off to the `ax-agent-optimize` skill and prefer eval-safe tools or in-memory mocks because `agent.optimize(...)` will replay tasks many times.
|
|
130
129
|
- Errors listed in `bubbleErrors` bypass all actor-loop catch blocks and propagate directly to the caller of `.forward()`. The same list is automatically inherited by recursive child agents created for advanced-mode `llmQuery(...)` calls.
|
|
@@ -297,10 +296,9 @@ const workflowTools = [
|
|
|
297
296
|
Rules:
|
|
298
297
|
|
|
299
298
|
- `extra.protocol` is only available when the function call comes from an active AxAgent actor runtime session.
|
|
300
|
-
- Use `extra.protocol.final(...)`, `extra.protocol.askClarification(...)`,
|
|
301
|
-
- Inside actor-authored JavaScript, keep using the runtime globals `final(...)` and `askClarification(...)`. `final(message)`
|
|
299
|
+
- Use `extra.protocol.final(...)`, `extra.protocol.askClarification(...)`, or `extra.protocol.guideAgent(...)` only inside host-side function handlers.
|
|
300
|
+
- Inside actor-authored JavaScript, keep using the runtime globals `final(...)` and `askClarification(...)`. `final(message)` and `final(task, context)` both go through the same responder-backed completion path; use the one-arg form when no extra context object is needed.
|
|
302
301
|
- `extra.protocol.guideAgent(...)` is handler-only internal control flow. It is not exposed as a JS runtime global or public completion type; it stops the current actor turn and appends trusted guidance to `guidanceLog` for the next iteration.
|
|
303
|
-
- `extra.protocol.respond(message)` responds directly to the user without running the responder and causes `forward()` to throw `AxAgentRespondError`. Use it when a function handler can provide a direct answer or determines the run should not continue (e.g. access denied, nothing to do).
|
|
304
302
|
- `askClarification(...)` accepts either a simple string or a structured object with `question` plus optional UI hints such as `type: 'date' | 'number' | 'single_choice' | 'multiple_choice'` and `choices`.
|
|
305
303
|
- Do not model these protocol completions as normal registered tool functions or discovery entries.
|
|
306
304
|
|
|
@@ -354,12 +352,10 @@ if (savedState) {
|
|
|
354
352
|
Public flow rules:
|
|
355
353
|
|
|
356
354
|
- `forward()` and `streamingForward()` throw `AxAgentClarificationError` when the actor calls `askClarification(...)`.
|
|
357
|
-
-
|
|
358
|
-
- The responder is skipped for both clarification and respond in those public flows.
|
|
355
|
+
- Successful `final(...)` completions always continue through the responder in those public flows.
|
|
359
356
|
- `AxAgentClarificationError.question` is the user-facing question text.
|
|
360
357
|
- `AxAgentClarificationError.clarification` is the normalized structured payload.
|
|
361
358
|
- `AxAgentClarificationError.getState()` returns the saved continuation state captured at throw time.
|
|
362
|
-
- `AxAgentRespondError.response` is the message string passed to `respond(...)`.
|
|
363
359
|
- `agent.getState()` and `agent.setState(...)` are the lower-level APIs for explicitly exporting or restoring continuation state on the agent instance.
|
|
364
360
|
- `test(...)` is different: it still returns structured completion payloads for harness/debug use instead of throwing clarification exceptions.
|
|
365
361
|
|
|
@@ -460,47 +456,41 @@ Rules:
|
|
|
460
456
|
- The same `bubbleErrors` list is automatically propagated to recursive child agents created for advanced-mode `llmQuery(...)` calls.
|
|
461
457
|
- Use `bubbleErrors` for fatal infrastructure errors (DB down, auth failures, quota exceeded) that should abort the run entirely rather than let the actor retry.
|
|
462
458
|
- Do not use `bubbleErrors` for expected recoverable errors; let those return as `[ERROR] ...` strings so the actor can handle them.
|
|
463
|
-
- `AxAgentClarificationError
|
|
459
|
+
- `AxAgentClarificationError` and `AxAIServiceAbortedError` always bubble up unconditionally — they do not need to be listed in `bubbleErrors`.
|
|
464
460
|
|
|
465
|
-
##
|
|
461
|
+
## Unified Final Signal
|
|
466
462
|
|
|
467
|
-
There are two ways to
|
|
463
|
+
There are two ways to end a successful run through the responder:
|
|
468
464
|
|
|
469
|
-
1. **In actor JS code**: Call `final(message)`
|
|
470
|
-
2. **In function handlers**: Use `extra.protocol.
|
|
465
|
+
1. **In actor JS code**: Call `final(message)` when no extra context object is needed, or `final(task, context)` when you gathered evidence.
|
|
466
|
+
2. **In function handlers**: Use `extra.protocol.final(...)` with the same one-arg or two-arg forms.
|
|
471
467
|
|
|
472
468
|
```typescript
|
|
473
|
-
import {
|
|
469
|
+
import { agent, ai, f, fn } from '@ax-llm/ax';
|
|
474
470
|
|
|
475
471
|
const checkAccess = fn('checkAccess')
|
|
476
|
-
.description('Verify access and
|
|
472
|
+
.description('Verify access and complete if denied')
|
|
477
473
|
.arg('resource', f.string('Resource name'))
|
|
478
474
|
.returns(f.string('Access status'))
|
|
479
475
|
.handler(async ({ resource }, extra) => {
|
|
480
476
|
if (!hasAccess(resource)) {
|
|
481
|
-
extra?.protocol?.
|
|
477
|
+
extra?.protocol?.final(`Access denied for ${resource}`);
|
|
482
478
|
}
|
|
483
479
|
return 'granted';
|
|
484
480
|
})
|
|
485
481
|
.build();
|
|
486
482
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
console.log(result);
|
|
490
|
-
} catch (err) {
|
|
491
|
-
if (err instanceof AxAgentRespondError) {
|
|
492
|
-
console.log('Direct response:', err.response);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
483
|
+
const result = await myAgent.forward(llm, { query });
|
|
484
|
+
console.log(result);
|
|
495
485
|
```
|
|
496
486
|
|
|
497
487
|
Rules:
|
|
498
488
|
|
|
499
|
-
- `
|
|
500
|
-
-
|
|
501
|
-
- `
|
|
502
|
-
- The responder
|
|
503
|
-
- Use
|
|
489
|
+
- Use `final(message)` when the actor already knows the answer and no extra context object is needed.
|
|
490
|
+
- Use `final(task, context)` when context was gathered and needs synthesis into output fields.
|
|
491
|
+
- In function handlers, use `extra.protocol.final(...)` instead of a separate respond API.
|
|
492
|
+
- The responder still runs for both successful `final(...)` forms.
|
|
493
|
+
- Use `askClarification(...)` when the user must provide more information to continue.
|
|
504
494
|
|
|
505
495
|
## Discovery Mode
|
|
506
496
|
|
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: "19.0.
|
|
4
|
+
version: "19.0.37"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AI Provider 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: "19.0.
|
|
4
|
+
version: "19.0.37"
|
|
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: "19.0.
|
|
4
|
+
version: "19.0.37"
|
|
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: "19.0.
|
|
4
|
+
version: "19.0.37"
|
|
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: "19.0.
|
|
4
|
+
version: "19.0.37"
|
|
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
|
|
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: "19.0.
|
|
4
|
+
version: "19.0.37"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Ax Library (@ax-llm/ax) Quick Reference
|
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: "19.0.
|
|
4
|
+
version: "19.0.37"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Ax Signature Reference
|