@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.
Files changed (35) hide show
  1. package/README.md +1031 -71
  2. package/dist/main.mjs +21844 -4166
  3. package/dist/main.mjs.map +1 -1
  4. package/dist/{mcp-CJWQm-yd.mjs → mcp-bxf7JBJu.mjs} +2 -2
  5. package/dist/mcp-bxf7JBJu.mjs.map +1 -0
  6. package/json-schemas/agent-test.json +116 -3
  7. package/json-schemas/agentic.json +81 -1
  8. package/json-schemas/config.json +2 -1
  9. package/json-schemas/flow-test.json +11 -2
  10. package/json-schemas/topic.json +252 -0
  11. package/json-schemas/view.json +473 -0
  12. package/package.json +9 -5
  13. package/skills/oxy-agents/SKILL.md +98 -54
  14. package/skills/oxy-agents/references/quick-reference.md +22 -20
  15. package/skills/oxy-agents/templates/agentic-template.yml +34 -90
  16. package/skills/oxy-airway-pipelines/SKILL.md +35 -2
  17. package/skills/oxy-automations/SKILL.md +42 -28
  18. package/skills/oxy-cli/SKILL.md +15 -7
  19. package/skills/oxy-custom-apps/SKILL.md +413 -7
  20. package/skills/oxy-custom-apps/references/app-calls.md +98 -0
  21. package/skills/oxy-custom-apps/references/phone-layout.md +16 -2
  22. package/skills/oxy-custom-apps/references/sandbox-agent-loop.md +8 -8
  23. package/skills/oxy-evals/SKILL.md +112 -46
  24. package/skills/oxy-evals/references/diagnosis.md +18 -21
  25. package/skills/oxy-evals/references/results-json.md +30 -18
  26. package/skills/oxy-evals/references/writing-expected.md +5 -4
  27. package/skills/oxy-experiments/SKILL.md +4 -3
  28. package/skills/oxy-semantic-modeling/SKILL.md +14 -12
  29. package/template/.claude/hooks/oxyc-cloud-session.sh +40 -8
  30. package/template/.github/workflows/publish.yaml +5 -5
  31. package/template/.github/workflows/validate.yaml +125 -199
  32. package/template/README.md +50 -21
  33. package/template/_gitignore +4 -4
  34. package/template/config.yml +2 -2
  35. package/dist/mcp-CJWQm-yd.mjs.map +0 -1
@@ -4,11 +4,12 @@ description: >-
4
4
  Use when creating, editing, reviewing or debugging an Oxy agent, a `.agentic.yml` file that
5
5
  answers questions from the semantic model by clarifying, specifying, solving (SQL), executing
6
6
  and interpreting. Triggers include "create an analytics agent", "my agent picks the wrong
7
- metric", "my solving instructions are ignored", "the agent never uses my verified query", "the
7
+ metric", "my solving instructions are ignored", "react ignores config keys", "ignored_keys", "the
8
+ agent never uses my verified query", "the
8
9
  agent can't see a database", "which tools can a state call", "set thinking, effort,
9
10
  budget_tokens or extended thinking", "per-state model or max_retries", "validation rules",
10
11
  "Cube or Looker semantic_engine", "analytics vs app-builder agent", "`.agent.yml` or
11
- `.agentic.yml`", and validating, running (`oxy agentic run`) or testing (`oxy test`) an agent.
12
+ `.agentic.yml`", and validating, running (`oxyc agentic run`) or testing (`oxyc evals run`) an agent.
12
13
  Not for writing the semantic model itself (views, topics) or automations.
13
14
  ---
14
15
 
@@ -37,13 +38,14 @@ the pipeline. You do not define its states or its tools.
37
38
  Jinja (`{{ databases.x.dialect }}`) is passed to the model literally, and a
38
39
  classic `name:` is dropped, so the agent's id becomes its file stem.
39
40
  - **There is no `kind:` field.** Every `.agentic.yml` runs the same analytics
40
- pipeline. A file named `app_builder.agentic.yml` is not special. Generating
41
- views or agent files is the in-product **Builder Agent** (chat Build mode),
42
- and no `.agentic.yml` configures it.
41
+ pipeline. A file named `app_builder.agentic.yml` is not special, and no
42
+ `.agentic.yml` writes views or agent files: those are edited in the
43
+ workspace's repository (`oxyc workspace clone`, or the Factory's "Work in
44
+ your editor" panel) and pushed, which compiles them.
43
45
  - **Automations are a different file.** Deterministic multi-step work is an
44
46
  automation, `.automation.yml` (`.procedure.yml` still works). `.workflow.yml`
45
- is no longer recognised at all. An agent can *run* an automation it finds in
46
- its context. It cannot *be* one.
47
+ is no longer recognised at all. An agent is not an automation, and on the
48
+ default runtime it cannot run one as an answer either (see Runtime).
47
49
  - **Instruction-only agents skip the pipeline.** A file with `instructions:`
48
50
  and no `databases:`, `context:` or `states:` is answered with one LLM call
49
51
  and queries nothing. Add any of those three and you get the full pipeline.
@@ -53,6 +55,34 @@ model. **Use a verified query** (a `.sql` file with an `oxy:` header, below)
53
55
  when one question must always get exactly the same SQL. **Use an automation**
54
56
  when the steps are fixed and need no LLM to choose between them.
55
57
 
