@ancha-labs/cli 0.4.12 → 0.4.14
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/lib/ancha.mjs +22592 -14209
- package/lib/assets/SKILL.md +11 -6
- package/lib/assets/agents-section.md +10 -5
- package/lib/assets/docs/cloud.md +15 -8
- package/lib/assets/docs/compare.md +1 -1
- package/lib/assets/docs/datasets.md +69 -0
- package/lib/assets/docs/scenes.md +38 -1
- package/lib/assets/docs/setup.md +12 -6
- package/lib/assets/harbor/companion.mjs +4262 -3180
- package/lib/assets/harbor/suiteql-worker.mjs +150 -22
- package/lib/assets/templates/starter/oracle.mjs +37 -4
- package/lib/assets/ui/app.js +12 -5
- package/lib/assets/ui/style.css +1 -1
- package/lib/mcp-entry.mjs +539 -134
- package/lib/suiteql-worker.mjs +150 -22
- package/lib/worker.mjs +5440 -3899
- package/lib/world-server.mjs +4047 -2971
- package/package.json +1 -1
package/lib/assets/SKILL.md
CHANGED
|
@@ -26,6 +26,7 @@ Add `--json` to every command. Runs print NDJSON events that end with `run_finis
|
|
|
26
26
|
ancha init
|
|
27
27
|
```
|
|
28
28
|
- To name the command yourself: `ancha init --agent "<the command that starts your agent>"`.
|
|
29
|
+
- To name its tools yourself (NetSuite, Slack, ...): `ancha init --tools netsuite,slack`.
|
|
29
30
|
3. **Store the key it needs.** The agent's own model key, read from your shell, never from an argument: it is stored in your workspace and named under `agent.pass_env` in `ancha.yaml`, so the agent gets it in every cloud attempt.
|
|
30
31
|
```sh
|
|
31
32
|
ancha secrets set ANTHROPIC_API_KEY
|
|
@@ -35,7 +36,11 @@ Add `--json` to every command. Runs print NDJSON events that end with `run_finis
|
|
|
35
36
|
ancha agent upload
|
|
36
37
|
```
|
|
37
38
|
- The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
|
|
38
|
-
5. **
|
|
39
|
+
5. **Without production traces.** For an agent that uses NetSuite, `ancha init` writes a NetSuite world of a private-equity portfolio company (four subsidiaries, two currencies, thousands of transactions) and 25 tests from the questions an operator asks.
|
|
40
|
+
- Your data: `ancha world import netsuite <your exports> --id <id>` reads REST record JSON, SuiteQL results and saved search CSV into `ancha/worlds/<id>.yaml`; check it with `ancha world validate`. To write the seed yourself, `ancha twins seed netsuite` lists its fields.
|
|
41
|
+
- Your evals: `ancha test import <file> --world <id>` (JSONL, JSON, CSV or YAML with a question and an expected answer).
|
|
42
|
+
- One test from a sentence: `ancha test new "<sentence>" --world <id>`.
|
|
43
|
+
6. **Upload traces.** A file or a folder of traces, runs that went fine and runs that failed: each trace becomes a test, in `scenes/from-traces/` and in your workspace.
|
|
39
44
|
```sh
|
|
40
45
|
ancha traces upload ./traces
|
|
41
46
|
```
|
|
@@ -43,10 +48,10 @@ Add `--json` to every command. Runs print NDJSON events that end with `run_finis
|
|
|
43
48
|
- A trace of a run that went wrong can say what went wrong: `ancha traces upload <trace file> --expect "<what went wrong>"`, or for a test already made, `ancha pull <test id> --expect "<what went wrong>"`.
|
|
44
49
|
- Traces your agent already sent to your workspace: `ancha traces`, then `ancha pull <trace id>`.
|
|
45
50
|
- A test lists what one trace cannot settle: answer with `ancha pull <test id> --answer <question>=<answer>`.
|
|
46
|
-
|
|
51
|
+
7. **Point the agent at the test's tools.** In a test, the agent calls Ancha instead of production:
|
|
47
52
|
- Its clients for Slack, GitHub and the other tools Ancha replicates take the URLs and credentials Ancha supplies: `ancha connect <tool>` prints the settings.
|
|
48
53
|
- Its own functions: wrap them with `wrapTools` from `@ancha-labs/tools` (`ancha.wrap_tools` in Python), or serve them over MCP.
|
|
49
|
-
|
|
54
|
+
8. **Run your tests.** Every test, each attempt on a fresh machine. The run grades each attempt check by check and ends with the link to its result.
|
|
50
55
|
```sh
|
|
51
56
|
ancha run
|
|
52
57
|
```
|
|
@@ -54,13 +59,13 @@ Add `--json` to every command. Runs print NDJSON events that end with `run_finis
|
|
|
54
59
|
- `--attempts <n>` sets how many attempts each test gets, `--concurrency <n>` how many run at once.
|
|
55
60
|
- `ancha wait <run id>` follows a run again from any terminal; `ancha explain <run id>` shows why a check failed.
|
|
56
61
|
- `ancha status` shows which of these steps your workspace has done.
|
|
57
|
-
|
|
62
|
+
9. **Fix the agent and keep the test.** Keep the failing run as the reference, fix the agent, and run again: exit 0 means every check passes and nothing regressed.
|
|
58
63
|
```sh
|
|
59
64
|
ancha baseline save before --from <run id>
|
|
60
65
|
ancha run --compare before
|
|
61
66
|
```
|
|
62
67
|
- Commit `scenes/from-traces/` so every run, in CI too, keeps it fixed.
|
|
63
|
-
|
|
68
|
+
10. **Run it on this computer.** While you develop, `ancha run --on local` runs the agent and its worlds on this computer, with the same checks.
|
|
64
69
|
```sh
|
|
65
70
|
ancha run --on local --attempts 1
|
|
66
71
|
```
|
|
@@ -74,7 +79,7 @@ Add `--json` to every command. Runs print NDJSON events that end with `run_finis
|
|
|
74
79
|
- The `run_finished` event carries `url` (the result in the workspace) and `summary`, with `counts` of the attempts: requested, completed, invalid, skipped and cancelled. Interrupting the command stops the following, never the run: `ancha wait <run id>` follows it again, and `--detach` returns once the run is accepted.
|
|
75
80
|
- `ancha explain <run id> --json` shows each failed check: what was expected, what happened, and the calls and world events behind it. Read it before guessing from the code; many bugs only show up with the world's data and timing.
|
|
76
81
|
- When every attempt ended before the agent did anything (it exited within seconds without a call, or its command could not start), the run, `ancha wait` and `ancha explain` say that first: "Your agent didn't run", the end of its log once, and the likely fix read from it, such as the `agent.env` line that gives the agent its task under the name it reads. `agentNeverRan` in the JSON carries the same. Make that fix first: the failed checks follow from it, and `ancha explain <run id> --all` lists them.
|
|
77
|
-
- `ancha status --json` shows the workspace's three steps (agent uploaded,
|
|
82
|
+
- `ancha status --json` shows the workspace's three steps (agent uploaded, tests added, tests run in the cloud) and the next command. In CI, `ANCHA_SERVER_URL` and `ANCHA_API_KEY` replace the login. More: `ancha docs cloud`.
|
|
78
83
|
|
|
79
84
|
## An app, not a command
|
|
80
85
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
ancha init
|
|
12
12
|
```
|
|
13
13
|
- To name the command yourself: `ancha init --agent "<the command that starts your agent>"`.
|
|
14
|
+
- To name its tools yourself (NetSuite, Slack, ...): `ancha init --tools netsuite,slack`.
|
|
14
15
|
3. **Store the key it needs.** The agent's own model key, read from your shell, never from an argument: it is stored in your workspace and named under `agent.pass_env` in `ancha.yaml`, so the agent gets it in every cloud attempt.
|
|
15
16
|
```sh
|
|
16
17
|
ancha secrets set ANTHROPIC_API_KEY
|
|
@@ -20,7 +21,11 @@
|
|
|
20
21
|
ancha agent upload
|
|
21
22
|
```
|
|
22
23
|
- The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
|
|
23
|
-
5. **
|
|
24
|
+
5. **Without production traces.** For an agent that uses NetSuite, `ancha init` writes a NetSuite world of a private-equity portfolio company (four subsidiaries, two currencies, thousands of transactions) and 25 tests from the questions an operator asks.
|
|
25
|
+
- Your data: `ancha world import netsuite <your exports> --id <id>` reads REST record JSON, SuiteQL results and saved search CSV into `ancha/worlds/<id>.yaml`; check it with `ancha world validate`. To write the seed yourself, `ancha twins seed netsuite` lists its fields.
|
|
26
|
+
- Your evals: `ancha test import <file> --world <id>` (JSONL, JSON, CSV or YAML with a question and an expected answer).
|
|
27
|
+
- One test from a sentence: `ancha test new "<sentence>" --world <id>`.
|
|
28
|
+
6. **Upload traces.** A file or a folder of traces, runs that went fine and runs that failed: each trace becomes a test, in `scenes/from-traces/` and in your workspace.
|
|
24
29
|
```sh
|
|
25
30
|
ancha traces upload ./traces
|
|
26
31
|
```
|
|
@@ -28,10 +33,10 @@
|
|
|
28
33
|
- A trace of a run that went wrong can say what went wrong: `ancha traces upload <trace file> --expect "<what went wrong>"`, or for a test already made, `ancha pull <test id> --expect "<what went wrong>"`.
|
|
29
34
|
- Traces your agent already sent to your workspace: `ancha traces`, then `ancha pull <trace id>`.
|
|
30
35
|
- A test lists what one trace cannot settle: answer with `ancha pull <test id> --answer <question>=<answer>`.
|
|
31
|
-
|
|
36
|
+
7. **Point the agent at the test's tools.** In a test, the agent calls Ancha instead of production:
|
|
32
37
|
- Its clients for Slack, GitHub and the other tools Ancha replicates take the URLs and credentials Ancha supplies: `ancha connect <tool>` prints the settings.
|
|
33
38
|
- Its own functions: wrap them with `wrapTools` from `@ancha-labs/tools` (`ancha.wrap_tools` in Python), or serve them over MCP.
|
|
34
|
-
|
|
39
|
+
8. **Run your tests.** Every test, each attempt on a fresh machine. The run grades each attempt check by check and ends with the link to its result.
|
|
35
40
|
```sh
|
|
36
41
|
ancha run
|
|
37
42
|
```
|
|
@@ -39,13 +44,13 @@
|
|
|
39
44
|
- `--attempts <n>` sets how many attempts each test gets, `--concurrency <n>` how many run at once.
|
|
40
45
|
- `ancha wait <run id>` follows a run again from any terminal; `ancha explain <run id>` shows why a check failed.
|
|
41
46
|
- `ancha status` shows which of these steps your workspace has done.
|
|
42
|
-
|
|
47
|
+
9. **Fix the agent and keep the test.** Keep the failing run as the reference, fix the agent, and run again: exit 0 means every check passes and nothing regressed.
|
|
43
48
|
```sh
|
|
44
49
|
ancha baseline save before --from <run id>
|
|
45
50
|
ancha run --compare before
|
|
46
51
|
```
|
|
47
52
|
- Commit `scenes/from-traces/` so every run, in CI too, keeps it fixed.
|
|
48
|
-
|
|
53
|
+
10. **Run it on this computer.** While you develop, `ancha run --on local` runs the agent and its worlds on this computer, with the same checks.
|
|
49
54
|
```sh
|
|
50
55
|
ancha run --on local --attempts 1
|
|
51
56
|
```
|
package/lib/assets/docs/cloud.md
CHANGED
|
@@ -19,6 +19,7 @@ Without `--on`, a project with `ancha.yaml` (or `--config`) runs in the workspac
|
|
|
19
19
|
ancha init
|
|
20
20
|
```
|
|
21
21
|
- To name the command yourself: `ancha init --agent "<the command that starts your agent>"`.
|
|
22
|
+
- To name its tools yourself (NetSuite, Slack, ...): `ancha init --tools netsuite,slack`.
|
|
22
23
|
3. **Store the key it needs.** The agent's own model key, read from your shell, never from an argument: it is stored in your workspace and named under `agent.pass_env` in `ancha.yaml`, so the agent gets it in every cloud attempt.
|
|
23
24
|
```sh
|
|
24
25
|
ancha secrets set ANTHROPIC_API_KEY
|
|
@@ -28,7 +29,11 @@ Without `--on`, a project with `ancha.yaml` (or `--config`) runs in the workspac
|
|
|
28
29
|
ancha agent upload
|
|
29
30
|
```
|
|
30
31
|
- The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
|
|
31
|
-
5. **
|
|
32
|
+
5. **Without production traces.** For an agent that uses NetSuite, `ancha init` writes a NetSuite world of a private-equity portfolio company (four subsidiaries, two currencies, thousands of transactions) and 25 tests from the questions an operator asks.
|
|
33
|
+
- Your data: `ancha world import netsuite <your exports> --id <id>` reads REST record JSON, SuiteQL results and saved search CSV into `ancha/worlds/<id>.yaml`; check it with `ancha world validate`. To write the seed yourself, `ancha twins seed netsuite` lists its fields.
|
|
34
|
+
- Your evals: `ancha test import <file> --world <id>` (JSONL, JSON, CSV or YAML with a question and an expected answer).
|
|
35
|
+
- One test from a sentence: `ancha test new "<sentence>" --world <id>`.
|
|
36
|
+
6. **Upload traces.** A file or a folder of traces, runs that went fine and runs that failed: each trace becomes a test, in `scenes/from-traces/` and in your workspace.
|
|
32
37
|
```sh
|
|
33
38
|
ancha traces upload ./traces
|
|
34
39
|
```
|
|
@@ -36,10 +41,10 @@ Without `--on`, a project with `ancha.yaml` (or `--config`) runs in the workspac
|
|
|
36
41
|
- A trace of a run that went wrong can say what went wrong: `ancha traces upload <trace file> --expect "<what went wrong>"`, or for a test already made, `ancha pull <test id> --expect "<what went wrong>"`.
|
|
37
42
|
- Traces your agent already sent to your workspace: `ancha traces`, then `ancha pull <trace id>`.
|
|
38
43
|
- A test lists what one trace cannot settle: answer with `ancha pull <test id> --answer <question>=<answer>`.
|
|
39
|
-
|
|
44
|
+
7. **Point the agent at the test's tools.** In a test, the agent calls Ancha instead of production:
|
|
40
45
|
- Its clients for Slack, GitHub and the other tools Ancha replicates take the URLs and credentials Ancha supplies: `ancha connect <tool>` prints the settings.
|
|
41
46
|
- Its own functions: wrap them with `wrapTools` from `@ancha-labs/tools` (`ancha.wrap_tools` in Python), or serve them over MCP.
|
|
42
|
-
|
|
47
|
+
8. **Run your tests.** Every test, each attempt on a fresh machine. The run grades each attempt check by check and ends with the link to its result.
|
|
43
48
|
```sh
|
|
44
49
|
ancha run
|
|
45
50
|
```
|
|
@@ -47,13 +52,13 @@ Without `--on`, a project with `ancha.yaml` (or `--config`) runs in the workspac
|
|
|
47
52
|
- `--attempts <n>` sets how many attempts each test gets, `--concurrency <n>` how many run at once.
|
|
48
53
|
- `ancha wait <run id>` follows a run again from any terminal; `ancha explain <run id>` shows why a check failed.
|
|
49
54
|
- `ancha status` shows which of these steps your workspace has done.
|
|
50
|
-
|
|
55
|
+
9. **Fix the agent and keep the test.** Keep the failing run as the reference, fix the agent, and run again: exit 0 means every check passes and nothing regressed.
|
|
51
56
|
```sh
|
|
52
57
|
ancha baseline save before --from <run id>
|
|
53
58
|
ancha run --compare before
|
|
54
59
|
```
|
|
55
60
|
- Commit `scenes/from-traces/` so every run, in CI too, keeps it fixed.
|
|
56
|
-
|
|
61
|
+
10. **Run it on this computer.** While you develop, `ancha run --on local` runs the agent and its worlds on this computer, with the same checks.
|
|
57
62
|
```sh
|
|
58
63
|
ancha run --on local --attempts 1
|
|
59
64
|
```
|
|
@@ -68,7 +73,7 @@ Without `--on`, a project with `ancha.yaml` (or `--config`) runs in the workspac
|
|
|
68
73
|
|
|
69
74
|
## Upload the agent
|
|
70
75
|
|
|
71
|
-
`ancha agent upload` (also `ancha doctor --on cloud`) checks the agent where its tests run, before any test exists. A fresh machine installs the project's dependencies and starts the agent once with a task, through the same launcher and variables as an attempt
|
|
76
|
+
`ancha agent upload` (also `ancha doctor --on cloud`) checks the agent where its tests run, before any test exists. A fresh machine installs the project's dependencies and starts the agent once with a task, through the same launcher and variables as an attempt. An agent that uses NetSuite has 90 seconds to find one customer in NetSuite and reply with its name; any other agent has 20 seconds, and exiting 0 or showing any work in that time makes it ready. The result says what happened in one sentence: the NetSuite calls it made and the answer it gave, or what stopped it (credentials NetSuite refused, a NetSuite host outside Ancha, a model key its provider refused, an answer missing where your tests read it, no output at all) with the change that fixes it. One that exits with an error shows its exit code, the end of its log and, when the log names where it looks for its task, the `ancha.yaml` line that gives it there. An agent served over HTTP (`agent.url`) starts and answers its ready check. That marks the agent uploaded in the workspace's first steps, and the command prints the link to the upload.
|
|
72
77
|
|
|
73
78
|
The install follows the project's own files, Node and Python alike: a Node lockfile installs exactly what it locks, with its package manager, and a `package.json` without one runs `npm install`; `uv.lock` and `pyproject.toml` run `uv sync`, and `requirements.txt` installs with pip into `.venv`. `agent.install` in `ancha.yaml` sets the command instead, for example `agent: { install: "npm ci && npm run build" }`. The machine has Node 24 and Python 3.12 with their package managers. The install runs as its own user with public internet; the agent then runs as another, and its network reaches only its tools and its model providers.
|
|
74
79
|
|
|
@@ -105,10 +110,12 @@ ancha runs show <run id> # the run and its attempts
|
|
|
105
110
|
`ancha status` prints the workspace's three steps, the ones Get started shows, and the next command:
|
|
106
111
|
|
|
107
112
|
- **Agent uploaded**: `ancha agent upload` started this project's agent with a task, or a cloud run graded it.
|
|
108
|
-
- **
|
|
113
|
+
- **Tests added**: the workspace holds a trace or a test made from one, or a cloud run ran this project's tests.
|
|
109
114
|
- **Tests run in the cloud**: a cloud run graded at least one check on an attempt that ran.
|
|
110
115
|
|
|
111
|
-
|
|
116
|
+
In a project whose `ancha.yaml` lists tests, the next command after the upload is `ancha run`.
|
|
117
|
+
|
|
118
|
+
With `--json`: `{"version": 1, "workspace", "checks": {"agentConnected": {"done", "agentId", "at"}, "testsAdded": {"done", "traceId", "runId", "at"}, "tracesImported": {"done", "traceId", "at"}, "firstGradedCloudRun": {"done", "runId", "at"}}, "nextCommand"}`. `tracesImported` counts traces alone: a trace, or a test made from one.
|
|
112
119
|
|
|
113
120
|
## Where results live
|
|
114
121
|
|
|
@@ -6,7 +6,7 @@ Run `ancha run --json`, then `ancha baseline save before` to freeze a completed
|
|
|
6
6
|
|
|
7
7
|
Comparison requires exactly matching sets of tests and normalized test fingerprints, including their success criteria. YAML formatting and object key order do not affect fingerprints. Test content changes require a fresh reference. Trial counts may differ. References containing invalid harness trials must be rerun with a healthy harness; genuine agent failures remain valid references. Legacy summaries remain readable with report/explain, but summaries without scene fingerprints cannot establish a verified comparison.
|
|
8
8
|
|
|
9
|
-
`ancha report latest --html [--out <runs-dir>]` writes a self-contained offline report.html in that run's directory and returns its absolute path (JSON: runId and path). The
|
|
9
|
+
`ancha report <runId|latest> --html [--open] [--out <runs-dir>]` writes a self-contained offline report.html in that run's directory and returns its absolute path (JSON: runId and path); `--open` also opens it. A cloud run (`run_cloud_…`) is read from the workspace once it has finished and kept in `.ancha/runs/<id>/`, so later reports work offline. The page shows each attempt of each test as passed, failed, harness-invalid or ungraded, a cloud run's machines on one clock, and each attempt's answer, checks, calls, record changes and agent log. URLs and artifact paths are inert text; no remote assets are loaded.
|
|
10
10
|
|
|
11
11
|
Inspect per-test pass-rate changes and check evidence, including invalid trials. Every required check is compared too: if one check's pass rate falls, the run regresses (exit 1) even when the test's rate is unchanged, for example when one check went from 3/3 to 0/3 while another went from 0/3 to 3/3. Dropped checks are listed first, in the text and in `comparison.droppedChecks`. Missing or changed tests reject comparison and require a fresh reference. A regression in a comparable scene can fail the run even when the overall threshold passes. Infrastructure-invalid trials take precedence, then strict coverage gaps, then failed thresholds or regressions.
|
|
12
12
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Worlds from your data
|
|
2
|
+
|
|
3
|
+
A world file (`ancha/worlds/<id>.yaml`) holds the records your agent's tools start with. Tests name it with `world: <id>`. You can start from a ready dataset, or have your coding agent convert your own records into one.
|
|
4
|
+
|
|
5
|
+
## A ready NetSuite world
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
ancha world gen --dataset netsuite-pe --size m
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This writes the books of a private-equity portfolio company, `ancha/worlds/netsuite-pe-m.yaml`, and 25 operator questions with computed answers, `ancha/evals/netsuite-pe-m.jsonl`. It needs no model and no description: the same size always gives the same files. The company has four subsidiaries, US dollar and euro books, eighteen months of order to cash and procure to pay, and the problems an operator finds at close: duplicate bills, unapplied payments and credits, overdue receivables, three-way-match exceptions, journal entries waiting for approval. Sizes `s`, `m` and `l` hold about 1,500, 11,400 and 22,000 transactions. `ancha sandbox datasets` lists it with the starter datasets.
|
|
12
|
+
|
|
13
|
+
## Your NetSuite exports
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
ancha world import netsuite exports/ --id our-books
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
It reads what NetSuite exports, as NetSuite writes it: REST record JSON (single records, list pages, JSON lines, expanded sublists), SuiteQL results (`customer.json`, `transaction.json`, `transactionline.json`, `previoustransactionlink.json`...) and saved search CSV with NetSuite's column labels. A file's name or `--type` says its record type. Customers, vendors, employees, contacts, items, the chart of accounts, subsidiaries, currencies, terms, segments and the main transactions become the modeled seed, each in its own subsidiary and currency; every other record type and field is kept as given and served in REST and SuiteQL. It writes `ancha/worlds/our-books.yaml`, prints what it modeled and kept, and lists each record the books check refuses with its file: fix it in the export and import again, or keep its type as given, outside the books, with `--plain <type>`. Then check the world with `ancha world validate ancha/worlds/our-books.yaml`.
|
|
20
|
+
|
|
21
|
+
## Your own records, converted by your coding agent
|
|
22
|
+
|
|
23
|
+
Give your coding agent this recipe and an export of your records (a spreadsheet, another system's export).
|
|
24
|
+
|
|
25
|
+
1. Read the seed format, with a working example:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
ancha twins seed netsuite --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
2. Write a converter, in any language, from the export to the `seed.netsuite` block: customers and vendors with their IDs, items, then transactions with their lines, and payments with what each one applies. Keep the internal IDs and document numbers from the export, so a question about INV-10212 finds INV-10212, and each record's subsidiary, currency and exchange rate, so totals by subsidiary and in US dollars come out as in your account. Dates can be absolute (`2026-10-14`) or offsets from the world's start (`-19d`). NetSuite computes totals, statuses and GL postings from the records.
|
|
32
|
+
|
|
33
|
+
3. Write the world file around it:
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
version: 2
|
|
37
|
+
id: our-books
|
|
38
|
+
title: Our NetSuite books, October close
|
|
39
|
+
tools: [netsuite]
|
|
40
|
+
start_time: 2026-11-02T14:00:00Z
|
|
41
|
+
seed:
|
|
42
|
+
netsuite:
|
|
43
|
+
customers: [...]
|
|
44
|
+
invoices: [...]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
4. Check it, and fix what it reports until it is clean:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
ancha world validate ancha/worlds/our-books.yaml
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
It reads the file with the rules a test loads it with, prints the records per tool, and lists every problem by record, with the amounts involved:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
invalid ancha/worlds/our-books.yaml (our-books)
|
|
57
|
+
netsuite: 4 subsidiaries, 2 currencies, 38 accounts, 400 customers, 180 vendors, 150 items, 11,429 transactions
|
|
58
|
+
seed.netsuite.invoices[212]: INV12213 (id 40213, customer 1297 Jarvis Food Processing Co.): invoice is over-applied: applications total USD 11,641.54 against a total of USD 11,601.54 (over by USD 40.00)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
It exits 1 while any problem remains and 0 once the world is clean. `--json` gives the same report for the converter's own checks. Large files and nearly full record lists get a warning.
|
|
62
|
+
|
|
63
|
+
5. Point your tests at the world with `world: our-books`, and import your evals as tests:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
ancha test import our-evals.jsonl --world our-books
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`ancha scene validate` checks world files the same way, next to your tests.
|
|
@@ -5,9 +5,46 @@
|
|
|
5
5
|
A version 2 test names a world (`ancha/worlds/<id>.yaml`: the company, its people with what they know and decide, and the tools' history) and says what starts an attempt, when it ends, and the checks: on what people learned, decided and were told, and on the tools.
|
|
6
6
|
|
|
7
7
|
- `ancha world gen "<company and scenario>" --json` writes a world. `ancha init --intent "<…>"` does that while setting up the project, and drafts a first test for it.
|
|
8
|
-
- `ancha test new "<the test in one sentence>" --json` drafts a test for the project's world (`--world <id>` when there are several) into `ancha/tests/<id>.yaml`, with a `.gen.json` record of the prompt. The draft is validated against the world (every ref exists, every check can be evaluated) before it is written. Read its checks before you run it: each should pass for an agent that does the job and fail for one that doesn't.
|
|
8
|
+
- `ancha test new "<the test in one sentence>" --json` drafts a test for the project's world (`--world <id>` when there are several) into `ancha/tests/<id>.yaml`, with a `.gen.json` record of the prompt. The draft is validated against the world (every ref exists, every check can be evaluated) before it is written. On a world with NetSuite, the drafter reads the records the world starts with, the open items and sample records by id, and checks records (`netsuite.record` on records that exist, with fields their type has, `netsuite.count`, `netsuite.unchanged`) and the agent's final answer (`answer`). Read its checks before you run it: each should pass for an agent that does the job and fail for one that doesn't.
|
|
9
9
|
- Run it like any test: `ancha run ancha/tests/<id>.yaml`. Both commands use a model: your `OPENROUTER_API_KEY`, or your workspace's credit when you're logged in.
|
|
10
10
|
|
|
11
|
+
## Tests from your evals
|
|
12
|
+
|
|
13
|
+
`ancha test import <file> --world <id> --json` turns evals, questions with expected answers, into tests on a world in `ancha/tests/` (`--out <dir>` for another folder; `--world` defaults to the only world file). It reads JSON lines, a JSON array, CSV with a header row, or a YAML list:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{"id": "ar-over-90", "question": "What is AR more than 90 days past due?", "expected": "$48,200.50 across 6 customers", "read_only": true}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- The question is `question`, `input`, `prompt`, `query` or `task`; the expected answer is `expected`, `answer`, `ideal`, `output`, `reference` or `expected_output`. Optional: `id`, `read_only` (default true; false for an eval with `records`), `must_call` (`"METHOD /path"` or an MCP tool name), `numbers` (`[{ value, tolerance }]`), `contains`, `judge` (a rubric), `tags`, and `records`: the NetSuite state a write leaves, `[{ type, id or externalId, fields }]`. Other fields go in the test's header as comments.
|
|
20
|
+
- Each eval becomes a test whose task is the question, with an `answer` check: the `numbers` and `contains` it gives, or the numbers, document numbers (`INV-1043`) and quoted text of its expected answer. Numbers the question states and dates are left out. A test also gets `netsuite.unchanged` over every record type when it only reads and the world has NetSuite, a `trace.called` check for each `must_call`, and a `netsuite.record` check for each of its `records`. A record named by `externalId` can be one the agent creates:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{"id": "approve-bf-2207", "question": "Approve the Bluefield Logistics bill BF-2207.", "records": [{"type": "vendorBill", "externalId": "BF-2207", "fields": {"approvalStatus": {"id": "2"}}}]}
|
|
24
|
+
```
|
|
25
|
+
- `--judge auto` (the default) adds a judge, "The final answer states: <expected>", only where the expected answer holds nothing an answer check can read; `--judge always` adds it to every test, where it is optional beside the answer check; `--judge never` adds none. Judges use a model: the workspace's model credit in the cloud, `OPENROUTER_API_KEY` on this computer. Answer checks use none.
|
|
26
|
+
- It reads eval tools' files as they are: OpenAI evals JSON lines; promptfoo configs and test files in YAML, JSON or CSV with `__expected` columns (the question from the var the prompt uses, `contains`, `icontains` and `equals` asserts as the answer check, `llm-rubric` as a judge, other asserts as comments); LangSmith dataset exports (`inputs`, `outputs` or `reference_outputs`); Braintrust datasets (`input`, `expected`, `metadata`); DeepEval goldens (`input`, `expected_output`); and Ragas datasets (`question` or `user_input`, `ground_truth` or `reference`).
|
|
27
|
+
- A CSV may name its columns anything, an Excel sheet saved as CSV among them: the import picks the question and expected-answer columns by their names and prints the ones it used, with the format it read.
|
|
28
|
+
- The same file gives the same tests every time. Importing again updates the tests it wrote and keeps any you edited; `--force` replaces those too. `--prefix <p>` puts `<p>-` before every id.
|
|
29
|
+
|
|
30
|
+
## Checks on the final answer
|
|
31
|
+
|
|
32
|
+
An `answer` check reads the agent's final answer: what it posts to `ANCHA_DONE_URL` as `{"output": …}` (`entry()` in `@ancha-labs/tools` posts what the agent returns), else an HTTP agent's reply, else the last block it prints on stdout (after its last blank line); `agent.answer` in `ancha.yaml` picks one. A JSON answer is read as `key: value` lines. Ancha grades it with no model, on this computer and in the cloud, so it uses no model credit.
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
checks:
|
|
36
|
+
- id: overdue-total
|
|
37
|
+
answer:
|
|
38
|
+
contains: [Kessler Industrial, INV-1043] # every piece; letters compare without case unless case: sensitive
|
|
39
|
+
numbers: [{ value: "48,200.50" }] # stated within ±0.005
|
|
40
|
+
not_contains: [I could not]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- `numbers` reads amounts as people write them: `1,240.00`, `$1,240`, `USD 1240`, `1,240.00 EUR`, `-1,240.00`, and `(1,240.00)` for a negative. A whole number in parentheses with no currency, such as `(5)`, counts as 5 or -5. Digits inside a word or an id (`Q3`, `INV-1043`) belong to that word. Write numbers in plain digits (`1240`, not `1.24e3`).
|
|
44
|
+
- Each number matches within `tolerance`, by default half the last decimal place of `value`: `"1,200.00"` allows ±0.005, `1240.5` ±0.05, `1200` ±0.5. Write `value` as text to keep trailing zeros, or set `tolerance`.
|
|
45
|
+
- An attempt with no final answer fails the check with "no final answer". `answer: {}` passes on any final answer.
|
|
46
|
+
- `trace: { called: "MCP <tool name>" }` checks a call to a tool on an MCP server, such as `MCP ns_runCustomSuiteQL` on NetSuite.
|
|
47
|
+
|
|
11
48
|
## Tests from a template
|
|
12
49
|
|
|
13
50
|
`ancha scene new my-scene --twins slack,okta` creates scene.yaml with a seed for every requested tool (the packaged template's for Slack, GitHub, Datadog and PagerDuty, the tool's example otherwise) and an access check where the reference companion can read the tool, plus oracle.ts/null.ts and dependency-free Node companions oracle.mjs/null.mjs. Choose a path-safe lowercase id. Unknown/duplicate twins and existing destinations are rejected. Scenes are strict YAML, not runtime includes.
|
package/lib/assets/docs/setup.md
CHANGED
|
@@ -17,6 +17,7 @@ Requirements: Node 24 or newer. Install once with `npm install -g @ancha-labs/cl
|
|
|
17
17
|
ancha init
|
|
18
18
|
```
|
|
19
19
|
- To name the command yourself: `ancha init --agent "<the command that starts your agent>"`.
|
|
20
|
+
- To name its tools yourself (NetSuite, Slack, ...): `ancha init --tools netsuite,slack`.
|
|
20
21
|
3. **Store the key it needs.** The agent's own model key, read from your shell, never from an argument: it is stored in your workspace and named under `agent.pass_env` in `ancha.yaml`, so the agent gets it in every cloud attempt.
|
|
21
22
|
```sh
|
|
22
23
|
ancha secrets set ANTHROPIC_API_KEY
|
|
@@ -26,7 +27,11 @@ Requirements: Node 24 or newer. Install once with `npm install -g @ancha-labs/cl
|
|
|
26
27
|
ancha agent upload
|
|
27
28
|
```
|
|
28
29
|
- The install follows the project's own manifests and lockfiles; `agent.install` in `ancha.yaml` sets the command instead.
|
|
29
|
-
5. **
|
|
30
|
+
5. **Without production traces.** For an agent that uses NetSuite, `ancha init` writes a NetSuite world of a private-equity portfolio company (four subsidiaries, two currencies, thousands of transactions) and 25 tests from the questions an operator asks.
|
|
31
|
+
- Your data: `ancha world import netsuite <your exports> --id <id>` reads REST record JSON, SuiteQL results and saved search CSV into `ancha/worlds/<id>.yaml`; check it with `ancha world validate`. To write the seed yourself, `ancha twins seed netsuite` lists its fields.
|
|
32
|
+
- Your evals: `ancha test import <file> --world <id>` (JSONL, JSON, CSV or YAML with a question and an expected answer).
|
|
33
|
+
- One test from a sentence: `ancha test new "<sentence>" --world <id>`.
|
|
34
|
+
6. **Upload traces.** A file or a folder of traces, runs that went fine and runs that failed: each trace becomes a test, in `scenes/from-traces/` and in your workspace.
|
|
30
35
|
```sh
|
|
31
36
|
ancha traces upload ./traces
|
|
32
37
|
```
|
|
@@ -34,10 +39,10 @@ Requirements: Node 24 or newer. Install once with `npm install -g @ancha-labs/cl
|
|
|
34
39
|
- A trace of a run that went wrong can say what went wrong: `ancha traces upload <trace file> --expect "<what went wrong>"`, or for a test already made, `ancha pull <test id> --expect "<what went wrong>"`.
|
|
35
40
|
- Traces your agent already sent to your workspace: `ancha traces`, then `ancha pull <trace id>`.
|
|
36
41
|
- A test lists what one trace cannot settle: answer with `ancha pull <test id> --answer <question>=<answer>`.
|
|
37
|
-
|
|
42
|
+
7. **Point the agent at the test's tools.** In a test, the agent calls Ancha instead of production:
|
|
38
43
|
- Its clients for Slack, GitHub and the other tools Ancha replicates take the URLs and credentials Ancha supplies: `ancha connect <tool>` prints the settings.
|
|
39
44
|
- Its own functions: wrap them with `wrapTools` from `@ancha-labs/tools` (`ancha.wrap_tools` in Python), or serve them over MCP.
|
|
40
|
-
|
|
45
|
+
8. **Run your tests.** Every test, each attempt on a fresh machine. The run grades each attempt check by check and ends with the link to its result.
|
|
41
46
|
```sh
|
|
42
47
|
ancha run
|
|
43
48
|
```
|
|
@@ -45,13 +50,13 @@ Requirements: Node 24 or newer. Install once with `npm install -g @ancha-labs/cl
|
|
|
45
50
|
- `--attempts <n>` sets how many attempts each test gets, `--concurrency <n>` how many run at once.
|
|
46
51
|
- `ancha wait <run id>` follows a run again from any terminal; `ancha explain <run id>` shows why a check failed.
|
|
47
52
|
- `ancha status` shows which of these steps your workspace has done.
|
|
48
|
-
|
|
53
|
+
9. **Fix the agent and keep the test.** Keep the failing run as the reference, fix the agent, and run again: exit 0 means every check passes and nothing regressed.
|
|
49
54
|
```sh
|
|
50
55
|
ancha baseline save before --from <run id>
|
|
51
56
|
ancha run --compare before
|
|
52
57
|
```
|
|
53
58
|
- Commit `scenes/from-traces/` so every run, in CI too, keeps it fixed.
|
|
54
|
-
|
|
59
|
+
10. **Run it on this computer.** While you develop, `ancha run --on local` runs the agent and its worlds on this computer, with the same checks.
|
|
55
60
|
```sh
|
|
56
61
|
ancha run --on local --attempts 1
|
|
57
62
|
```
|
|
@@ -63,10 +68,11 @@ Requirements: Node 24 or newer. Install once with `npm install -g @ancha-labs/cl
|
|
|
63
68
|
`ancha init --agent "node agent.mjs"`, with your own start command, writes:
|
|
64
69
|
- `ancha.yaml`: how to start the agent, how many trials, which tests;
|
|
65
70
|
- `scenes/starter/`: a starter test that checks the agent reaches each tool, with two reference companions (`oracle.mjs` passes, `null.mjs` makes no calls);
|
|
71
|
+
- for an agent that uses NetSuite, in a project with no tests and no `traces/` folder: `ancha/worlds/netsuite-pe-m.yaml`, the NetSuite books of a private-equity portfolio company, and 25 tests in `ancha/tests/` from the questions an operator asks (their evals in `ancha/evals/`). `--data netsuite-pe:s` or `--data netsuite-pe:l` writes another size, `--data none` leaves them out;
|
|
66
72
|
- `.claude/skills/ancha/SKILL.md` and an Ancha section in `AGENTS.md`, for coding agents;
|
|
67
73
|
- `.ancha/` in `.gitignore`: run history, traces and fake tokens never belong in git.
|
|
68
74
|
|
|
69
|
-
Init installs nothing, runs nothing and keeps every existing file. It reads `package.json`, `requirements.txt`, `pyproject.toml` and `Pipfile` to report the SDKs it recognizes. Without `--agent`, it finds the command that starts the agent and how the agent takes its task, and writes both to `ancha.yaml`. Your production traces make the tests for the agent's real job (`ancha traces upload ./traces`, `ancha docs traces`); `ancha docs scenes` writes more.
|
|
75
|
+
Init installs nothing, runs nothing and keeps every existing file; a starter test an earlier `ancha init` wrote, unedited since, follows the tools of this run. It reads `package.json`, `requirements.txt`, `pyproject.toml` and `Pipfile` to report the SDKs it recognizes, and prints the tools the agent uses with where each one showed: a dependency, or a variable its code reads. `ancha init --tools netsuite,slack` names them instead. Without `--agent`, it finds the command that starts the agent and how the agent takes its task, and writes both to `ancha.yaml`. Your production traces make the tests for the agent's real job (`ancha traces upload ./traces`, `ancha docs traces`); `ancha docs scenes` writes more.
|
|
70
76
|
|
|
71
77
|
`ancha run` runs tests in files; `ancha test run <id>` runs a saved test. `ancha test` lists its subcommands and these run commands, then exits 1; with `--json` it returns a `USAGE` error with the same guidance.
|
|
72
78
|
|