@ax-llm/ax 19.0.13 → 19.0.15
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 +189 -166
- package/index.cjs.map +1 -1
- package/index.d.cts +36 -5
- package/index.d.ts +36 -5
- package/index.global.js +186 -163
- package/index.global.js.map +1 -1
- package/index.js +189 -166
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/ax-agent.md +69 -7
- package/skills/ax-llm.md +1 -1
package/package.json
CHANGED
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(...), or RLM code execution.
|
|
4
|
-
version: "19.0.
|
|
4
|
+
version: "19.0.15"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Codegen Rules (@ax-llm/ax)
|
|
@@ -15,6 +15,7 @@ Use this skill to generate `AxAgent` code. Prefer short, modern, copyable patter
|
|
|
15
15
|
- Assume the child-agent module is `agents` unless `agentIdentity.namespace` is set.
|
|
16
16
|
- If `functions.discovery` is `true`, discover callables from modules before using them.
|
|
17
17
|
- In stdout-mode RLM, use one observable `console.log(...)` step per non-final actor turn.
|
|
18
|
+
- For long RLM tasks, prefer `contextManagement.actionReplay: 'adaptive'` plus `stateSummary` so prior exploratory turns are summarized and live runtime state stays visible.
|
|
18
19
|
|
|
19
20
|
## Critical Rules
|
|
20
21
|
|
|
@@ -25,6 +26,8 @@ Use this skill to generate `AxAgent` code. Prefer short, modern, copyable patter
|
|
|
25
26
|
- Never combine `console.log(...)` with `final(...)` or `ask_clarification(...)` in the same actor turn.
|
|
26
27
|
- If a child agent needs parent inputs such as `audience`, use `fields.shared` or `fields.globallyShared`.
|
|
27
28
|
- `llmQuery(...)` failures may come back as `[ERROR] ...`; do not assume success.
|
|
29
|
+
- If `contextManagement.stateSummary.enabled` is on, rely on the `Live Runtime State` block for current variables instead of re-reading old action log code.
|
|
30
|
+
- If `contextManagement.actionReplay` is `'adaptive'` or `'minimal'`, assume older successful turns may be summarized or omitted.
|
|
28
31
|
|
|
29
32
|
## Canonical Pattern
|
|
30
33
|
|
|
@@ -116,9 +119,9 @@ Rules:
|
|
|
116
119
|
## Tool Functions And Namespaces
|
|
117
120
|
|
|
118
121
|
```typescript
|
|
119
|
-
import type {
|
|
122
|
+
import type { AxAgentFunction } from '@ax-llm/ax';
|
|
120
123
|
|
|
121
|
-
const tools:
|
|
124
|
+
const tools: AxAgentFunction[] = [
|
|
122
125
|
{
|
|
123
126
|
name: 'findSnippets',
|
|
124
127
|
namespace: 'kb',
|
|
@@ -134,11 +137,24 @@ const tools: AxFunction[] = [
|
|
|
134
137
|
type: 'array',
|
|
135
138
|
items: { type: 'string' },
|
|
136
139
|
},
|
|
140
|
+
examples: [
|
|
141
|
+
{
|
|
142
|
+
title: 'Find severity guidance',
|
|
143
|
+
code: 'await kb.findSnippets({ topic: "severity" });',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
137
146
|
func: async ({ topic }) => [],
|
|
138
147
|
},
|
|
139
148
|
];
|
|
140
149
|
|
|
141
150
|
const analyst = agent('query:string -> answer:string', {
|
|
151
|
+
namespaces: [
|
|
152
|
+
{
|
|
153
|
+
name: 'kb',
|
|
154
|
+
title: 'Knowledge Base',
|
|
155
|
+
description: 'Handbook and documentation search helpers.',
|
|
156
|
+
},
|
|
157
|
+
],
|
|
142
158
|
functions: { local: tools },
|
|
143
159
|
contextFields: [],
|
|
144
160
|
});
|
|
@@ -183,13 +199,21 @@ Discovery APIs:
|
|
|
183
199
|
|
|
184
200
|
Both return Markdown.
|
|
185
201
|
|
|
202
|
+
- `listModuleFunctions(...)` only lists modules that actually have callable entries. Namespace metadata from `namespaces` only enriches those callable-backed modules.
|
|
203
|
+
- If a requested module does not exist, `listModuleFunctions(...)` returns a per-module markdown error without failing the whole call.
|
|
204
|
+
- `getFunctionDefinitions(...)` may include argument comments from schema descriptions and fenced code examples from `AxAgentFunction.examples`.
|
|
205
|
+
|
|
186
206
|
Rules:
|
|
187
207
|
|
|
188
208
|
1. Call `listModuleFunctions(...)`.
|
|
189
|
-
2.
|
|
190
|
-
3.
|
|
191
|
-
4.
|
|
192
|
-
5.
|
|
209
|
+
2. If you need multiple modules, use one batched array call such as `listModuleFunctions(['timeRange', 'schedulingOrganizer'])`.
|
|
210
|
+
3. Log or inspect the returned markdown directly. Do not wrap it in JSON or custom objects.
|
|
211
|
+
4. If you need multiple callable definitions, prefer one batched `getFunctionDefinitions([...])` call.
|
|
212
|
+
5. Do not split discovery into separate calls with `Promise.all(...)`.
|
|
213
|
+
6. Inspect the logged result.
|
|
214
|
+
7. Call `getFunctionDefinitions(...)` for only the callables you plan to use.
|
|
215
|
+
8. Inspect the logged result.
|
|
216
|
+
9. Call discovered functions and child agents.
|
|
193
217
|
|
|
194
218
|
Examples:
|
|
195
219
|
|
|
@@ -208,6 +232,8 @@ Do not:
|
|
|
208
232
|
- Do not guess callable names when discovery mode is on.
|
|
209
233
|
- Do not assume sub-agents live under `agents` if `agentIdentity.namespace` is configured.
|
|
210
234
|
- Do not dump large pre-known tool definitions into actor code when discovery mode is enabled.
|
|
235
|
+
- Do not use `Promise.all(...)` to fan out discovery calls across modules or definitions.
|
|
236
|
+
- Do not convert discovery markdown into JSON before logging or using it.
|
|
211
237
|
|
|
212
238
|
## RLM Actor Code Rules
|
|
213
239
|
|
|
@@ -216,10 +242,46 @@ Use these rules when generating actor JavaScript for RLM in stdout mode:
|
|
|
216
242
|
- Treat each actor turn as exactly one observable step.
|
|
217
243
|
- If you need to inspect a value, compute it, `console.log(...)` it, and stop immediately after that `console.log(...)`.
|
|
218
244
|
- On the next turn, read the logged result from `Action Log` before writing more code that depends on it.
|
|
245
|
+
- If the prompt contains `Live Runtime State`, treat it as the canonical view of current variables.
|
|
219
246
|
- Errors from child-agent or tool calls appear in `Action Log`; inspect them and fix the code on the next turn.
|
|
220
247
|
- Non-final turns should contain exactly one `console.log(...)`.
|
|
221
248
|
- Final turns should call `final(...)` or `ask_clarification(...)` without `console.log(...)`.
|
|
222
249
|
- Do not write a complete multi-step program in one actor turn.
|
|
250
|
+
- Do not assume older successful turns remain fully replayed; adaptive replay may compress them to `[SUMMARY]: ...`.
|
|
251
|
+
|
|
252
|
+
## RLM Adaptive Replay
|
|
253
|
+
|
|
254
|
+
Prefer this configuration for long, multi-turn runtime analysis:
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
const analyst = agent(
|
|
258
|
+
'context:string, question:string -> answer:string, findings:string[]',
|
|
259
|
+
{
|
|
260
|
+
contextFields: ['context'],
|
|
261
|
+
runtime: new AxJSRuntime(),
|
|
262
|
+
maxTurns: 10,
|
|
263
|
+
contextManagement: {
|
|
264
|
+
actionReplay: 'adaptive',
|
|
265
|
+
recentFullActions: 1,
|
|
266
|
+
successSummarization: true,
|
|
267
|
+
stateSummary: { enabled: true, maxEntries: 6 },
|
|
268
|
+
stateInspection: { contextThreshold: 2_000 },
|
|
269
|
+
errorPruning: true,
|
|
270
|
+
hindsightEvaluation: true,
|
|
271
|
+
pruneRank: 2,
|
|
272
|
+
},
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Rules:
|
|
278
|
+
|
|
279
|
+
- Use `actionReplay: 'adaptive'` when the task needs runtime state across many turns but old exploratory code should not keep bloating the prompt.
|
|
280
|
+
- Use `recentFullActions` to keep the newest one or two turns verbatim while older successful turns collapse to summaries.
|
|
281
|
+
- Use `successSummarization: true` for explicit, compact summaries of older successful turns.
|
|
282
|
+
- Use `stateSummary.enabled` to inject a compact `Live Runtime State` block into the actor prompt.
|
|
283
|
+
- Use `actionReplay: 'minimal'` only when you want aggressively compressed history and can rely mostly on current runtime state.
|
|
284
|
+
- Keep `stateInspection.contextThreshold` on so the actor is reminded to call `inspect_runtime()` when context grows.
|
|
223
285
|
|
|
224
286
|
Good pattern:
|
|
225
287
|
|
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.15"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Ax Library (@ax-llm/ax) Usage Guide
|