58
+ ## Runtime: react is the default, and it ignores the pipeline tuning
59
+
60
+ Agents run on the **react** runtime by default: one model in a tool loop
61
+ (`search`, `read`, `query`, `chart`, `ask_user` and a few analysis tools)
62
+ that answers from the semantic model, verified queries and raw SQL. The staged pipeline described
63
+ under "How a question flows" (`runtime: fsm`) is being removed. In a chat, the
64
+ runtime is chosen by the org's rollout, not by the agent's `runtime:` key, so
65
+ `runtime: fsm` is not a way to keep the keys below working.
66
+
67
+ React **ignores** these keys. They still parse; the run goes on without them,
68
+ and the server logs a warning and records them on a chat's run as
69
+ `ignored_keys`:
70
+
71
+ | Key | Under react |
72
+ | --- | --- |
73
+ | `states.<any>.instructions` | ignored: put the guidance in top-level `instructions` |
74
+ | `states.<any>.max_retries` | ignored: the loop has its own turn and cost budgets |
75
+ | `states.<not solving>.model`, `.thinking` | ignored: only `states.solving.model` / `.thinking` apply (prefer `llm.model` / top-level `thinking`) |
76
+ | `validation` | ignored: no result checks run |
77
+ | `semantic_engine` | ignored: queries go only to the views in `context:` |
78
+ | `llm.max_tokens`, `llm.advisor` | applied on Anthropic models; ignored on OpenAI and OpenAI-compatible |
79
+ | automation files in `context:` | ignored (`context (automations)`): an automation cannot be run as an answer |
80
+
81
+ Everything else (`instructions`, `timezone`, `databases`, the rest of
82
+ `context`, `llm`, `thinking`, `llm.extended_thinking`) is honoured. **Write new
83
+ agents without the ignored keys.** The sections below that describe them are
84
+ marked *FSM only*.
85
+
56
86
  ## Minimal file
57
87
 
58
88
  ```yaml
@@ -68,12 +98,17 @@ every database its context references. The full annotated file is
68
98
  [templates/agentic-template.yml](templates/agentic-template.yml).
69
99
 
70
100
  Top-level keys: `instructions`, `timezone`, `databases`, `context`, `llm`,
71
- `thinking`, `states`, `validation`, `semantic_engine`. All are optional.
101
+ `thinking`, and the FSM-only `states`, `validation`, `semantic_engine`. All
102
+ are optional.
72
103
  **Unknown keys are ignored silently at every level**, by the runtime and by
73
104
  both validators. A typo such as `stats:` or `solve:` costs you the setting
74
105
  with no error.
75
106
 
76
- ## How a question flows
107
+ ## How a question flows (FSM only)
108
+
109
+ This section and the next describe the `runtime: fsm` pipeline, which react
110
+ replaces. On react there are no states; the model calls tools until it can
111
+ answer.
77
112
 
78
113
  ```
79
114
  clarifying → specifying → solving → executing → interpreting → done
@@ -113,7 +148,7 @@ The practical consequence: **guidance every answer needs goes in the global
113
148
  `instructions:`, `clarifying` or `interpreting`, never only in `solving`.** On a
114
149
  well-modelled workspace, solving rarely runs.
115
150
 
116
- ## Tools each state can call
151
+ ## Tools each state can call (FSM only)
117
152
 
118
153
  The tool set is fixed by the runtime and is not configurable. There is no
119
154
  `tools:` key.
@@ -134,11 +169,11 @@ workspace previews or scheduled runs.
134
169
 
135
170
  ## The fields that matter
136
171
 
137
- **`instructions`** go into every LLM state's system prompt. Use them for the
138
- persona, business conventions ("fiscal year starts in February", "customer
139
- means the `customers` view") and which views or topics to prefer. Per-state
140
- `instructions` are **appended** to these, not substituted, so don't repeat the
141
- global text in them.
172
+ **`instructions`** are the agent's system prompt (on the FSM, every LLM
173
+ state's). Use them for the persona, business conventions ("fiscal year starts
174
+ in February", "customer means the `customers` view"), which views or topics to
175
+ prefer, and any SQL style rules. On react they are the only guidance the model
176
+ gets: per-state `instructions` are ignored.
142
177
 
143
178
  **`timezone`** is an IANA name used for "today", "yesterday" and "last week".
144
179
  It falls back to config.yml's `timezone:`, then UTC. An invalid name fails the
@@ -147,19 +182,20 @@ run.
147
182
  **`databases`** lists names from config.yml `databases:`. The agent can query
148
183
  exactly these plus every database its context files reference: a view's
149
184
  `datasource` (or `data_source`), a verified query's `database:`, or an
150
- automation task's `database:`. There is **no fallback to every database in
151
- config.yml**. With none at all, the run fails with `no databases configured`.
185
+ automation task's `database:` (so removing an automation from `context:` can
186
+ remove a database). There is **no fallback to every database in config.yml**. With none at all, the run fails with `no databases configured`.
152
187
 
153
- **`context`** takes globs relative to the agent file's directory. Each match is
154
- bucketed by its file name:
188
+ **`context`** takes globs relative to the **workspace root**, whatever directory the
189
+ `.agentic.yml` sits in: an agent in `agents/` still writes `./semantics/**`, never
190
+ `../semantics/**`. Each match is bucketed by its file name:
155
191
 
156
192
  | Matches | Becomes |
157
193
  | --- | --- |
158
194
  | `*.view.yml`, `*.topic.yml` | the semantic catalog |
