@aexhq/sdk 0.26.5 → 0.28.0

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.
@@ -1,40 +1,55 @@
1
1
  ---
2
2
  title: Agent tools
3
- description: The default machine tools available inside managed runs.
3
+ description: The default builtin tools available inside managed runs.
4
4
  icon: TerminalSquare
5
5
  ---
6
6
 
7
- Managed runs expose a DX-first default builtin set to the agent. Omit
8
- `builtins` for the recommended defaults:
9
-
10
- - `web_search`
11
- - `web_fetch`
12
- - `read`
13
- - `edit`
14
- - `glob`
15
- - `grep`
16
- - `head`
17
- - `tail`
18
- - `bash`
19
-
20
- Pass `builtins: []` for a pure-MCP run with no builtins. Pass a custom list to
21
- narrow or extend the surface, for example adding the optional `notebook`
22
- builtin. MCP-derived tools and subagent tools are separate surfaces.
23
-
24
- ## Default filesystem and web tools
25
-
26
- - `read` and `edit` expose file read/create/patch tools.
27
- - `grep` and `glob` search file contents and paths.
28
- - `head` and `tail` read bounded file slices.
29
- - `bash` runs shell commands in the run sandbox.
30
- - `web_fetch` fetches a URL and returns readable text.
31
- - `web_search` performs managed web search without requiring a caller-supplied
32
- search key.
7
+ Managed runs inject a DX-first set of builtin tools to the agent by default. The
8
+ default set is every builtin tool EXCEPT `notebook_edit` (notebook editing is
9
+ opt-in). It includes:
10
+
11
+ - `bash`, `code_execution` — run shell commands / model-written snippets
12
+ - `read_file`, `write_file`, `edit_file` — file read/create/patch
13
+ - `grep`, `glob` — search file contents and paths
14
+ - `head`, `tail` — read bounded file slices
15
+ - `web_fetch`, `web_search` — fetch a URL / managed web search
16
+ - `todo_write` — maintain a todo list
17
+ - `subagent`, `subagent_result` — delegate to and read back from child runs
18
+ - `bash_output`, `bash_kill` — manage background bash jobs
19
+ - `wait`, `git` — bounded idle-yield and first-class git
20
+
21
+ ## Toggling builtins
22
+
23
+ Set `includeBuiltinTools: false` to inject NO builtins — useful for a pure-MCP
24
+ or pure-custom run where every tool comes from `mcpServers` or `tools`.
25
+
26
+ `includeBuiltinTools` defaults to `true`.
27
+
28
+ ## Cherry-picking builtins
29
+
30
+ The `tools` list accepts both custom tool bundles and BUILTIN tool references
31
+ (bare name strings, preferably `BuiltinTools.<name>`). Use a builtin reference
32
+ to add a tool the default set omits (notebook editing), or to pick a narrow
33
+ subset alongside `includeBuiltinTools: false`.
34
+
35
+ The final tool list is ordered: resolved builtin tools, then custom tools, then
36
+ MCP tools.
33
37
 
34
38
  ## Optional notebook support
35
39
 
36
- `notebook` edits Jupyter `.ipynb` cells as JSON. It is accepted by the
37
- contract, but it is not in the default builtin list.
40
+ `notebook_edit` edits Jupyter `.ipynb` cells as JSON. It is NOT in the default
41
+ builtin set; add it via `tools`:
42
+
43
+ ```ts
44
+ import { BuiltinTools, Models } from "@aexhq/sdk";
45
+
46
+ await aex.submit({
47
+ model: Models.CLAUDE_HAIKU_4_5,
48
+ prompt: "Edit the analysis notebook.",
49
+ tools: [BuiltinTools.notebook_edit],
50
+ secrets: { apiKey: process.env.ANTHROPIC_API_KEY! }
51
+ });
52
+ ```
38
53
 
39
54
  Networking is open by default. If you explicitly set
40
55
  `environment.networking.mode` to `limited`, fetched hosts and the managed search
@@ -49,7 +64,7 @@ await aex.submit({
49
64
  model: Models.CLAUDE_HAIKU_4_5,
50
65
  prompt: "Use only the declared MCP tools.",
51
66
  mcpServers,
52
- builtins: [],
67
+ includeBuiltinTools: false,
53
68
  secrets: { apiKey: process.env.ANTHROPIC_API_KEY! }
54
69
  });
55
70
  ```
package/docs/outputs.md CHANGED
@@ -77,6 +77,28 @@ const looseReport = await aex.downloadOutput(runId, { path: "report.txt", match:
77
77
  console.log(looseReport.byteLength);
78
78
  ```
79
79
 
