@ancha-labs/cli 0.4.4 → 0.4.5
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 +15807 -12075
- package/lib/assets/docs/cloud.md +1 -1
- package/lib/assets/docs/explain.md +1 -1
- package/lib/assets/docs/integrations.md +2 -2
- package/lib/assets/docs/playgrounds.md +3 -4
- package/lib/assets/docs/run.md +4 -4
- package/lib/assets/docs/setup.md +1 -1
- package/lib/assets/docs/tools.md +8 -6
- package/lib/assets/docs/traces.md +10 -8
- package/lib/assets/harbor/companion.mjs +10830 -7370
- package/lib/assets/ui/app.js +10 -7
- package/lib/mcp-entry.mjs +591 -290
- package/lib/worker.mjs +12466 -8964
- package/lib/world-server.mjs +10740 -7284
- package/package.json +1 -1
package/lib/assets/docs/cloud.md
CHANGED
|
@@ -12,7 +12,7 @@ The first line of every `ancha run` says where its worlds run and what the agent
|
|
|
12
12
|
|
|
13
13
|
## What runs where
|
|
14
14
|
|
|
15
|
-
- `ancha run`, `ancha doctor`, `ancha world up`, `ancha env`, `ancha sandbox` and `ancha replay` create their worlds on this computer, also when you're logged in. `--server-url`, `server.url` in `ancha.yaml` or `ANCHA_SERVER_URL` put them on that server instead, for example the hosted world server `https://app.ancha.io/t/<workspace>` (your agent still runs here; its tool URLs point at `…/t/<workspace>/e/<environment>/<tool>/…`). Local scene/test import through `--on cloud` is
|
|
15
|
+
- `ancha run`, `ancha doctor`, `ancha world up`, `ancha env`, `ancha sandbox` and `ancha replay` create their worlds on this computer, also when you're logged in. `--server-url`, `server.url` in `ancha.yaml` or `ANCHA_SERVER_URL` put them on that server instead, for example the hosted world server `https://app.ancha.io/t/<workspace>` (your agent still runs here; its tool URLs point at `…/t/<workspace>/e/<environment>/<tool>/…`). Local scene/test import through `--on cloud` is rejected before remote work.
|
|
16
16
|
- `ancha agent` (except `agent detect`), `ancha world list|show|create|update|archive`, `ancha test`, `ancha runs`, `ancha attempt` and `ancha explain <play_…>` run in the hosted workspace: they list and change the same agents, worlds, tests and runs as the console, and every JSON object they print names its `workspace`. `--local` keeps them on this project's `.ancha/`. `ancha playground` stays on this computer.
|
|
17
17
|
- `ancha agent add|update --cwd <dir>` uploads the folder first: the files git tracks or would add, without `.anchaignore` patterns, hidden files, dependencies or credential-like files, at most 200 MB.
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@ It reports, in order:
|
|
|
12
12
|
|
|
13
13
|
JSON keys: `runId`, `agentIssues` (each with `exit`, `exitCode`, `log`, `logTail`, and a `hint` when its log names a withheld variable), `harnessIssues`, `failures` (each with `check`, `expected`, `actual`, `explanation`, `traceExcerpt`, and when the world recorded them `kind`, `evidence` (each with `type`, `simAt`, `at`, `from`, `to`, `where`, `excerpt`), `conversation` and `people`), `coverageGaps` (each with `service`, `method`, `path`, `count`, the twin's `status` and `error`, and a `hint`), `agentEnvironment` (`target`, and for this computer `inherited`, `withheld` and `withheldInLogs`, the withheld variables a crashed agent's log names), and `gradingWarnings` when a check produced one.
|
|
14
14
|
|
|
15
|
-
A clean process exit doesn't mean the task passed, and an invalid trial isn't an agent failure. The reference companions (`oracle.mjs`, `null.mjs`) prove the scene and harness behave
|
|
15
|
+
A clean process exit doesn't mean the task passed, and an invalid trial isn't an agent failure. The reference companions (`oracle.mjs`, `null.mjs`) prove the scene and harness behave.
|
|
16
16
|
|
|
17
17
|
Fix the agent after reading the evidence, then prove the fix with `ancha run --compare before --json` against a saved reference: `ancha docs compare`.
|
|
18
18
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Configure native local clients
|
|
2
2
|
|
|
3
|
-
`ancha connect slack --lang ts`, `ancha connect github --lang ts`, `ancha connect datadog --lang ts` and `ancha connect pagerduty --lang ts` print native SDK local URL settings without calling APIs. Python Slack and GitHub use --lang py.
|
|
3
|
+
`ancha connect slack --lang ts`, `ancha connect github --lang ts`, `ancha connect datadog --lang ts` and `ancha connect pagerduty --lang ts` print native SDK local URL settings without calling APIs. Python Slack and GitHub use --lang py.
|
|
4
4
|
|
|
5
5
|
Ancha supplies SLACK_API_URL/SLACK_BOT_TOKEN; GITHUB_API_URL/GITHUB_TOKEN; DATADOG_API_URL/DD_API_KEY/DD_APP_KEY; and PAGERDUTY_API_URL/PAGERDUTY_API_TOKEN/PAGERDUTY_FROM_EMAIL/PAGERDUTY_ROUTING_KEY at trial time. These are fake runtime credentials for local twins. Never substitute ambient production credentials or remove the full service URL path. Inspect `ancha twins coverage <twin>` before selecting SDK operations.
|
|
6
6
|
|
|
@@ -10,4 +10,4 @@ PagerDuty PDJS requires a full local url for every REST request; its server opti
|
|
|
10
10
|
|
|
11
11
|
Gmail: Ancha supplies GMAIL_API_URL/GMAIL_ACCESS_TOKEN and GMAIL_ADDRESS, the mailbox's address (`ancha connect gmail --lang ts`). Google clients take the URL as each call's `rootUrl` (`GMAIL_API_URL + '/'`) or the app's own base-URL setting; push to the app follows its `users.watch` call (`ancha docs apps`).
|
|
12
12
|
|
|
13
|
-
Verify webhook signatures against exact raw request bytes before JSON parsing. Slack uses its signing secret, GitHub its webhook secret, PagerDuty its signing secret; Datadog's declared custom webhook profile uses a bearer token.
|
|
13
|
+
Verify webhook signatures against exact raw request bytes before JSON parsing. Slack uses its signing secret, GitHub its webhook secret, PagerDuty its signing secret; Datadog's declared custom webhook profile uses a bearer token.
|
|
@@ -32,7 +32,6 @@ ancha execution prepare --json
|
|
|
32
32
|
|
|
33
33
|
ancha agent add --name "My agent" --cwd /path/to/agent \
|
|
34
34
|
--command 'node agent.mjs' --state stateless --task-input command --container-image node:24-slim --json
|
|
35
|
-
ancha agent prepare <agent-id> --json
|
|
36
35
|
ancha agent connect <agent-id> --json
|
|
37
36
|
ancha world create --name "Support workspace" --tools slack,salesforce --json
|
|
38
37
|
ancha playground test create --name "Support checks" \
|
|
@@ -105,11 +104,11 @@ Command agents read `ANCHA_TASK`, use the supplied native tool URLs/fake credent
|
|
|
105
104
|
|
|
106
105
|
HTTP agents listen on `0.0.0.0` using `$ANCHA_AGENT_PORT`. Declare readiness/task paths and message/response fields; conversation-based agents can also declare a conversation-creation path. Ancha waits for readiness, delivers the task, captures its response and ends the process. Python images do not need Node inside the agent container.
|
|
107
106
|
|
|
108
|
-
Native clients must accept configurable base URLs. The attempt receives a connection manifest path (`ANCHA_CONNECTION_MANIFEST`), per-attempt native URLs and fake credentials, plus a Slack MCP URL when Slack is selected. Slack MCP exposes its declared operations against the same seeded state as native Slack APIs. These bindings are available to the agent process
|
|
107
|
+
Native clients must accept configurable base URLs. The attempt receives a connection manifest path (`ANCHA_CONNECTION_MANIFEST`), per-attempt native URLs and fake credentials, plus a Slack MCP URL when Slack is selected. Slack MCP exposes its declared operations against the same seeded state as native Slack APIs. These bindings are available to the agent process. The agent must register tools through the supported MCP loader or configure a native client. The supplied Node and synchronous Python/LangChain examples read the attempt manifest; Slack and GitHub expose contained MCP endpoints. Provider domains and credentials are explicit runtime settings.
|
|
109
108
|
|
|
110
109
|
Connection uses a project Dockerfile or supported Node/Python dependency manifests. Standard Node builds require a lockfile. Custom Dockerfile caching includes full build inputs; source changes are not assumed safe to ignore. Dependencies are built before restricted execution. Source capture is bounded to 512 MiB with path/file protections. A macOS virtual environment is not copied as a Linux runtime.
|
|
111
110
|
|
|
112
|
-
The workspace's provider-free **Playground sample** demonstrates task delivery, writes and isolation
|
|
111
|
+
The workspace's provider-free **Playground sample** demonstrates task delivery, writes and isolation.
|
|
113
112
|
|
|
114
113
|
## Execution boundaries
|
|
115
114
|
|
|
@@ -117,4 +116,4 @@ Harbor 0.25.0 manages attempts, concurrency, deadlines and teardown. Docker isol
|
|
|
117
116
|
|
|
118
117
|
Managed attempts use a read-only container root and a fresh **writable** in-memory `/workspace` source copy, plus separate scratch/state directories. The workspace size adapts to staged source size and the agent memory limit; these writes disappear after the attempt. This differs from the legacy contained runner's read-only source volume. See execution documentation before changing either contract.
|
|
119
118
|
|
|
120
|
-
Command and managed HTTP task input, native HTTP tools and Slack/GitHub MCP are supported.
|
|
119
|
+
Command and managed HTTP task input, native HTTP tools and Slack/GitHub MCP are supported. Existing manual sandboxes, scene commands and old reports remain available.
|
package/lib/assets/docs/run.md
CHANGED
|
@@ -26,11 +26,11 @@ agent:
|
|
|
26
26
|
|
|
27
27
|
By default the agent runs once per attempt with the task in `ANCHA_TASK`. When the world has people who reply later, set `agent.input: per_event`: Ancha runs the command once per event addressed to the agent (a DM, a mention, a thread it is in), with the event in `ANCHA_EVENT_JSON` and a one-line summary in `ANCHA_TASK`, one conversation at a time. Simulated time skips ahead while nobody is working, and the attempt ends when the world is quiet with nothing scheduled before the deadline.
|
|
28
28
|
|
|
29
|
-
`per_event` is supported by the local scene runner, including local container execution. Managed/Harbor execution rejects `per_event` and `events` with `CONFIG_INVALID` (exit 2)
|
|
29
|
+
`per_event` is supported by the local scene runner, including local container execution. Managed/Harbor execution rejects `per_event` and `events` with `CONFIG_INVALID` (exit 2). It never substitutes a one-shot command.
|
|
30
30
|
|
|
31
31
|
## Where the agent runs
|
|
32
32
|
|
|
33
|
-
`--on local` starts it as a process on this computer; `--on docker` uses the sealed container below (never a process instead). Without `--on`, `ancha.yaml` decides. `--on cloud`
|
|
33
|
+
`--on local` starts it as a process on this computer; `--on docker` uses the sealed container below (never a process instead). Without `--on`, `ancha.yaml` decides. `--on cloud` rejects local scene and version 2 test imports with `CONFIG_INVALID` (exit 2). It names unsupported files, fields and options before any upload or registration. Run these tests locally or in CI. Explicit saved-world tasks use `ancha runs start`; that is a separate managed-task contract.
|
|
34
34
|
|
|
35
35
|
`--upload` (or `ANCHA_UPLOAD=1`) sends the finished run to your workspace, where the console shows it; `ancha runs upload <run id | latest>` does that later. A failed upload is a warning unless `--upload-required`. `ancha docs cloud` says what is sent and what is redacted.
|
|
36
36
|
|
|
@@ -68,7 +68,7 @@ A trial ends when the agent exits, finishes explicitly, goes idle (event and HTT
|
|
|
68
68
|
|
|
69
69
|
## Background runs
|
|
70
70
|
|
|
71
|
-
`ancha run --detach --json` returns `run_detached` with a run id once its worker has started. `ancha status <id> --json` shows the lifecycle and counters; `ancha wait <id> --json` streams progress, then the final summary, and exits with the run's own exit code. `ancha logs <id> --follow` prints the run's NDJSON events as they happen and exits with the run's exit code. Pass the original `--out` to all three. Interrupting `wait` or `logs` stops only the observer. Detached runs survive the launching CLI
|
|
71
|
+
`ancha run --detach --json` returns `run_detached` with a run id once its worker has started. `ancha status <id> --json` shows the lifecycle and counters; `ancha wait <id> --json` streams progress, then the final summary, and exits with the run's own exit code. `ancha logs <id> --follow` prints the run's NDJSON events as they happen and exits with the run's exit code. Pass the original `--out` to all three. Interrupting `wait` or `logs` stops only the observer. Detached runs survive the launching CLI. A worker stopped with SIGTERM or SIGINT cleans up its agents and keeps partial artifacts; observers report a worker without a heartbeat for 15 seconds as an uncertain failure. Only completed runs update `latest`.
|
|
72
72
|
|
|
73
73
|
## Your own harness
|
|
74
74
|
|
|
@@ -89,6 +89,6 @@ ancha world down --env <envId>
|
|
|
89
89
|
|
|
90
90
|
`ancha agent add` saves a reusable agent profile that the local console (`ancha ui`) and the CLI share, for scenarios and playgrounds: `ancha agent verify ID --scene KEY`, `ancha agent run ID --scene KEY -n 1`, `ancha explain RUN_ID`, `ancha agent rerun RUN_ID`, and `ancha test save RUN_ID --name NAME` for a reusable test. See `ancha docs playgrounds` for running saved agents in containers with plain-language tasks.
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
Check `ancha twins coverage <tool>` and `ancha connect <tool>`. Keep provider keys out of scenes and saved configuration.
|
|
93
93
|
|
|
94
94
|
For managed `runs start`, invalid harness captures exit 3, failed/skipped/incomplete grading exits 1, and a stopped run exits 2. The grade line uses requested attempts and names invalid/skipped counts.
|
package/lib/assets/docs/setup.md
CHANGED
|
@@ -18,7 +18,7 @@ Requirements: Node 24 or newer. Install once with `npm install -g @ancha-labs/cl
|
|
|
18
18
|
4. `ancha explain latest --json` shows each failed check, what was expected, what happened, and the calls behind it.
|
|
19
19
|
5. `ancha baseline save before`, fix the agent, then `ancha run --compare before --json`. Exit 0 means every check passes and nothing regressed.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Replace it with scenes for the agent's real job: `ancha docs scenes`.
|
|
22
22
|
|
|
23
23
|
If the AI feature lives inside an app (a web app or API server with its database, workers and scheduled jobs), Ancha starts the app for each trial instead of a command: `ancha docs apps`.
|
|
24
24
|
|
package/lib/assets/docs/tools.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Run `ancha ui` in your project folder. Open **Tools**, choose **Create sandbox**, and select individual tools or an operations/revenue workspace preset. Every sandbox receives its own copy of the selected data. No scenario or pass/fail grade is required.
|
|
4
4
|
|
|
5
|
-
Open a tool to browse campaigns, CRM records, conversations or historical reports. **Connect agent** gives you local API addresses and fake credentials. Configure the agent's actual clients to use them, run the agent, then **Refresh** to see its changes and **Activity** to see its requests.
|
|
5
|
+
Open a tool to browse campaigns, CRM records, conversations or historical reports. **Connect agent** gives you local API addresses and fake credentials. Configure the agent's actual clients to use them, run the agent, then **Refresh** to see its changes and **Activity** to see its requests. **Reset** restores the tool data, including deterministic IDs; it does not clear files or memory in the agent's own project.
|
|
6
6
|
|
|
7
7
|
**Manage → Download setup** exports the exact configuration. A configuration contains versioned per-tool datasets and a preset with explicit cross-tool references. Edit an exported configuration to author another dataset; give changed shared data a new ID/version. Existing sandboxes retain their original inputs. The Salesforce and HubSpot presets are alternative CRM representations of the same fictional business; linked identities are data, not automatic synchronization between vendors.
|
|
8
8
|
|
|
@@ -43,21 +43,23 @@ Use `--server-url <origin>` to target another local server. `ancha ui --server-u
|
|
|
43
43
|
|
|
44
44
|
Run `ancha connect <tool> --lang ts` for the selected native HTTP setup. Google Ads also qualifies `--lang py` using the official Python client with a local TLS gRPC endpoint and the supplied test certificate. These connection overrides are necessary; changing only a model provider key does not connect tool clients.
|
|
45
45
|
|
|
46
|
-
The new tools are LinkedIn Ads (202610), Salesforce (REST v67.0), Gong (v2), Google Ads (v26), ChatGPT Ads (Advertiser API v1), HubSpot (CRM v3), and Google Analytics (Data API v1beta REST). `ancha twins coverage <tool> --json` lists each one's supported operations
|
|
46
|
+
The new tools are LinkedIn Ads (202610), Salesforce (REST v67.0), Gong (v2), Google Ads (v26), ChatGPT Ads (Advertiser API v1), HubSpot (CRM v3), and Google Analytics (Data API v1beta REST). `ancha twins coverage <tool> --json` lists each one's supported operations. Slack, GitHub, Datadog, PagerDuty and Open-Meteo are available too.
|
|
47
|
+
|
|
48
|
+
**NetSuite** (SuiteTalk REST record v1 and SuiteQL): customers, vendors, items, sales orders, invoices, credit memos, customer payments, vendor bills, bill payments and journal entries. Run `ancha connect netsuite --lang ts` (or `--lang py`). Point the client at `NETSUITE_API_URL` instead of `https://{account}.suitetalk.api.netsuite.com`; use `NETSUITE_RECORD_URL` for records and `NETSUITE_SUITEQL_URL` for queries. Send `NETSUITE_ACCESS_TOKEN` as a Bearer token, or sign OAuth 1.0 TBA requests with HMAC-SHA256 using `NETSUITE_ACCOUNT_ID` as realm and `NETSUITE_CONSUMER_KEY`, `NETSUITE_CONSUMER_SECRET`, `NETSUITE_TOKEN_ID` and `NETSUITE_TOKEN_SECRET`. SuiteQL POSTs need `Prefer: transient` and a JSON body containing `q`; record creates return 204 with a `Location` header.
|
|
47
49
|
|
|
48
50
|
Some replicas are measured against their vendor's own OpenAPI description: the official SDK calls every endpoint the replica claims and each response is checked. `ancha twins list --json` gives those replicas a `conformance` object (`claimed`, `exercised`, `sdkCalls`, `sdkFailures`, `mismatches`, `accepted`, and the pinned `source` descriptions); a difference is `accepted` only with a written reason. `ancha twins coverage <tool>` prints the same numbers under its table.
|
|
49
51
|
|
|
50
|
-
One coherent synthetic dataset per tool is the starting point. Reporting data is historical; changing a budget does not manufacture new impressions, leads or revenue. Delayed transcripts, review decisions, search visibility and reporting rows follow explicit deterministic mock rules. **+2 min** advances that simulated availability; it does not purchase or deliver advertising.
|
|
52
|
+
One coherent synthetic dataset per tool is the starting point. Reporting data is historical; changing a budget does not manufacture new impressions, leads or revenue. Delayed transcripts, review decisions, search visibility and reporting rows follow explicit deterministic mock rules. **+2 min** advances that simulated availability; it does not purchase or deliver advertising.
|
|
51
53
|
|
|
52
54
|
## MCP and fresh attempts
|
|
53
55
|
|
|
54
56
|
For Slack, **Connect agent → MCP** offers copy/download host configuration. The same command is `ancha mcp config --sandbox <id>`; it outputs an `mcpServers` configuration pointing to this exact CLI installation and local server. Merge that entry into your MCP host settings. Hosts with a different configuration shape can use its `command` and `args` fields directly. No production Slack credential is required.
|
|
55
57
|
|
|
56
|
-
`ancha mcp serve --sandbox <id> --server-url http://127.0.0.1:4400` is an MCP stdio process. Do not append `--json`: stdout is reserved for the protocol. The pinned official TypeScript SDK implements framing and negotiation. `ancha-slack-v1` exposes 19 named `slack_*` operations for channels, messages, threads, reactions and users. These call the same native API and generate the same trace. Native errors return tool errors; nonexistent tools return protocol errors. The profile exposes no reset, destroy, evaluation or arbitrary-URL capability.
|
|
58
|
+
`ancha mcp serve --sandbox <id> --server-url http://127.0.0.1:4400` is an MCP stdio process. Do not append `--json`: stdout is reserved for the protocol. The pinned official TypeScript SDK implements framing and negotiation. `ancha-slack-v1` exposes 19 named `slack_*` operations for channels, messages, threads, reactions and users. These call the same native API and generate the same trace. Native errors return tool errors; nonexistent tools return protocol errors. The profile exposes no reset, destroy, evaluation or arbitrary-URL capability.
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
It supports plain-text message writes. The native Slack API separately supports its documented blocks and HTTP/Socket event delivery in managed trials.
|
|
59
61
|
|
|
60
|
-
For managed agent attempts, Ancha provides a private `ANCHA_CONNECTION_MANIFEST` path and per-attempt service variables; Slack additionally provides `SLACK_MCP_URL`/`ANCHA_MCP_URL` when selected.
|
|
62
|
+
For managed agent attempts, Ancha provides a private `ANCHA_CONNECTION_MANIFEST` path and per-attempt service variables; Slack additionally provides `SLACK_MCP_URL`/`ANCHA_MCP_URL` when selected. The agent must explicitly connect to Slack MCP or configure a supported native client. Inspect captured tool activity.
|
|
61
63
|
|
|
62
64
|
**Manage → Create fresh copy** and `sandbox fork <id>` copy the original configuration and seed, excluding exploratory mutations. `--count 10` allocates ten separate worlds; it does not launch agents. For graded repetition, use **Agents → Run scenario** or `ancha agent run` / `ancha test run` with the existing scenario runner. An empty checklist in an exploratory sandbox is never agent success.
|
|
63
65
|
|
|
@@ -9,7 +9,7 @@ A run of the agent in production becomes a test: the conversation it had, the ca
|
|
|
9
9
|
- After `ancha login`, `ancha import <trace file>` sends the trace to the workspace, which saves the test and writes it here; a conversation that makes no test is listed with the reason, and the import goes on with the rest. When the agent sends its traces to the workspace, each becomes a test there: `ancha pull --all --json` writes every test that is turned on (`--agent <name>` for one agent's), `ancha traces --failed --json` lists the runs where production failed a check, `ancha traces show <id> --json` previews a test and `ancha pull <id> --json` writes one.
|
|
10
10
|
- `--expect "<what went wrong>"` adds a check for it, `--conversation <id>` takes one conversation of the file, `--dest <dir>` sets the folder (default `scenes/from-traces`) and `--force` replaces a `scene.yaml` that is already there.
|
|
11
11
|
|
|
12
|
-
Each test is a folder, `scenes/from-traces/trace-<id>/`: `scene.yaml` (the trigger or the customer, the tools, the checks), `observations.jsonl` (production's calls with their answers), `production.jsonl` (production's run), `production.json` (each check's result in production), `provenance.json` and `questions.json`.
|
|
12
|
+
Each test is a folder, `scenes/from-traces/trace-<id>/`: `scene.yaml` (the trigger or the customer, the tools, the checks), `observations.jsonl` (production's calls with their answers), `production.jsonl` (production's run), `production.json` (each check's result in production), `provenance.json` and `questions.json`. Beside the tests, `records.jsonl` holds what the tools answered before anything changed, one record per line (`type`, `id`, `record`), merged over every conversation imported into the folder on this computer.
|
|
13
13
|
|
|
14
14
|
## Answer its questions
|
|
15
15
|
|
|
@@ -20,6 +20,7 @@ The import lists the questions the trace leaves open, each with the default the
|
|
|
20
20
|
- `tools.mcp`: the tools the agent reaches over MCP, served at `{{tools.mcp_url}}`. The agent wraps the others: `wrapTools` from `@ancha-labs/tools`, `ancha.wrap_tools` in Python.
|
|
21
21
|
- `tools.simulate_writes`: the writes a test simulates when the agent makes one production never made; the others fail.
|
|
22
22
|
- `tools.pure`: tools that only compute from their arguments; a test runs them itself.
|
|
23
|
+
- `tools.run`: tools that can run their own code in a test, over a store the agent fills from `records.jsonl`. Production's answers are replayed until something changes; a call production never made, a write, and every call after a write run the tool itself. It also lists the tools the agent's model was given that production never called; a test does not require the agent to wrap those.
|
|
23
24
|
- `checks.success`: what the agent should have done, when nothing in the trace says what went wrong.
|
|
24
25
|
- `github.members.<org>`: who was a member of the GitHub organization when the run started, as logins or `none`. The import asks when the agent removed someone's direct access to the organization's repositories; a member keeps read access to all of them.
|
|
25
26
|
|
|
@@ -29,16 +30,17 @@ In a project without `ancha.yaml`, run `ancha init --agent "<the command that st
|
|
|
29
30
|
|
|
30
31
|
`ancha run scenes/from-traces/*/scene.yaml --json`
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
The agent gets the path of `records.jsonl` as `ANCHA_RECORDS`. For the tools in `tools.run`, fill their store from it when the agent starts.
|
|
34
|
+
|
|
35
|
+
Before the trials, `ancha run` computes production's result for each check from `production.jsonl`. After them, it compares the run with production check by check and says whether production's failure happened again. Checks a model grades need `OPENROUTER_API_KEY`; without it, `ancha run` stops before the first trial when a test's `pass` lists one. The agent's writes are compared by tool, with no model. A run where the agent refunds another customer's order, as it did in production:
|
|
33
36
|
|
|
34
37
|
```text
|
|
35
|
-
compared with production (trace
|
|
36
|
-
|
|
37
|
-
=>
|
|
38
|
+
compared with production (trace 7d2f91c4a0e6): trace-2760b5c5
|
|
39
|
+
no_refund_for_another_customer failed in production · failed 3/3 here
|
|
40
|
+
=> production's failure happens here too
|
|
41
|
+
answers to the agent's tools: 6 replayed
|
|
38
42
|
writes compared with production:
|
|
39
|
-
|
|
40
|
-
create_support_ticket production: called this run: 0 of 1 trial
|
|
41
|
-
mark_resolved production: called this run: 0 of 1 trial
|
|
43
|
+
refund_order production: called this run: 3 of 3 trials
|
|
42
44
|
```
|
|
43
45
|
|
|
44
46
|
When a test doesn't fail the way production did, `ancha traces diff <trace file> latest/trial-<scene>-1` lists the calls only production made, the calls only the trial made, and the first call where they part.
|