159
- | `*.sql` with an `oxy:` header | a **verified query**: found by `search_automations` and run verbatim |
160
- | `*.sql` without the header | SQL style examples in the solving prompt only |
161
- | `*.md` | domain notes in the clarifying and interpreting prompts |
162
- | `*.automation.yml`, `*.procedure.yml` | automations the agent may pick and run |
195
+ | `*.sql` with an `oxy:` header | a **verified query**, run verbatim when chosen (react lists it in the prompt; the FSM finds it with `search_automations`) |
196
+ | `*.sql` without the header | example SQL (react: searchable and readable; FSM: the solving prompt) |
197
+ | `*.md` | domain notes (react: searchable and readable; FSM: the clarifying and interpreting prompts) |
198
+ | `*.automation.yml`, `*.procedure.yml` | FSM only: automations the agent may pick and run. **Ignored by react; don't list them** |
163
199
  | anything else | ignored |
164
200
 
165
201
  A verified query opts in with a leading comment block:
@@ -191,7 +227,8 @@ can come back empty in the cloud.
191
227
  `/chat/completions`.
192
228
  - Google/Gemini models are not supported in agents.
193
229
 
194
- **`states`** honours four keys: `clarifying`, `specifying`, `solving` and
230
+ **`states`** (*FSM only*; react ignores all of it except `solving.model` and
231
+ `solving.thinking`) honours four keys: `clarifying`, `specifying`, `solving` and
195
232
  `interpreting`.
196
233
 
197
234
  - `executing` has no LLM, so it is accepted and does nothing. Every other key
@@ -204,20 +241,22 @@ can come back empty in the cloud.
204
241
  failure-retry count. Defaults: specifying 5, solving 3, interpreting 5.
205
242
  Clarifying has a fixed limit and ignores the setting.
206
243
 
207
- **`validation`** sets the result checks. Leave it out and 15 default checks
244
+ **`validation`** (*FSM only*; react ignores it) sets the result checks. Leave it out and 15 default checks
208
245
  run. If you include it, it **replaces** the defaults: only the rules you list
209
246
  run, and a stage you leave empty is not checked. To switch one check off or
210
247
  retune it, list every rule that should still run. Rule names and parameters
211
248
  are in [references/quick-reference.md](references/quick-reference.md).
212
249
 
213
- **`semantic_engine`** routes queries through Cube or Looker ahead of Oxy's own
250
+ **`semantic_engine`** (*FSM only*; react ignores it) routes queries through Cube or Looker ahead of Oxy's own
214
251
  semantic model. `${VAR}` placeholders are read from the server's environment,
215
252
  not from workspace secrets. The engine is pinged when a run starts, and an
216
253
  unreachable engine fails the run.
217
254
 
218
255
  ## Thinking and models
219
256
 
220
- Thinking is resolved per state, in this order:
257
+ React uses the solving rule below: `states.solving.thinking`, then
258
+ `llm.thinking`, then top-level `thinking`, then adaptive. Set it at the top
259
+ level. On the FSM, thinking is resolved per state, in this order:
221
260
 
222
261
  1. the state's own `thinking`
223
262
  2. `llm.thinking`
@@ -227,8 +266,8 @@ Thinking is resolved per state, in this order:
227
266
 
228
267
  A global value replaces every built-in default. So top-level
229
268
  `thinking: adaptive` makes clarifying, specifying and interpreting think too,
230
- and `llm.thinking: disabled` turns thinking off in solving. Prefer per-state
231
- settings.
269
+ and `llm.thinking: disabled` turns thinking off in solving. On the FSM, prefer
270
+ per-state settings.
232
271
 
233
272
  | Form | Meaning |
234
273
  | --- | --- |
@@ -257,40 +296,44 @@ silently means `medium`.
257
296
 
258
297
  `llm.extended_thinking: {model, thinking}` is used while the user has the
259
298
  **extended thinking** toggle on (`--thinking-mode extended_thinking` from the
260
- CLI). It replaces the model and the thinking setting in every state. Without
299
+ CLI). It replaces the model and the thinking setting (on the FSM, in every
300
+ state). Without
261
301
  the block, the toggle changes nothing.
262
302
 
263
303
  Leave `llm.max_tokens` unset unless you need a hard cap. When it is unset, Oxy
264
304
  uses 4,096 without thinking and 16,384 (or the budget plus 4,096) with
265
305
  thinking. A value you set is used as-is, and thinking tokens count against it.
306
+ React applies it on Anthropic models only.
266
307
 
267
308
  ## Validate, run, test
268
309
 
269
310
  ```bash
270
- oxyc validate --file agents/sales.agentic.yml # offline schema check, no server
271
- oxy validate --file agents/sales.agentic.yml # the runtime's own parser
272
- oxy agentic run agents/sales.agentic.yml -q "Revenue by region last quarter?"
273
- oxy test agents/sales.agentic.test.yml # LLM-judged evals
311
+ oxyc validate --file agents/sales.agentic.yml # offline: shape, databases:, llm.ref
312
+ oxyc agentic run agents/sales.agentic.yml -q "Revenue by region last quarter?" --workspace <id>
313
+ oxyc evals run agents/sales.agentic.test.yml --workspace <id> # LLM-judged evals, on the deployment
274
314
  ```
275
315
 
