@ax-llm/ax 17.0.5 → 17.0.6

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": "17.0.5",
3
+ "version": "17.0.6",
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
3
3
  description: This skill helps with building AxAgent-based agents using @ax-llm/ax. Use when the user asks about agent(), AxAgent, child agents, tool functions, smart model routing, RLM mode, stopping agents, or composing multi-agent hierarchies.
4
- version: "17.0.5"
4
+ version: "17.0.6"
5
5
  ---
6
6
 
7
7
  # AxAgent Guide (@ax-llm/ax)
@@ -469,6 +469,27 @@ In RLM mode, the agent gets a `codeInterpreter` tool. The LLM's typical workflow
469
469
  | `print(...args)` | Print output (appears in the function result) |
470
470
  | Context variables | All fields listed in `contextFields` are available by name |
471
471
 
472
+ ### Error handling in the code interpreter
473
+
474
+ Errors thrown by code running inside `session.execute(code)` cross the worker boundary and can be caught on the host. Always `await` `session.execute()` inside a try/catch:
475
+
476
+ ```typescript
477
+ try {
478
+ const result = await session.execute(code);
479
+ // use result
480
+ } catch (e) {
481
+ // e is an Error with name and message preserved from the worker
482
+ if (e instanceof Error && e.name === 'WaitForUserActionError') {
483
+ // handle domain-specific error
484
+ }
485
+ console.error(e.message);
486
+ }
487
+ ```
488
+
489
+ - **`e.name`** and **`e.message`** are preserved, so you can branch on `e.name === 'WaitForUserActionError'` (or other custom error names) and use `e.message` for user-facing context.
490
+ - **`e.cause`** is preserved when structured-cloneable, including recursive cause chains (with a depth limit).
491
+ - **`instanceof`** works for built-in errors (e.g. `TypeError`, `RangeError`) and for `Error`; for custom classes defined only in the worker, use **`e.name`** checks instead, since prototype identity is not preserved across the boundary.
492
+
472
493
  ### Custom Interpreters
473
494
 
474
495
  The built-in `AxJSRuntime` uses Web Workers for sandboxed code execution. For other environments, implement the `AxCodeRuntime` interface:
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: "17.0.5"
4
+ version: "17.0.6"
5
5
  ---
6
6
 
7
7
  # Ax Library (@ax-llm/ax) Usage Guide