@oxy-hq/cli 0.12.1 → 0.14.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.
- package/README.md +1031 -71
- package/dist/main.mjs +21844 -4166
- package/dist/main.mjs.map +1 -1
- package/dist/{mcp-CJWQm-yd.mjs → mcp-bxf7JBJu.mjs} +2 -2
- package/dist/mcp-bxf7JBJu.mjs.map +1 -0
- package/json-schemas/agent-test.json +116 -3
- package/json-schemas/agentic.json +81 -1
- package/json-schemas/config.json +2 -1
- package/json-schemas/flow-test.json +11 -2
- package/json-schemas/topic.json +252 -0
- package/json-schemas/view.json +473 -0
- package/package.json +9 -5
- package/skills/oxy-agents/SKILL.md +98 -54
- package/skills/oxy-agents/references/quick-reference.md +22 -20
- package/skills/oxy-agents/templates/agentic-template.yml +34 -90
- package/skills/oxy-airway-pipelines/SKILL.md +35 -2
- package/skills/oxy-automations/SKILL.md +42 -28
- package/skills/oxy-cli/SKILL.md +15 -7
- package/skills/oxy-custom-apps/SKILL.md +413 -7
- package/skills/oxy-custom-apps/references/app-calls.md +98 -0
- package/skills/oxy-custom-apps/references/phone-layout.md +16 -2
- package/skills/oxy-custom-apps/references/sandbox-agent-loop.md +8 -8
- package/skills/oxy-evals/SKILL.md +112 -46
- package/skills/oxy-evals/references/diagnosis.md +18 -21
- package/skills/oxy-evals/references/results-json.md +30 -18
- package/skills/oxy-evals/references/writing-expected.md +5 -4
- package/skills/oxy-experiments/SKILL.md +4 -3
- package/skills/oxy-semantic-modeling/SKILL.md +14 -12
- package/template/.claude/hooks/oxyc-cloud-session.sh +40 -8
- package/template/.github/workflows/publish.yaml +5 -5
- package/template/.github/workflows/validate.yaml +125 -199
- package/template/README.md +50 -21
- package/template/_gitignore +4 -4
- package/template/config.yml +2 -2
- package/dist/mcp-CJWQm-yd.mjs.map +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# One app calling another
|
|
2
|
+
|
|
3
|
+
An app's function can call a function of another app in the same organization, and wait for the answer (`ctx.apps.call`) or just queue the call (`ctx.apps.send`). Use it when another app owns the data or the rule: ask it, instead of copying its tables.
|
|
4
|
+
|
|
5
|
+
## Declare it on both sides
|
|
6
|
+
|
|
7
|
+
The callee marks the function callable. Nothing else about the function changes; it stays an ordinary function with its own routes, schedule and timeout.
|
|
8
|
+
|
|
9
|
+
```jsonc
|
|
10
|
+
// locations/oxy-app.json
|
|
11
|
+
{ "functions": { "lookup": { "callable": true } } }
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The caller lists every (app, function) pair it may call, at the top level of its own `oxy-app.json`. Keys are app slugs, values are non-empty lists of function names with no repeats, 64 pairs at most in total.
|
|
15
|
+
|
|
16
|
+
```jsonc
|
|
17
|
+
// orders/oxy-app.json
|
|
18
|
+
{ "calls": { "locations": ["lookup"] } }
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`oxyc validate` checks the shape. `oxyc publish` warns, and does not fail, when a declared target does not exist yet or is not `callable`, so two apps can ship in either order; the call itself fails until both sides are live.
|
|
22
|
+
|
|
23
|
+
## Call it
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { isAppCallError } from "@oxy-hq/sdk/apps";
|
|
27
|
+
|
|
28
|
+
const place = await ctx.apps.call<{ id: string; name: string }>(
|
|
29
|
+
"locations", "lookup", { code }, { timeoutMs: 5000 }
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const { eventId } = await ctx.apps.send("billing", "charge", { orderId }, { key: orderId, delaySeconds: 30 });
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- `call<T>(app, fn, body?, { timeoutMs? })` returns the callee's JSON answer. `send(app, fn, body?, { delaySeconds?, key? })` returns `{ eventId }` at once; the same `key` is the same send.
|
|
36
|
+
- Body and answer are JSON, under the existing request body limit.
|
|
37
|
+
- A `send` made on a token that expires is refused (`AppCallRefused`) when `delaySeconds` would run to or past that expiry, since the delivery would find the credential gone and kill the send. The message names the delay and says the credential this run is on expires first: shorten the delay. A login session, a token that never expires and a run as the system are not limited this way.
|
|
38
|
+
- Using `ctx.apps` with no top-level `calls`, or on a pair `calls` does not list, is refused (`AppsCapabilityMissing`, `AppCallRefused`). `oxyc validate` and `oxyc publish` lint literal calls for both.
|
|
39
|
+
|
|
40
|
+
## Same environment, never production by fallback
|
|
41
|
+
|
|
42
|
+
Production calls the target's production build, staging calls its staging build, and a sandbox calls the target's same sandbox. A call never falls back to production: if the target has nothing deployed in that environment it fails with `not_deployed`.
|
|
43
|
+
|
|
44
|
+
## Identity: the callee runs as itself
|
|
45
|
+
|
|
46
|
+
A `call` made while a person is behind the chain runs as that person: `ctx.user` is them, with their role, teams and reach resolved again for the callee's app, and the platform first checks they may open the target app (a member who cannot open an app restricted to a team cannot reach it through yours). A call from a background run (a schedule, an event, a webhook) runs as the system identity, as those runs do. A `send` is delivered later, as the same person when one sent it: the platform checks again, at delivery, that the credential they sent it with is still valid (a revoked or expired token fails) and that they may open the target app, and if not the delivery dies with a `sender_refused` error and your function never runs. A `send` from a background run is delivered as the system identity (`ctx.user.kind === "system"`). `ctx.caller` says who called, for attribution and logs only:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
ctx.caller; // null, or { app, function, invocationId, actor }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`ctx.caller` is `null` unless another app's call or send started this invocation. `actor` is the person behind a `call` or a delivered `send` (their id), or `null` when no person was behind it.
|
|
53
|
+
|
|
54
|
+
## Errors
|
|
55
|
+
|
|
56
|
+
A failed call throws `AppCallError` from `@oxy-hq/sdk/apps`, with `.kind`, `.message` (the text) and `.hostMessage` (the host's whole `<Label>: <text>`):
|
|
57
|
+
|
|
58
|
+
| `kind` | Meaning |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| `refused` | Your manifest does not declare the call, or the names are empty. |
|
|
61
|
+
| `not_found` | No such app or function. |
|
|
62
|
+
| `not_callable` | The function exists but is not marked `callable`. |
|
|
63
|
+
| `not_deployed` | The target has no build in this environment. |
|
|
64
|
+
| `timeout` | The budget ran out before an answer. |
|
|
65
|
+
| `failed` | The callee threw or answered an error; its message is passed through, cut to 500 characters. |
|
|
66
|
+
| `busy` | The target could not take the call right now; retry later. |
|
|
67
|
+
| `depth_exceeded` | The chain of calls and events is more than 8 deep. |
|
|
68
|
+
| `cycle` | The target function is already on this chain of synchronous calls (A.f → B.g → A.f); the message names the chain. A call into a different function of an app already on the chain is allowed. |
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
try {
|
|
72
|
+
await ctx.apps.call("locations", "lookup", { code });
|
|
73
|
+
} catch (e) {
|
|
74
|
+
if (isAppCallError(e) && e.kind === "not_found") return Response.json({}, { status: 404 });
|
|
75
|
+
throw e;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Limits
|
|
80
|
+
|
|
81
|
+
- **Depth 8**, shared with events: a call made by a function that an event or another call started counts one deeper, and a chain past 8 is refused with `depth_exceeded`.
|
|
82
|
+
- **Budget**: the callee's timeout is the smallest of your `timeoutMs`, the callee function's own `timeoutSeconds`, and what is left of the caller's time.
|
|
83
|
+
- Each call is its own invocation (mode `call`), with the caller's invocation as its parent: `oxyc invocations list` shows `parent <id>` on it and `--json` carries `parent_invocation_id`.
|
|
84
|
+
|
|
85
|
+
## Not supported
|
|
86
|
+
|
|
87
|
+
- Reading another app's OLTP records, or a transaction shared across apps. Call a function of the owning app that does the read, and return what you need.
|
|
88
|
+
|
|
89
|
+
## Testing
|
|
90
|
+
|
|
91
|
+
`createTestContext` from `@oxy-hq/sdk/testing` takes `apps` (handlers keyed `"<app>/<function>"`) and `caller`. A call with no handler throws `not_found`; the declared-pair rules are enforced as in production; `state.apps.sent` lists each `send`.
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
const t = createTestContext(manifest, {
|
|
95
|
+
function: "place",
|
|
96
|
+
apps: { "locations/lookup": () => ({ id: "l1", name: "Main" }) },
|
|
97
|
+
});
|
|
98
|
+
```
|
|
@@ -44,8 +44,8 @@ with breakpoints until it "fits": the desktop and TV layout must not move.
|
|
|
44
44
|
| --- | --- |
|
|
45
45
|
| Tabs, a sidebar, a section switcher | `PhoneTabBar` at the bottom: up to five; past five it shows four and a More sheet |
|
|
46
46
|
| The page | `PhonePage` with `tabBar` (and `stickyAction`); pass the tab id as `scrollKey` |
|
|
47
|
-
| KPI cards | `PhoneKpiStrip`, two per row, first on the screen |
|
|
48
|
-
| A table | `PhoneCardList` of `PhoneCard`s: the row's name, a status pill, two or three key figures; a `summary` line on top. **Never a sideways-scrolling table.** |
|
|
47
|
+
| KPI cards | `PhoneKpiStrip`, two per row, first on the screen (`oddLastAcross`, SDK ≥ 2.32: an odd last tile takes the row); a `StatGrid` of `Stat`s takes `phonePairs` for the same |
|
|
48
|
+
| A table | `PhoneCardList` of `PhoneCard`s: the row's name, a status pill, two or three key figures; a `summary` line on top. A desk `PanelTable` takes `phoneCard` instead (SDK ≥ 2.32): the same rows as cards, every figure kept. **Never a sideways-scrolling table.** |
|
|
49
49
|
| A row's action button (Post, Approve) | the card's `trailing`, or `PhoneStickyAction` for the screen's one main action |
|
|
50
50
|
| A detail panel, drawer or modal | `PhoneSheet` (full screen, Back). The phone's Back closes it through `onClose` and the page stays put; a sheet that opened by pushing its own entry (a route, `?item=`) passes `historyEntry={false}` |
|
|
51
51
|
| A list of things that need someone | `PhoneSection` of `PhoneRow`s with a `tone` dot |
|
|
@@ -78,6 +78,20 @@ history and settings come after, or behind a tab.
|
|
|
78
78
|
- Use the kit's colours (it follows your theme tokens and a `.dark` ancestor)
|
|
79
79
|
rather than hard-coded ones, so light and dark both work. Its corners follow
|
|
80
80
|
`--radius` (at `0`, square, with only status dots round) and its text `--font-sans`.
|
|
81
|
+
- **Take the look from `@oxy-hq/sdk/theme.css`** (SDK 2.29 and later), the reference
|
|
82
|
+
app's design and the standard for every custom app. Import it above your own CSS and
|
|
83
|
+
the kit and shell draw square corners, frame lines on the subtle line, 44px touch
|
|
84
|
+
targets and one font with the app, with no rules of your own. Don't restyle the kit
|
|
85
|
+
with `!important` corner rules or `--oxy-shell-*` overrides: delete them when you
|
|
86
|
+
import the theme, because the theme's names are read first and those rules only
|
|
87
|
+
fight it.
|
|
88
|
+
- Leave the kit's widths to it (SDK 2.29 and later). `PhoneSegmented` keeps every
|
|
89
|
+
label whole: a long label takes its width, and a row too wide scrolls with a fade,
|
|
90
|
+
the selected option in view. A `PhoneCard` figure's value wraps or ends in an
|
|
91
|
+
ellipsis, never cut through a glyph, and with the theme a card has one figure column
|
|
92
|
+
per figure. A rule of your own on `.oxy-phone-segmented` columns or option padding,
|
|
93
|
+
or on `.oxy-phone-card__figures` columns, outranks the kit and brings the cut back:
|
|
94
|
+
delete it.
|
|
81
95
|
|
|
82
96
|
## Checking it
|
|
83
97
|
|
|
@@ -43,18 +43,18 @@ oxyc tokens create --sandbox-agent --app <org>/<app> --env <deployment>
|
|
|
43
43
|
- **Where no browser can reach your machine** (a cloud container, a CI job, a
|
|
44
44
|
remote box), add `--no-browser`. `oxyc` prints a URL and an eight-letter
|
|
45
45
|
code on stderr instead of opening a page, and waits up to ten minutes. Give
|
|
46
|
-
your engineer
|
|
47
|
-
in
|
|
46
|
+
your engineer the URL: it carries the code, so opening it on any device
|
|
47
|
+
where they are signed in and approving is the whole step (the bare page plus
|
|
48
|
+
the code is the fallback for a device the link cannot reach). The token is printed
|
|
48
49
|
exactly as above. The rule does not change: never open or approve that page
|
|
49
50
|
yourself, with a browser tool or any other way.
|
|
50
51
|
- **Name who approves with `--approver <email>`** (or `OXY_APPROVER`, which
|
|
51
52
|
counts with `--no-browser`, `oxyc login --no-wait` or in a cloud session, never
|
|
52
|
-
where oxyc only detected SSH or a Codespace), with the device code: the engineer is told by push, email and Slack
|
|
53
|
-
the
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
the page yourself.
|
|
53
|
+
where oxyc only detected SSH or a Codespace), with the device code: the engineer is told by push, email and Slack. The notice has no
|
|
54
|
+
code, so still send them the URL from your output, which carries it. Use the
|
|
55
|
+
email your engineer gave you. Only that person can open the request: if you
|
|
56
|
+
were given no address, omit the flag and hand them the URL as before. Never
|
|
57
|
+
open or click the page yourself.
|
|
58
58
|
- **Evaluate that line and work with the token.** In a shell that persists:
|
|
59
59
|
`eval "$(oxyc tokens create --sandbox-agent --app <org>/<app> --env <deployment>)"`.
|
|
60
60
|
In one that does not, such as an agent's shell tool, redirect it to
|
|
@@ -7,7 +7,8 @@ description: >-
|
|
|
7
7
|
my agent", "bootstrap an eval suite", "fill in expected answers", "run the tests"; and the
|
|
8
8
|
repair side: "tests are failing", "this test is flaky", "the agent's answer is wrong", "the
|
|
9
9
|
answer should be X but the agent says Y", "debug this eval", "make this test pass", or pasted
|
|
10
|
-
`
|
|
10
|
+
`oxyc evals run --output-json` output (or an older `oxy test --output-json` file) or a
|
|
11
|
+
prompt/response pair to diagnose. Drafts expected answers
|
|
11
12
|
from observed runs, then diagnoses failures and repairs the agent's semantic model, context and
|
|
12
13
|
instructions — never the test.
|
|
13
14
|
---
|
|
@@ -15,8 +16,8 @@ description: >-
|
|
|
15
16
|
# Oxy evals: draft, run, diagnose, repair
|
|
16
17
|
|
|
17
18
|
An Oxy eval is a `.test.yml` file: a list of prompts, each with the answer a correct agent
|
|
18
|
-
gives. `
|
|
19
|
-
whether each answer carries the expected facts.
|
|
19
|
+
gives. `oxyc evals run` has the Oxy deployment run the target agent on every prompt several
|
|
20
|
+
times and ask an LLM judge whether each answer carries the expected facts.
|
|
20
21
|
|
|
21
22
|
Drafting the tests and repairing the agent are one loop:
|
|
22
23
|
|
|
@@ -35,13 +36,15 @@ Reference docs (field tables, CI usage):
|
|
|
35
36
|
|
|
36
37
|
## What can be tested
|
|
37
38
|
|
|
38
|
-
- **Only `.agentic.yml` agents.**
|
|
39
|
+
- **Only `.agentic.yml` agents.** The eval engine rejects any other target, including classic
|
|
39
40
|
`.agent.yml` agents (that runtime was removed). Inline `tests:` blocks inside agent or
|
|
40
41
|
automation files are gone too. A `.test.yml` file is the only entry point.
|
|
41
42
|
- **Only the final answer text is judged.** The judge sees the question, `expected`, and the
|
|
42
43
|
agent's answer. It doesn't see the SQL, the tool calls, or the rows.
|
|
43
|
-
-
|
|
44
|
-
|
|
44
|
+
- **Behaviour is checked separately, by an `expect:` block** (see "Behaviour checks" below):
|
|
45
|
+
whether the agent asked a clarifying question, drew a chart, hit a pre-aggregation, which
|
|
46
|
+
source its answer's query came from, and which tools it called. These are read from the
|
|
47
|
+
run's events, not judged. `tool: <name>` on a case is shorthand for `expect.tools: [<name>]`.
|
|
45
48
|
|
|
46
49
|
## The `.test.yml` format
|
|
47
50
|
|
|
@@ -64,11 +67,14 @@ cases:
|
|
|
64
67
|
Rules the parser enforces:
|
|
65
68
|
|
|
66
69
|
- **Unknown keys are rejected at every level** (file, `settings`, each case). A typo such as
|
|
67
|
-
`judge-model:` or `
|
|
68
|
-
|
|
69
|
-
is skipped silently.** It just isn't in the run, with no error.
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
`judge-model:` or `expects:` makes the file fail to parse. Run it by path and
|
|
71
|
+
`oxyc evals run` exits `6` with `Failed to deserialize test config …`. **Run with no file
|
|
72
|
+
and a broken file is skipped silently.** It just isn't in the run, with no error. A file
|
|
73
|
+
that isn't valid YAML, or has no `cases:` list, isn't compiled at all, so by path it answers
|
|
74
|
+
exit `5` (not in the served revision), as if it had never been pushed. After pushing a test
|
|
75
|
+
file, run it by path once.
|
|
76
|
+
- **`prompt` is required, and so is `expected`** unless the case has an `expect:` block (or
|
|
77
|
+
`tool:`): such a case can be graded on its behaviour alone. Everything else is optional.
|
|
72
78
|
- **`target`** is resolved from the project root (the directory holding `config.yml`). If you
|
|
73
79
|
omit it, it's inferred from the filename, in the same directory: `sales.agentic.test.yml`
|
|
74
80
|
targets `sales.agentic.yml` beside it. Tests kept in a separate `tests/` folder must set
|
|
@@ -79,9 +85,43 @@ Rules the parser enforces:
|
|
|
79
85
|
be resolved from project config`). Google/Gemini models can't be used. Prefer a judge from a
|
|
80
86
|
different model family than the agent's, to avoid self-preference bias.
|
|
81
87
|
|
|
88
|
+
### Behaviour checks (`expect:`)
|
|
89
|
+
|
|
90
|
+
An optional per-case block. Every field is optional; a case fails when any field it sets is
|
|
91
|
+
unmet, and the record names each unmet one in `unmet_expectations` (and at the end of `cot`).
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
cases:
|
|
95
|
+
- name: ambiguous-region
|
|
96
|
+
prompt: What were sales in the region?
|
|
97
|
+
expect:
|
|
98
|
+
asks_user: true # the run must stop on a clarifying question
|
|
99
|
+
- name: weekly-revenue-chart
|
|
100
|
+
prompt: Chart weekly revenue for November 2025
|
|
101
|
+
expected: A weekly revenue series for November 2025
|
|
102
|
+
expect:
|
|
103
|
+
chart: true # a chart was drawn (a plain table does not count)
|
|
104
|
+
preagg: true # a successful query was served from a pre-aggregation
|
|
105
|
+
query_source: semantic # the answer's query: semantic | llm | vendor | verified_sql
|
|
106
|
+
tools: [query] # tools that must be called, by the runtime's own names
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
- **A case with `expect:` and no `expected` is not judged.** It passes on its expectations
|
|
110
|
+
alone.
|
|
111
|
+
- **`asks_user: true`** makes a clarifying question a graded outcome: the question becomes the
|
|
112
|
+
record's `actual_output`, the answer text is not judged, and the case passes. A run that
|
|
113
|
+
answers instead fails. Without it, a question is still a run error.
|
|
114
|
+
- **Evals run an agent on react by default**, as chats do. An agent react cannot serve (no
|
|
115
|
+
database, `semantic_only` with no views, a database with no read-only connection) runs on
|
|
116
|
+
the older FSM runtime instead, and `runtime: fsm` in the `.agentic.yml` pins it there;
|
|
117
|
+
each record's `runtime` (`react` or `fsm`) says which one ran. Tool names differ between the
|
|
118
|
+
two, so prefer the flags to `tools:` when a case must hold for both.
|
|
119
|
+
- What the run did is in every agentic record's `observed` object, met or not; check it when
|
|
120
|
+
writing an expectation.
|
|
121
|
+
|
|
82
122
|
Naming and placement: `<agent-stem>.<topic>.test.yml` (for example
|
|
83
|
-
`sales.performance.test.yml`) in the folder the project already uses for tests.
|
|
84
|
-
|
|
123
|
+
`sales.performance.test.yml`) in the folder the project already uses for tests. With no file,
|
|
124
|
+
`oxyc evals run` runs every `*.test.yml` the workspace compiled, except under hidden
|
|
85
125
|
(dot-prefixed) directories and `target/`, `node_modules/`, `dist/` or `build/`.
|
|
86
126
|
|
|
87
127
|
## When to write evals
|
|
@@ -102,7 +142,8 @@ Naming and placement: `<agent-stem>.<topic>.test.yml` (for example
|
|
|
102
142
|
- **Make prompts specific enough to answer without a follow-up question.** Tests run
|
|
103
143
|
headless. If the agent stops to ask the user something, the run ends as an **error**
|
|
104
144
|
(`agentic pipeline asked a clarifying question: …`), which counts as a FAIL. An ambiguous
|
|
105
|
-
prompt shows up as a run error, not as a wrong answer.
|
|
145
|
+
prompt shows up as a run error, not as a wrong answer. The exception is a case written to
|
|
146
|
+
test exactly that, with `expect: {asks_user: true}`.
|
|
106
147
|
- **Test one thing per case.** "Revenue by region and the top product in each" is two cases.
|
|
107
148
|
- **Name every case** (`name:`), with a short stable slug.
|
|
108
149
|
|
|
@@ -155,42 +196,61 @@ More worked examples, and the evidence rules for each kind of question:
|
|
|
155
196
|
|
|
156
197
|
## Running
|
|
157
198
|
|
|
158
|
-
|
|
159
|
-
|
|
199
|
+
Evals run on the Oxy deployment, on its worker fleet, with `oxyc evals run` (install with
|
|
200
|
+
`npm i -g @oxy-hq/cli`, sign in with `oxyc login`). The deployment runs the test files and
|
|
201
|
+
agents the workspace has **compiled**: its served revision, what was pushed, not the files in
|
|
202
|
+
your checkout. Push a new or edited `.test.yml` (and the agent change it tests) first; a test
|
|
203
|
+
file the deployment has not compiled answers exit `5`. The file argument is the test file's
|
|
204
|
+
path in the workspace, from the project root (the directory holding `config.yml`), and
|
|
205
|
+
`target` is resolved from the project root too.
|
|
160
206
|
|
|
161
207
|
```bash
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
208
|
+
oxyc evals run tests/sales.performance.test.yml --workspace <id> # one file: wait, summarise
|
|
209
|
+
oxyc evals run tests/sales.performance.test.yml --workspace <id> --case total-revenue-2025 --output-json
|
|
210
|
+
oxyc evals run tests/sales.performance.test.yml --workspace <id> --case 0 --output-json # by 0-based index
|
|
211
|
+
oxyc evals run tests/sales.performance.test.yml --workspace <id> --tag critical --output-json
|
|
212
|
+
oxyc evals run --workspace <id> # every compiled *.test.yml
|
|
213
|
+
oxyc evals run --workspace <id> --min-accuracy 0.8 # CI gate, exit 9 below
|
|
214
|
+
oxyc evals run <file> --workspace <id> --detach # print the run id
|
|
215
|
+
oxyc evals wait <run-id> --workspace <id> --json # results on stdout
|
|
168
216
|
```
|
|
169
217
|
|
|
170
218
|
- `--case` takes a 0-based index, a case `name`, or the exact prompt. It requires a file. With
|
|
171
219
|
`--tag` as well, a case must match both. If two cases share a name, the first one runs.
|
|
172
220
|
- `--tag` takes one tag.
|
|
173
|
-
- `--output-json` writes the full results
|
|
221
|
+
- `--output-json [file]` writes the full results document to the file you name or, with none,
|
|
222
|
+
to the test file's path (relative to your current directory) with `.yml` replaced by
|
|
174
223
|
`.results.json` (`tests/sales.performance.test.results.json`). With no file argument it
|
|
175
|
-
writes `test-results.json`
|
|
176
|
-
to stdout instead of the pretty report.
|
|
177
|
-
- `-v` adds each failing run's actual output to the pretty report. `-q` shows only the
|
|
224
|
+
writes `test-results.json`. `--json` prints the same document to stdout instead of the
|
|
178
225
|
summary.
|
|
226
|
+
- The summary prints one line per test file (its Correctness score and how many runs
|
|
227
|
+
answered), then the prompt of every run that didn't pass. The judge's reasoning and the
|
|
228
|
+
actual answers are only in the results document.
|
|
229
|
+
- `--regrade <results.json>` grades a results file's recorded answers again, without running
|
|
230
|
+
the agent. It needs the test file the results came from, and can't be combined with
|
|
231
|
+
`--case` or `--tag`. Each run is held to the `expect:` checks of the test-file case with
|
|
232
|
+
the same prompt, read from the test file as it is now; a recorded clarifying question its
|
|
233
|
+
case no longer expects is a run error, as on a fresh run.
|
|
179
234
|
- `--min-accuracy` compares **per-file** scores. `--threshold-mode average` (the default)
|
|
180
235
|
checks the mean across files, and `all` checks every file. It doesn't check individual
|
|
181
236
|
cases.
|
|
237
|
+
- Exit codes: `1` the run failed, was cancelled or timed out, `4` not signed in or not a
|
|
238
|
+
member of the workspace, `5` not found (or not compiled yet), `6` the test file does not
|
|
239
|
+
parse or `--case` matched nothing, `7` retryable (or `--wait <seconds>` ran out; the run
|
|
240
|
+
goes on), `9` below `--min-accuracy`.
|
|
182
241
|
- **Cost:** every case runs `runs` times through the full agent, plus one judge call per run,
|
|
183
242
|
with `concurrency` runs against the warehouse at once. When you iterate, run one case.
|
|
184
243
|
|
|
185
244
|
## Reading results
|
|
186
245
|
|
|
187
|
-
The
|
|
246
|
+
The summary names each file's score and the prompts that failed. For the rest, read the
|
|
247
|
+
results document (`--output-json`, or `--json`) and group its records by `prompt`:
|
|
188
248
|
|
|
189
|
-
|
|
|
249
|
+
| A case's runs | Meaning |
|
|
190
250
|
| --- | --- |
|
|
191
|
-
| `PASS
|
|
192
|
-
|
|
|
193
|
-
|
|
|
251
|
+
| every run `PASS` | passing |
|
|
252
|
+
| some runs `PASS` | flaky. The answer is unstable, which is a real defect |
|
|
253
|
+
| no run `PASS` | failing |
|
|
194
254
|
|
|
195
255
|
The file's **Correctness** score is the mean over every case × run. Each run scores 1 (PASS)
|
|
196
256
|
or 0 (FAIL). There's no partial credit.
|
|
@@ -250,7 +310,7 @@ apart from mechanical edits such as adding a missing `name:`.
|
|
|
250
310
|
### 1. Reproduce
|
|
251
311
|
|
|
252
312
|
```bash
|
|
253
|
-
|
|
313
|
+
oxyc evals run <file> --workspace <id> --case <name> --output-json
|
|
254
314
|
```
|
|
255
315
|
|
|
256
316
|
Read every run of that case: `expected`, `actual_output`, `cot`, `choice`.
|
|
@@ -261,11 +321,13 @@ The results JSON has only the final answer. To see the path, run the same prompt
|
|
|
261
321
|
and read the events:
|
|
262
322
|
|
|
263
323
|
```bash
|
|
264
|
-
|
|
324
|
+
oxyc agentic run <path/to/agent.agentic.yml> -q "<the case's prompt>" --json --workspace <id>
|
|
265
325
|
```
|
|
266
326
|
|
|
267
|
-
This streams the run's events as JSON lines
|
|
268
|
-
`query_executed`: its `query`, its `rows`, and its `source`. `
|
|
327
|
+
This runs the deployed agent, as the evals do, and streams the run's events as JSON lines. Look at
|
|
328
|
+
`query_executed`: its `query`, its `rows`, its `row_count` and its `source`. `rows` is only a
|
|
329
|
+
preview (a react run sends the first 10; `row_count` is the full count), so judge a result's
|
|
330
|
+
size by `row_count`, not by counting `rows`. `source` is `semantic` (compiled
|
|
269
331
|
by the semantic model), `llm` (SQL the model wrote), `verified_sql` (a Verified Query), or
|
|
270
332
|
`vendor`. Also look at `analytics_validation_failed`, the checks that bounced the agent. If
|
|
271
333
|
the project exports traces to Oxy's observability, the run's trace shows the same steps.
|
|
@@ -278,7 +340,7 @@ the project exports traces to Oxy's observability, the run's trace shows the sam
|
|
|
278
340
|
| B. Missing or unfindable measure | `source: llm` where a measure should have answered, or arithmetic done in the answer | a measure, or its name and description |
|
|
279
341
|
| C. Instructions vague or misdirecting | wrong interpretation, varying definitions across runs | `instructions:` or a `.md` context doc |
|
|
280
342
|
| D. Canonical answer exists as SQL | the same question keeps producing different SQL | a Verified Query |
|
|
281
|
-
| E. Validation rejects a correct result | `analytics_validation_failed` loops, `max iterations exceeded` | `validation:` |
|
|
343
|
+
| E. Validation rejects a correct result (`runtime: fsm` only) | `analytics_validation_failed` loops, `max iterations exceeded` | `validation:` |
|
|
282
344
|
| F. Judge false negative | `cot` agrees with the expected answer, `choice` is FAIL | report it. Don't touch the agent |
|
|
283
345
|
| G. Prompt underspecified | clarifying-question errors, different readings across runs | report it, and propose a sharper prompt |
|
|
284
346
|
| H. Data unavailable | no view or table holds it | report it. Don't fake support |
|
|
@@ -293,7 +355,7 @@ Symptoms, evidence, and a worked fix for each:
|
|
|
293
355
|
catalog search matches a measure's **name**, its **description** and its **view name**. It
|
|
294
356
|
doesn't read `synonyms:`, so the words users ask with belong in the description. A view
|
|
295
357
|
that no `context:` glob matches doesn't exist as far as the agent is concerned.
|
|
296
|
-
2. **Context** (`context:` globs, relative to the
|
|
358
|
+
2. **Context** (`context:` globs, relative to the workspace root):
|
|
297
359
|
- **`.md` docs** go into the prompts for clarifying the question and writing the answer.
|
|
298
360
|
Use them for business definitions: the fiscal calendar, what "active customer" means,
|
|
299
361
|
which of two similar measures to use.
|
|
@@ -301,11 +363,11 @@ Symptoms, evidence, and a worked fix for each:
|
|
|
301
363
|
carries a `description:`. When the agent's search matches its file name or description,
|
|
302
364
|
the SQL runs verbatim, with no SQL generation. A `.sql` file **without** that block is
|
|
303
365
|
only a style example for SQL generation, and is never run as an answer.
|
|
304
|
-
3. **Instructions:** top-level `instructions:` reaches every LLM call.
|
|
305
|
-
instructions
|
|
366
|
+
3. **Instructions:** top-level `instructions:` reaches every LLM call. The default (react)
|
|
367
|
+
runtime ignores `states.<state>.instructions:`, so put every rule at the top level.
|
|
306
368
|
Write general rules ("revenue means net of refunds", "rank by units unless asked
|
|
307
369
|
otherwise"). Never put the expected answer, or a number from it, into instructions.
|
|
308
|
-
4. **Validation
|
|
370
|
+
4. **Validation** (`runtime: fsm` only; react ignores it): the `validation:` block **replaces** the 15 default rules rather than
|
|
309
371
|
adjusting them. To switch off or retune one rule, list every rule that should still run.
|
|
310
372
|
An empty `validation: {}` disables them all.
|
|
311
373
|
|
|
@@ -314,16 +376,20 @@ all of them. Preserve the file's existing style. Explain the root cause alongsid
|
|
|
314
376
|
|
|
315
377
|
### 5. Validate
|
|
316
378
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
the
|
|
379
|
+
Evals read the workspace's served revision, so a repair counts only once it is pushed and
|
|
380
|
+
compiled. Check the files you edited, push them to the branch the workspace serves, wait for
|
|
381
|
+
the deployment to compile it, then re-run:
|
|
320
382
|
|
|
321
383
|
```bash
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
384
|
+
oxyc validate --file agents/sales.agentic.yml
|
|
385
|
+
oxyc validate --file semantics/views/orders.view.yml
|
|
386
|
+
oxyc evals run <file> --workspace <id> --case <name> --output-json # after the push compiled
|
|
325
387
|
```
|
|
326
388
|
|
|
389
|
+
A run started before the compile finished scores the previous revision. `oxyc compile
|
|
390
|
+
<branch> --wait` checks that a branch compiles before you merge it, but its staging revision
|
|
391
|
+
is never served, so evals don't see it.
|
|
392
|
+
|
|
327
393
|
**One pass isn't proof.** A case needs `runs`/`runs` on at least two rounds. Then run the
|
|
328
394
|
whole file to catch regressions in other cases. If the repair doesn't hold after three
|
|
329
395
|
diagnose-edit-validate cycles, stop and report what you know.
|
|
@@ -4,12 +4,12 @@ Diagnose before editing. For every failing or flaky case, collect:
|
|
|
4
4
|
|
|
5
5
|
1. Every run's `actual_output`, `cot` and `choice` from the results JSON
|
|
6
6
|
([results-json.md](results-json.md)).
|
|
7
|
-
2. The route the agent took, from `
|
|
8
|
-
or three times if the case is flaky. Read `query_executed.source` and `query`, and any
|
|
7
|
+
2. The route the agent took, from `oxyc agentic run <agent> -q "<prompt>" --json --workspace <id>`.
|
|
8
|
+
It runs the deployed (pushed) agent, as `oxyc evals run` does. Run it two or three times if the case is flaky. Read `query_executed.source` and `query`, and any
|
|
9
9
|
`analytics_validation_failed` events.
|
|
10
10
|
3. The files the agent actually loads: the `context:` globs in its `.agentic.yml`, resolved
|
|
11
|
-
relative to that file's directory. A view, doc or SQL file
|
|
12
|
-
exist for this agent.
|
|
11
|
+
relative to the workspace root (not that file's directory). A view, doc or SQL file
|
|
12
|
+
outside those globs doesn't exist for this agent.
|
|
13
13
|
|
|
14
14
|
Then name one category below. If two apply, fix the earlier one first. Most failures are
|
|
15
15
|
**A** or **B**.
|
|
@@ -96,25 +96,19 @@ convention.
|
|
|
96
96
|
|
|
97
97
|
- **A definition or a business fact** goes in a `.md` doc matched by `context:`. Docs are
|
|
98
98
|
injected into the prompts that clarify the question and write the answer.
|
|
99
|
-
- **A rule
|
|
100
|
-
|
|
101
|
-
(reading the question), `specifying` (choosing measures and filters), `solving` (writing
|
|
102
|
-
SQL) or `interpreting` (writing the answer).
|
|
99
|
+
- **A rule** goes in top-level `instructions:`. The default (react) runtime reads guidance
|
|
100
|
+
from there only and ignores `states.<state>.instructions`, so don't put it per stage.
|
|
103
101
|
|
|
104
102
|
```yaml
|
|
105
103
|
instructions: |
|
|
106
104
|
"Revenue" means net revenue (after refunds and discounts) unless the user says gross.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Read "last quarter" as the most recent completed fiscal quarter; the fiscal year starts
|
|
111
|
-
on 1 February.
|
|
112
|
-
interpreting:
|
|
113
|
-
instructions: State the period and every filter applied in the answer's first sentence.
|
|
105
|
+
Read "last quarter" as the most recent completed fiscal quarter; the fiscal year starts
|
|
106
|
+
on 1 February.
|
|
107
|
+
State the period and every filter applied in the answer's first sentence.
|
|
114
108
|
|
|
115
109
|
context:
|
|
116
|
-
-
|
|
117
|
-
-
|
|
110
|
+
- ./semantics/**/*.view.yml
|
|
111
|
+
- ./semantics/**/*.topic.yml
|
|
118
112
|
- ./docs/*.md
|
|
119
113
|
```
|
|
120
114
|
|
|
@@ -154,7 +148,8 @@ that end in `max iterations exceeded`, or answers that drift away from the right
|
|
|
154
148
|
retry. Common causes: `non_empty`, when "none" is a correct answer; `outlier_detection` on
|
|
155
149
|
naturally spiky data; and `freshness_check` on a source that loads late.
|
|
156
150
|
|
|
157
|
-
**Fix:**
|
|
151
|
+
**Fix:** this applies to `runtime: fsm` agents only; the default (react) runtime runs no
|
|
152
|
+
validation rules and ignores `validation:`. On the FSM, retune the rule. The `validation:` block **replaces** the default set, so list every
|
|
158
153
|
rule that should still run. A stage you leave out isn't checked at all, and a misspelled rule
|
|
159
154
|
name stops the agent from loading. The 15 defaults:
|
|
160
155
|
|
|
@@ -238,6 +233,8 @@ that make the agent sound as if it can answer.
|
|
|
238
233
|
3. Instructions: global first, then per-state.
|
|
239
234
|
4. Validation tuning.
|
|
240
235
|
|
|
241
|
-
After each change, `
|
|
242
|
-
|
|
243
|
-
|
|
236
|
+
After each change, `oxyc validate --file <edited file>`, push it, and once the deployment has
|
|
237
|
+
compiled it re-run the case at least twice
|
|
238
|
+
(`oxyc evals run <file> --workspace <id> --case <name> --output-json`), then the whole file.
|
|
239
|
+
Evals read the served revision, so an edit counts only once it is pushed and compiled. Stop
|
|
240
|
+
after three cycles that don't hold, and report.
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
# Reading
|
|
1
|
+
# Reading eval results
|
|
2
2
|
|
|
3
|
-
`
|
|
4
|
-
file (`tests/sales.performance.test.yml` →
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
`oxyc evals run <file> --output-json` writes `<file without .yml>.results.json` at the test
|
|
4
|
+
file's path, relative to the current directory (`tests/sales.performance.test.yml` →
|
|
5
|
+
`tests/sales.performance.test.results.json`), or to the file you name after `--output-json`.
|
|
6
|
+
Without a file argument it writes `test-results.json`. `--json` prints the same document on
|
|
7
|
+
stdout.
|
|
8
|
+
|
|
9
|
+
It is the text the deployment's run produced, byte for byte the document the older local
|
|
10
|
+
`oxy test --output-json` wrote, so the shape below holds for both.
|
|
7
11
|
|
|
8
12
|
## Shape
|
|
9
13
|
|
|
10
|
-
The file is a JSON array with **one element per test file
|
|
14
|
+
The file is a JSON array with **one element per test file**. Keys appear in the order below
|
|
15
|
+
except `test_name`, which is written last; every record also carries `llm_rounds`, and
|
|
16
|
+
optional fields (`final_sql`, `answer_text`, `timing`, `runtime`, `model`, …) appear only when
|
|
17
|
+
set:
|
|
11
18
|
|
|
12
19
|
```jsonc
|
|
13
20
|
[
|
|
@@ -22,7 +29,7 @@ The file is a JSON array with **one element per test file**:
|
|
|
22
29
|
},
|
|
23
30
|
"metrics": [
|
|
24
31
|
{
|
|
25
|
-
"type": "Correctness", // the only metric
|
|
32
|
+
"type": "Correctness", // the only metric an eval produces
|
|
26
33
|
"score": 0.6667, // mean of every record's score in this file
|
|
27
34
|
"records": [
|
|
28
35
|
{
|
|
@@ -44,7 +51,7 @@ The file is a JSON array with **one element per test file**:
|
|
|
44
51
|
]
|
|
45
52
|
```
|
|
46
53
|
|
|
47
|
-
What is **not** in it: the SQL, the tool calls, the rows the agent saw. Records for an
|
|
54
|
+
What is **not** in it: the SQL, the tool calls' inputs and outputs, the rows the agent saw. Records for an
|
|
48
55
|
`.agentic.yml` target carry no `references` array. Diagnose the path with the commands under
|
|
49
56
|
"Seeing what the agent did" below.
|
|
50
57
|
|
|
@@ -59,7 +66,9 @@ What is **not** in it: the SQL, the tool calls, the rows the agent saw. Records
|
|
|
59
66
|
| `choice` | The parsed verdict. Compare it with `cot` to spot judge parse problems. |
|
|
60
67
|
| `score` | `choice` as a number. |
|
|
61
68
|
| `duration_ms`, `*_tokens` | Cost and latency of the agent run, not of the judge. Zero on errored runs. |
|
|
62
|
-
| `
|
|
69
|
+
| `observed` | What the run did, read off its events: `tools` (every call's name, in order), `query_sources` (each successful query's source), `answer_source`, `preagg`, `charts`, and `asked_user` (the clarifying question it stopped on). Absent on errored runs. |
|
|
70
|
+
| `unmet_expectations` | The case's `expect:` checks the run failed, each named. Absent when all were met or none were set. |
|
|
71
|
+
| `errors` | The error text of every run that never answered, in run order. A clarifying question its case expects (`asks_user: true`) is not an error; any other is. |
|
|
63
72
|
| `stats.answered` vs `total_attempted` | The answer rate. A gap means runs ended in errors. |
|
|
64
73
|
|
|
65
74
|
## Ordering
|
|
@@ -119,11 +128,12 @@ jq -r '.[].errors[]' "$R"
|
|
|
119
128
|
The results only show answers. To see the route an answer took, replay the prompt:
|
|
120
129
|
|
|
121
130
|
```bash
|
|
122
|
-
|
|
131
|
+
oxyc agentic run <path/to/agent.agentic.yml> -q "<prompt>" --json --workspace <id>
|
|
123
132
|
```
|
|
124
133
|
|
|
125
|
-
|
|
126
|
-
one JSON object per line, `{"seq", "event_type", "payload"}
|
|
134
|
+
It runs the agent the deployment has compiled (push first), as the evals do, and needs only an
|
|
135
|
+
`oxyc` login. It prints one JSON object per line, `{"seq", "event_type", "payload"}`; each
|
|
136
|
+
`payload` also carries the run's `attempt`. The events that matter for
|
|
127
137
|
diagnosis:
|
|
128
138
|
|
|
129
139
|
| `event_type` | What to read in `payload` |
|
|
@@ -131,15 +141,17 @@ diagnosis:
|
|
|
131
141
|
| `semantic_shortcut_attempted` / `semantic_shortcut_resolved` | whether the semantic model answered directly |
|
|
132
142
|
| `spec_resolved` | the tables, joins and assumptions the agent settled on |
|
|
133
143
|
| `query_generated` | SQL the model wrote |
|
|
134
|
-
| `query_executed` | `query`, `row_count
|
|
144
|
+
| `query_executed` | `query`, `row_count` (the full count), `rows` (a preview: a react run sends the first 10), `error`, and `source`: `semantic`, `llm`, `verified_sql` or `vendor` |
|
|
145
|
+
| `result_table` | a react run only: the answer's result, its first 50 `rows`, `columns`, `column_kinds`, and `row_count` |
|
|
146
|
+
| `result_chart` | a react run only: a chart the agent drew, `kind`, `x`, `y`, `series`, and its own `rows` as `[x, series?, y…]` |
|
|
135
147
|
| `analytics_validation_failed` | `state`, `reason`: a check that sent the agent back to retry |
|
|
136
148
|
|
|
137
149
|
Run it two or three times for a flaky case. Different `source` values or different SQL across
|
|
138
150
|
runs is the flakiness, made visible.
|
|
139
151
|
|
|
140
|
-
## The
|
|
152
|
+
## The summary
|
|
141
153
|
|
|
142
|
-
Without `--
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
154
|
+
Without `--json`, `oxyc evals run` prints one line per test file (its name, the Correctness
|
|
155
|
+
score and `answered x/y`), then, indented, `FAIL` and the prompt of every run that didn't
|
|
156
|
+
pass. The judge's reasoning, the actual answers and the errors are only in the results
|
|
157
|
+
document.
|