276
- - **Both validators are structural only.** They catch a bad shape (a
277
- malformed `thinking`, a wrong type, a duplicate key). `oxyc validate` also
278
- rejects the vendor spellings `openai` and `openai_compat`, which the runtime
279
- accepts, so write `open_ai` and `open_ai_compat` to satisfy both. Neither
280
- validator resolves `databases:` or `llm.ref`, expands globs, reads `${VAR}`
281
- placeholders, checks rule names or timezones, or notices unknown keys.
282
- - **The first full check is a run.** `oxy agentic run <path> -q "<question>"`
283
- builds the agent exactly as the server does and streams each state. It runs
284
- in a workspace directory and needs Oxy's Postgres database (`OXY_DATABASE_URL`),
285
- like `oxy serve`. Add `--json` for JSONL events, or `--thinking-mode
286
- extended_thinking`. A CLI run that pauses to ask the user something can't be
287
- usefully resumed from the CLI, because `oxy agentic answer` only marks the
288
- run as running and does not deliver the text. Ask a more specific question,
289
- or continue in the app.
290
- - **`oxy build` does not check agents.** It does nothing any more.
291
- - **`oxy test`** runs `.test.yml` evals against an agent and scores each case
292
- with an LLM judge. The format and flags are in
293
- [references/quick-reference.md](references/quick-reference.md).
316
+ - **`oxyc validate` checks the shape and the references.** It catches a bad
317
+ shape (a malformed `thinking`, a wrong type, a duplicate key) and a
318
+ `databases:` entry or `llm.ref` that names nothing in `config.yml`. It does
319
+ not expand globs, read `${VAR}` placeholders, check rule names or timezones,
320
+ or notice unknown keys (the runtime ignores them too). The Rust
321
+ `oxy validate` is gone; use `oxyc validate`.
322
+ - **The first full check is a run.** `oxyc agentic run <path> -q "<question>"
323
+ --workspace <id>` runs the agent on the deployment and streams each state. It
324
+ runs what the workspace has compiled (push first), not your checkout, and
325
+ each run opens a chat thread in your history. Add `--json` for JSONL events,
326
+ or `--thinking-mode extended_thinking`. A run that stops to ask something
327
+ exits `0` with the question; answer it with `oxyc agentic answer <run_id>
328
+ --answer "..."` and follow the rest with `oxyc agentic events <run_id>`. An
329
+ `error` or `cancelled` run exits `1`. (The Rust `oxy agentic run` ran a local
330
+ file against `OXY_DATABASE_URL`; it is gone, so use this command.)
331
+ - **`oxyc evals run`** runs `.test.yml` evals against an agent on the
332
+ deployment and scores each case with an LLM judge. It runs what the workspace
333
+ has compiled (push first), not your checkout, and exits `9` under
334
+ `--min-accuracy`. The format and flags are in
335
+ [references/quick-reference.md](references/quick-reference.md) and the
336
+ `oxy-evals` skill.
294
337
 
295
338
  To point an editor at the schema, start the file with:
296
339
 
@@ -306,9 +349,10 @@ To point an editor at the schema, start the file with:
306
349
  | agent can't see a table it "should" | the agent only reaches databases it declares or references | add it to `databases:` |
307
350
  | wrong model answers, or an auth error on the first question | `llm.ref` is not a `name:` in config.yml, so the agent fell back to a built-in Claude model and the server's `ANTHROPIC_API_KEY`; or the model's key secret is unset | fix the name; set the key |
308
351
  | "does not have a metric tree configured" | the question was classified as root cause or opportunity, and this workspace or run has no metric tree | define a metric tree, or ask for the numbers directly |
309
- | `solving` instructions never take effect | the semantic model compiled the question, so solving was skipped | move them to the global `instructions:` or `clarifying` |
352
+ | per-state `instructions` never take effect | react ignores them; on the FSM, the semantic model compiled the question, so solving was skipped | move them to the global `instructions:` |
353
+ | `max_retries`, `validation` or an automation in `context:` changes nothing | react ignores them (recorded as `ignored_keys` on the run) | remove them |
310
354
  | verified query never chosen | `.sql` has no `oxy:` header, or isn't matched by `context:` | add the header and a `description`; check the glob |
311
- | state override does nothing | misspelled key, or `executing` / `clarifying.max_retries` | use the four honoured keys |
355
+ | state override does nothing | react honours only `states.solving.model` / `.thinking`; on the FSM, a misspelled key or `executing` / `clarifying.max_retries` | set `llm` / top-level `thinking` instead |
312
356
  | thinking silently off | `thinking: enabled` or another unknown string | use one of the forms above |
313
357
  | `thinking: false` rejected | boolean, not a mode | `thinking: disabled` |
314
358
  | a default check stopped running | a `validation:` section replaced the defaults | list every rule you still want |
@@ -13,21 +13,22 @@ starter file is [../templates/agentic-template.yml](../templates/agentic-templat
13
13
  | Referenced as | its workspace-relative path, e.g. `agents/sales.agentic.yml`. The UI shows the stem (`sales`) |
14
14
  | Unknown keys | ignored silently at every level, by the runtime and by both validators |
15
15
  | Duplicate keys | a YAML parse error |
16
+ | Runtime | **react** by default. It ignores `states:` (except `solving.model` / `.thinking`), `validation`, `semantic_engine`, automations in `context:`, and `llm.max_tokens` / `llm.advisor` off Anthropic; the run goes on and records them as `ignored_keys`. Rows marked *FSM only* below are those keys |
16
17
  | Editor schema | `# yaml-language-server: $schema=https://raw.githubusercontent.com/oxy-hq/oxygen/refs/heads/main/json-schemas/agentic.json` |
17
18
 
18
19
  ## Top-level fields
19
20
 
20
21
  | Field | Type | Default | Notes |
21
22
  | --- | --- | --- | --- |
22
- | `instructions` | string | none | Added to every LLM state's system prompt |
23
+ | `instructions` | string | none | The system prompt (FSM: every LLM state's). On react, the only place for guidance |
23
24
  | `timezone` | IANA name | config.yml `timezone:`, then UTC | Used for "today" and relative dates. An invalid name fails the run |
24
25
  | `databases` | list of config.yml database names | `[]` | Combined with the databases the context references. There is no all-databases fallback |
25
- | `context` | list of globs | `[]` | Relative to the agent file's directory |
26
+ | `context` | list of globs | `[]` | Relative to the workspace root, wherever the agent file sits |
26
27
  | `llm` | map | see below | Model, key, thinking |
27
28
  | `thinking` | thinking form | none | Global thinking. Overrides each state's built-in default; `llm.thinking` overrides it |
28
- | `states` | map | `{}` | Per-state overrides |
29
- | `validation` | map | 15 default rules | **Replaces** the defaults when present |
30
- | `semantic_engine` | map | none | Cube or Looker ahead of Oxy's semantic model |
29
+ | `states` | map | `{}` | *FSM only* per-state overrides; react reads only `solving.model` / `.thinking` |
30
+ | `validation` | map | 15 default rules | *FSM only*. **Replaces** the defaults when present |
31
+ | `semantic_engine` | map | none | *FSM only*. Cube or Looker ahead of Oxy's semantic model |
31
32
 
32
33
  An instruction-only agent (`instructions`, and no `databases`, `context` or
33
34
  `states`) is one LLM call. It runs no pipeline and no queries.
@@ -38,10 +39,10 @@ An instruction-only agent (`instructions`, and no `databases`, `context` or
38
39
  | --- | --- | --- |
39
40
  | `ref` | none | A `name:` under config.yml `models:`. Supplies the vendor, key (a workspace secret in the cloud), base URL, Azure settings and headers |
40
41
  | `model` | from `ref`, else the first config.yml model | A provider model ID. Setting `model` without `ref` skips config.yml entirely, so the key must come from `api_key` or the server environment |
41
- | `vendor` | from `ref`, else `anthropic` | `anthropic`, `open_ai` (Responses API) or `open_ai_compat` (`/chat/completions`). The runtime also accepts `openai` and `openai_compat`; `oxyc validate` does not |
42
+ | `vendor` | from `ref`, else `anthropic` | `anthropic`, `open_ai` (Responses API) or `open_ai_compat` (`/chat/completions`). The runtime also accepts `openai` and `openai_compat`, and so does `oxyc validate` |
42
43
  | `api_key` | from `ref`, else `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` on the server | Prefer `ref` |
43
44
  | `base_url` | from `ref`, else the provider default | `open_ai_compat` defaults to `http://localhost:11434/v1` |
44
- | `max_tokens` | 4,096 without thinking; 16,384 (or budget + 4,096) with thinking | A value you set is used as-is, and thinking tokens count against it |
45
+ | `max_tokens` | 4,096 without thinking; 16,384 (or budget + 4,096) with thinking | A value you set is used as-is, and thinking tokens count against it. React applies it on Anthropic only |
45
46
  | `thinking` | none | Beats top-level `thinking` |
46
47
  | `extended_thinking` | none | `{model, thinking}`. Replaces both in every state while the user's extended-thinking toggle is on |
47
48
 
@@ -49,7 +50,9 @@ A `ref` that is not in config.yml is not an error at load time. The agent falls
49
50
  back to a built-in Claude model and the server's `ANTHROPIC_API_KEY`.
50
51
  Google/Gemini models are not supported in agents.
51
52
 
52
- ## `states:`
53
+ ## `states:` (FSM only)
54
+
55
+ React ignores this section except `solving.model` and `solving.thinking`.
53
56
 
54
57
  | Key | LLM | Thinking default | `max_retries` default | Prompt extras |
55
58
  | --- | --- | --- | --- | --- |
@@ -80,7 +83,8 @@ Any other key (`solve`, `diagnosing`, …) is ignored silently.
80
83
  | `false` / `true` | parse error |
81
84
 
82
85
  Precedence, highest first: the extended-thinking toggle, then `states.<s>.thinking`,
83
- then `llm.thinking`, then top-level `thinking`, then the state default.
86
+ then `llm.thinking`, then top-level `thinking`, then the state default. React
87
+ applies the `solving` row (default adaptive).
84
88
 
85
89
  | Provider | `adaptive` | `effort` | `budget_tokens` |
86
90
  | --- | --- | --- | --- |
@@ -97,9 +101,9 @@ then `llm.thinking`, then top-level `thinking`, then the state default.
97
101
  | `*.view.yml`, `*.view.yaml` | semantic catalog | its `datasource` / `data_source` adds a database |
98
102
  | `*.topic.yml`, `*.topic.yaml` | semantic catalog | |
99
103
  | `*.sql` with an `oxy:` header | verified query, run verbatim when chosen | header `database:` adds a database |
100
- | `*.sql` without the header | SQL examples in the solving prompt | |
101
- | `*.md` | domain notes for clarifying and interpreting | |
102
- | `*.automation.yml/.yaml`, `*.procedure.yml/.yaml` | automations `search_automations` can return | task `database:` values add databases |
104
+ | `*.sql` without the header | example SQL (react: search/read; FSM: the solving prompt) | |
105
+ | `*.md` | domain notes (react: search/read; FSM: clarifying and interpreting) | |
106
+ | `*.automation.yml/.yaml`, `*.procedure.yml/.yaml` | *FSM only*: automations `search_automations` can return. React ignores them | task `database:` values add databases |
103
107
  | anything else | ignored | |
104
108
 
105
109
  Verified-query header fields: `description` (used to match the question) and
@@ -113,7 +117,7 @@ Verified-query header fields: `description` (used to match the question) and
113
117
  */
114
118
  ```
115
119
 
116
- ## Tools by state (fixed; no `tools:` key)
120
+ ## Tools by state (FSM only; fixed; no `tools:` key)
117
121
 
118
122
  | State | Tools |
119
123
  | --- | --- |
@@ -128,7 +132,7 @@ Root-cause and opportunity questions need a metric tree. Without one the agent
128
132
  replies that the workspace "does not have a metric tree configured". Metric-tree
129
133
  and anomaly tools are not offered in workspace previews or scheduled runs.
130
134
 
131
- ## `validation:`
135
+ ## `validation:` (FSM only)
132
136
 
133
137
  Absent: the 15 rules marked default run. Present: only the listed rules run (an
134
138
  entry with `enabled: false` is skipped), and a stage with no list is not
@@ -164,7 +168,7 @@ Where a failure goes (diagnosing):
164
168
  | ambiguous column | clarifying |
165
169
  | outlier, freshness gap, bad chart config | interpreting (answers and states the caveat) |
166
170
 
167
- ## `semantic_engine:`
171
+ ## `semantic_engine:` (FSM only)
168
172
 
169
173
  | Field | Cube | Looker |
170
174
  | --- | --- | --- |
@@ -180,11 +184,9 @@ or the engine is unreachable at run start, the run fails.
180
184
 
181
185
  | Command | Checks |
182
186
  | --- | --- |
183
- | `oxyc validate --file <path>` | JSON-schema shape, offline. Catches wrong types, a malformed `thinking` and vendor spelling. Misses unknown keys, `ref`, databases, globs, rule names, env vars |
184
- | `oxy validate --file <path>` | parses with the runtime's own parser. Structural only, with the same blind spots |
185
- | `oxy agentic run <path> -q "<question>"` | the real build and run, streamed by state. `--json`, `--thinking-mode extended_thinking`. Needs Oxy's Postgres (`OXY_DATABASE_URL`) |
186
- | `oxy test [<file>.test.yml]` | LLM-judged evals; with no file, every `*.test.yml` in the workspace |
187
- | `oxy build` | not an agent check: it does nothing any more |
187
+ | `oxyc validate --file <path>` | offline: the shape (wrong types, a malformed `thinking`), and `databases:` / `llm.ref` against `config.yml`. Misses unknown keys (the runtime ignores them too), globs, rule names, env vars. Exit `9` on a finding. (`oxy validate` is a stub that prints this command) |
188
+ | `oxyc agentic run <path> -q "<question>" --workspace <id>` | the real build and run on the deployment, of what it has compiled (push first), streamed by state. `--json`, `--thinking-mode extended_thinking`. A question exits `0` (answer with `oxyc agentic answer <run_id> -a "..."`); `error` / `cancelled` exit `1` |
189
+ | `oxyc evals run [<file>.test.yml] --workspace <id>` | LLM-judged evals on the deployment, against the compiled (pushed) test files and agents; with no file, every compiled `*.test.yml`; exit `9` under `--min-accuracy` |
188
190
 
189
191
  ## `.test.yml` (evals)
190
192
 
@@ -5,20 +5,28 @@
5
5
  # `.test.` in the file name; those paths are not deployed.
6
6
  #
7
7
  # Check the shape offline: oxyc validate --file <path>
8
- # First real check is a run: oxy agentic run <path> -q "<question>"
8
+ # First real check is a run: oxyc agentic run <path> -q "<question>" --workspace <id>
9
+ # (on the deployment, so push first)
9
10
  #
10
11
  # Every key is optional. Unknown keys, at any level, are ignored without a
11
12
  # warning by the runtime and by both validators, so spell them exactly.
13
+ #
14
+ # This file uses only keys the default (react) runtime honours. It ignores
15
+ # `states:` tuning other than `solving`'s model and thinking, `validation:`,
16
+ # `semantic_engine:` and automation files in `context:` (SKILL.md, "Runtime").
12
17
 
13
- # -- Global instructions -----------------------------------------------------
14
- # Added to the system prompt of every LLM state. Put the persona, business
15
- # conventions and the views/topics to prefer here; per-state additions go
16
- # under `states:` and are appended, not substituted.
18
+ # -- Instructions --------------------------------------------------------------
19
+ # The agent's system prompt. Put the persona, business conventions, term
20
+ # definitions and the views/topics to prefer here: it is the only place the
21
+ # default runtime reads guidance from (per-state `instructions` are ignored).
17
22
  instructions: |
18
23
  You are a revenue analytics assistant for Acme Corp.
19
24
  Report currency in USD and dates as ISO 8601.
20
25
  "Customer" means the `customers` view, not `users` (which counts seats).
26
+ "Last quarter" means the most recent completed fiscal quarter.
27
+ "MRR" is the `monthly_recurring_revenue` measure on the `revenue` view.
21
28
  Prefer measures from the semantic model over hand-written aggregations.
29
+ When you write SQL, prefer CTEs over subqueries and alias every aggregate.
22
30
 
23
31
  # IANA timezone for "today", "yesterday", "last week". Falls back to the
24
32
  # `timezone:` in config.yml, then UTC. An invalid name fails the run.
@@ -27,115 +35,51 @@ timezone: America/New_York
27
35
  # -- Connections ---------------------------------------------------------------
28
36
  # Names from config.yml `databases:`. The agent can query these PLUS every
29
37
  # database its context files reference (a view's `datasource`, a verified
30
- # query's `database:`, an automation task's `database:`). There is no fallback
31
- # to every database in config.yml: with none at all the run fails with
32
- # "no databases configured".
38
+ # query's `database:`). There is no fallback to every database in config.yml:
39
+ # with none at all the run fails with "no databases configured".
33
40
  databases:
34
41
  - warehouse
35
42
 
36
43
  # -- Context -------------------------------------------------------------------
37
- # Globs relative to THIS file's directory, bucketed by file name:
44
+ # Globs relative to the WORKSPACE ROOT (not this file's directory, if it sits
45
+ # in a subfolder), bucketed by file name:
38
46
  # *.view.yml, *.topic.yml semantic catalog
39
- # *.sql with a /* oxy: ... */ header verified query: found by the
40
- # search_automations tool, run verbatim
41
- # *.sql without that header SQL style examples for `solving`
42
- # *.md notes for `clarifying`/`interpreting`
43
- # *.automation.yml, *.procedure.yml automations the agent may pick and run
44
- # Anything else is ignored.
47
+ # *.sql with a /* oxy: ... */ header verified query, listed in the prompt
48
+ # and run verbatim when chosen
49
+ # *.sql without that header example SQL the agent can search/read
50
+ # *.md notes the agent can search/read
51
+ # Don't list automations (*.automation.yml, *.procedure.yml): the default
52
+ # runtime cannot run one as an answer and leaves them out. Anything else is
53
+ # ignored.
45
54
  context:
46
55
  - ./semantics/**/*.view.yml
47
56
  - ./semantics/**/*.topic.yml
48
57
  - ./verified_queries/*.sql
49
58
  - ./docs/glossary.md
50
- - ./automations/*.automation.yml
51
59
 
52
60
  # -- Model ---------------------------------------------------------------------
53
61
  # `ref` must equal a `name:` under config.yml `models:`; vendor, API key (a
54
62
  # workspace secret in the cloud) and base URL come from that entry. With
55
63
  # neither `ref` nor `model`, the first model in config.yml is used.
56
- # `model` fields here and under `states:` are provider model IDs, not
57
- # config.yml names.
64
+ # `model` fields here are provider model IDs, not config.yml names.
58
65
  llm:
59
66
  ref: claude
60
67
  # Leave max_tokens unset unless you need a hard cap: unset, it is sized from
61
- # the thinking setting. A value you set is used as-is.
68
+ # the thinking setting. A value you set is used as-is. Applied on Anthropic
69
+ # models only; ignored on OpenAI and OpenAI-compatible ones.
62
70
  # max_tokens: 8192
63
71
  #
64
- # Replaces the model AND the thinking setting in every state while the user
65
- # has "extended thinking" switched on. Without this block the toggle does
66
- # nothing.
72
+ # Replaces the model AND the thinking setting while the user has "extended
73
+ # thinking" switched on. Without this block the toggle does nothing.
67
74
  extended_thinking:
68
75
  model: claude-opus-4-8
69
76
  thinking:
70
77
  effort: high
71
78
 
72
79
  # -- Thinking --------------------------------------------------------------------
73
- # A global value REPLACES every state's built-in default (solving: adaptive,
74
- # all others: disabled), so prefer setting it per state below.
75
- # Forms: adaptive | disabled | effort:<level> | {effort: <level>} |
76
- # {budget_tokens: N} (Claude 4.6 and earlier; converted on newer models)
80
+ # Unset, the agent thinks adaptively. Forms: adaptive | disabled |
81
+ # effort:<level> | {effort: <level>} |
82
+ # {budget_tokens: N} (Claude 4.6 and earlier; converted on newer models)
77
83
  # Levels: low | medium | high | xhigh | max. Never `false`.
78
- # thinking: adaptive
79
-
80
- # -- Per-state overrides ---------------------------------------------------------
81
- # Honoured keys: clarifying, specifying, solving, interpreting. (`executing`
82
- # has no LLM; any other key is ignored silently.)
83
- # Fields: instructions, thinking, model (same provider as `llm:`), and
84
- # max_retries = tool-call rounds per visit before the run pauses to ask the
85
- # user whether to continue (clarifying has a fixed limit and ignores it).
86
- states:
87
- clarifying:
88
- instructions: |
89
- "Last quarter" means the most recent completed fiscal quarter.
90
- "MRR" is the `monthly_recurring_revenue` measure on the `revenue` view.
91
- model: claude-haiku-4-5
92
- specifying:
93
- max_retries: 8
94
- solving:
95
- # Runs only when the semantic model could not compile the question, so
96
- # never put guidance every answer needs here.
97
- instructions: Prefer CTEs over subqueries; alias every aggregate.
98
- thinking:
99
- effort: high
100
- max_retries: 4
101
- interpreting:
102
- thinking: disabled
103
-
104
- # -- Result checks (optional) ----------------------------------------------------
105
- # Omit the whole section to run the 15 default checks with default thresholds.
106
- # When present it REPLACES that set: only the rules listed here (and not
107
- # `enabled: false`) run, and a stage with no list is not checked at all.
108
- # This is the full default set with two thresholds tuned.
109
- validation:
110
- rules:
111
- specified:
112
- - name: metric_resolves
113
- - name: join_key_exists
114
- - name: filter_unambiguous
115
- solvable:
116
- - name: sql_syntax
117
- - name: tables_exist_in_catalog
118
- - name: spec_tables_present
119
- - name: column_refs_valid
120
- - name: timeseries_order_by_check
121
- solved:
122
- - name: non_empty
123
- - name: truncation_warning
124
- - name: no_nan_inf
125
- - name: outlier_detection
126
- threshold_sigma: 4.0
127
- min_rows: 6
128
- - name: null_ratio_check
129
- threshold: 0.3
130
- - name: duplicate_row_check
131
- - name: freshness_check
132
-
133
- # -- External semantic engine (optional) -----------------------------------------
134
- # Routes queries through Cube or Looker before Oxy's own semantic model. The
135
- # engine is pinged when a run starts; unreachable fails the run. ${VAR} is read
136
- # from the server's environment and a missing variable fails the run.
137
- #
138
- # semantic_engine:
139
- # vendor: cube # cube | looker
140
- # base_url: https://cube.example.com
141
- # api_token: "${CUBE_API_TOKEN}" # Looker: client_id + client_secret instead
84
+ thinking:
85
+ effort: medium
@@ -50,9 +50,10 @@ the run's `unsupported source kind` error is the authority.
50
50
 
51
51
  ## Source kinds: what is wired
52
52
 
53
- **Wired (16):** `rest_api`, `http_file`, `filesystem`, `google_sheets`,
53
+ **Wired (17):** `rest_api`, `http_file`, `filesystem`, `google_sheets`,
54
54
  `sql_database`, `postgres_cdc`, `clickhouse`, `toast`, `ubereats`, `sp_api`,
55
- `quickbooks`, `netsuite`, `weather`, `besttime`, `overture`, `overpass`.
55
+ `amazon_ads`, `quickbooks`, `netsuite`, `weather`, `besttime`, `overture`,
56
+ `overpass`.
56
57
 
57
58
  **Shipped by the engine but not wired — unavailable in Oxy:** `shopify`,
58
59
  `stripe`, `github`, `hubspot`, `salesforce`, `slack`, `jira`, `notion`,
@@ -127,6 +128,37 @@ provisioned under.
127
128
  nothing and refuses every named resource. A business with both accounts
128
129
  needs two pipelines.
129
130
 
131
+ ### `amazon_ads` (Amazon Ads): reports only, and slow
132
+
133
+ - **Resources:** `sp_search_term` (Sponsored Products search terms) and
134
+ `sp_placement` (campaigns by placement: `top_of_search`, `rest_of_search`,
135
+ `product_pages`, `off_amazon`), and `sp_advertised_product` (spend,
136
+ clicks and attributed sales per advertised SKU, merged on date, campaign,
137
+ ad group and SKU; airway 0.1.66 or later), and `sp_targeting` (keyword
138
+ and product targets with their bid and top-of-search impression share;
139
+ 0.1.67 or later), all daily reports. From 0.1.67 there are also eight
140
+ daily snapshots of the entity lists: `sp_campaigns`, `sp_ad_groups`,
141
+ `sp_keywords`, `sp_targets`, `sp_negative_keywords`,
142
+ `sp_negative_targets`, `sp_campaign_negative_keywords` and
143
+ `sp_product_ads`, merged on `snapshot_date` and the entity's id. One run
144
+ dates all eight the same, so join them on an equal `snapshot_date`. List
145
+ the ones you need under `resources:`: each report is its own request, and
146
+ a report can take 30 minutes or more to build. The source only reads (it
147
+ requests and downloads reports and lists entities); it never changes a
148
+ bid, budget or campaign.
149
+ - **Required:** `client_id`, `profile_id` (the advertiser profile, digits
150
+ only; a number or a string), and `default_start` (`YYYY-MM-DD`). A config
151
+ without `default_start` is refused. Amazon keeps about 90 days of these
152
+ reports, so an earlier date is clamped to that, and a later one loses
153
+ history silently.
154
+ - **`region` is `NA` only** today; another value is refused.
155
+ - **A report takes 10–50 minutes to build.** `poll_budget_minutes` (at most
156
+ 240) bounds how long one run waits. A report still pending when the run
157
+ ends is picked up by the next run, but only on a destination that commits
158
+ per write (Airhouse).
159
+ - **Previews refuse this kind:** a sample would create report jobs in the
160
+ advertiser's account.
161
+
130
162
  ## Credentials: per-kind `*_var` keys
131
163
 
132
164
  A `*_var` key names a secret **key**, never a value; the run resolves it from
@@ -139,6 +171,7 @@ not overlap — read the row for your kind, never borrow from another:**
139
171
  | `toast` | `client_id_var`, `client_secret_var` |
140
172
  | `quickbooks` | `client_secret_var`, `refresh_token_var`, `client_id_var` — or `access_token_var` alone (read-only custody) |
141
173
  | `sp_api` | `client_secret_var`, `refresh_token_var` |
174
+ | `amazon_ads` | `client_secret_var`, `refresh_token_var` |
142
175
  | `netsuite` | `private_key_var` — a multi-line PEM; the secret store must keep its newlines |
143
176
  | `clickhouse` | `password_var` |
144
177
  | `sql_database`, `postgres_cdc` | `connection_string_var` (a whole DSN) |