80
+ ## Reading one output as text
81
+
82
+ `readOutputText(runId, selector, options?)` reads ONE output file as byte-capped, decoded UTF-8 text. It streams the file and stops at `options.maxBytes` (default 50 KB, ceiling 10 MB), so a large deliverable never fully buffers — this is the read built for handing a run's output to an LLM tool. Select the file the same way as `downloadOutput`: by `{ path }` (suffix-matchable) or `{ id }`.
83
+
84
+ ```ts
85
+ const { text, truncated, totalBytes } = await aex.readOutputText(
86
+ runId,
87
+ { path: "report.md", match: "suffix" },
88
+ { maxBytes: 50_000, grep: "error" }
89
+ );
90
+
91
+ if (truncated) {
92
+ // text is a prefix of a larger file — narrow with `grep` or a tighter `path`.
93
+ }
94
+ ```
95
+
96
+ Check `truncated` before treating `text` as complete. Pass `options.grep` (a substring or `RegExp`) to keep only matching lines of the capped text. The returned `output` is the matched `Output` record, and `totalBytes` is the file's full size when the server reports it.
97
+
98
+ ### Chatting over a workspace's outputs
99
+
100
+ `createDataTools(client)` packages the read surface (`listRuns` + `listOutputs` + `readOutputText`) as a vendor-neutral LLM tool set (`{ tools, instructions, execute }`) so you can build a search-then-fetch chat over your runs and their outputs in a few lines on top of the public SDK. The `tools` are plain JSON-Schema definitions (the shape every major LLM tool API accepts); `execute(name, input)` dispatches a tool call against the workspace-scoped client. See the runnable `examples/data-chat/` example.
101
+
80
102
  ## Finding outputs
81
103
 
82
104
  `listOutputs(runId, query?)` and its alias `outputs(runId, query?)` can filter the captured output list client-side. Use `findOutputs` when you want discovery to be explicit, or `findOutput` when exactly one file is expected:
@@ -21,7 +21,7 @@ Allowed fields:
21
21
  - `proxyEndpoints` - array of `PlatformProxyEndpoint`; endpoint-level `retry` is allowed here and remains declaration-based.
22
22
  - `metadata` - non-secret structured metadata.
23
23
 
24
- `agentsMd`, `files`, `outputs`, `builtins`, and `outputMode` are top-level `submit` options, not run-config fields. They carry bytes, capture behavior, or agent tool/output controls that belong on a concrete run submission.
24
+ `agentsMd`, `files`, `outputs`, `tools`, `includeBuiltinTools`, and `outputMode` are top-level `submit` options, not run-config fields. They carry bytes, capture behavior, or agent tool/output controls that belong on a concrete run submission.
25
25
 
26
26
  Secrets never live in run config. Pass credentials through `submit({ ...config, secrets })` in the SDK or the equivalent host-mode flags (`--anthropic-api-key`, `--mcp-auth`, `--proxy-auth`) in the CLI. See [Secrets](secrets.md) for secret lifecycles and [Credentials](credentials.md) for the proxy endpoint policy/auth split and retry fields.
27
27
 
@@ -6,6 +6,25 @@ title: Run record
6
6
 
7
7
  The run record is the durable product primitive for one run id. It is the public-safe bundle of status metadata, the non-secret submission snapshot when available, typed events, captured outputs, and manifest entries for custody and cost telemetry.
8
8
 
9
+ ## Listing runs
10
+
11
+ `aex.listRuns(query?)` enumerates the runs in this workspace, most-recent first, one page at a time. The workspace is derived server-side from the API token, so this only ever returns your own runs. It is the workspace-wide discovery entry point: combine it with `listOutputs` / `readOutputText` (see [Outputs](outputs.md)) to reach any run's deliverables.
12
+
13
+ ```ts
14
+ let cursor: string | undefined;
15
+ do {
16
+ const page = await aex.listRuns({ status: "succeeded", limit: 25, cursor });
17
+ for (const run of page.runs) {
18
+ console.log(run.id, run.status, run.createdAt, run.costUsd);
19
+ }
20
+ cursor = page.nextCursor;
21
+ } while (cursor);
22
+ ```
23
+
24
+ `query` fields are all optional: `status` (single run status, e.g. `"succeeded"`), `since` (ISO-8601 lower bound on `createdAt`), `limit` (defaults to 25, clamped to `[1, 100]`), and `cursor` (the opaque keyset cursor from a prior page's `nextCursor` — absent on the last page). Each page row is a public-safe `RunSummary` (`id`, `status`, `createdAt`, `updatedAt`, and `costUsd` once settled); it deliberately omits the submission snapshot (model / prompt / env). Use `aex.getRun(runId)` for status / timing / cost on one run, or `aex.getRunUnit(runId)` (alias `getUnit`) for the full self-contained record including the parsed submission.
25
+
26
+ ## Downloading a run record
27
+
9
28
  `aex.download(runId)` and `aex download <run-id>` return a zip with this layout:
10
29
 
11
30
  ```text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexhq/sdk",
3
- "version": "0.26.5",
3
+ "version": "0.28.0",
4
4
  "description": "TypeScript SDK for running autonomous agent sessions across providers (Anthropic, OpenAI, DeepSeek, Gemini, Mistral) behind one interface.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {