You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function tools, different coordinate systems, and different screenshot/result
18
+
contracts. `@onkernel/cua-ai` represents those differences as an explicit,
19
+
identity-keyed tool catalog. Callers choose the exact tools; provider transforms
20
+
compose only the declarations and request fields required by those identities.
33
21
34
22
All of them expect you to:
35
23
36
24
1. Run a real browser somewhere (locally is annoying, on a server is hard).
37
25
2. Translate every action into an actual SDK call against that browser.
38
-
3.Capture a fresh screenshot after each action and feed it back to the model so it can verify what happened and plan the next step.
26
+
3.Return policy-correct grounding: viewport images for browser writes, OS images for computer writes, requested data for reads, and no fresh image on failures.
39
27
4. Keep doing this in a loop until the task is done.
40
28
41
29
`cua` does all of this for you. The repo is structured as several focused npm packages so the per-provider plumbing is also reusable outside of this binary (e.g. by agents of your own spun up via [`kernel/cli`](https://github.com/kernel/cli) templates).
|[`@onkernel/cua-ai`](packages/ai)|Computer-use model catalog (`getCuaModel`/`listCuaModels`), canonical CUA tool schemas, and provider adapters/runtime specs built on pi-ai. On npm. |
81
-
|[`@onkernel/cua-agent`](packages/agent)|`CuaAgent`/`CuaAgentHarness`classes that execute cua-ai tool calls against a Kernelbrowser, screenshot loop included. On npm.|
68
+
|[`@onkernel/cua-ai`](packages/ai)|Model catalog, explicit identity-keyed CUA tool factories/toolsets, compatibility checks, and composable provider transforms. On npm. |
69
+
|[`@onkernel/cua-agent`](packages/agent)|`CuaAgent`/`CuaAgentHarness`composition wrappers with dynamic `setTools()` and shared Kernel-browser execution resources. On npm. |
Copy file name to clipboardExpand all lines: docs/agent-tool-configuration-spec.md
+26-29Lines changed: 26 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# Agent Tool Configuration
2
2
3
-
**Status:** Draft for later review
3
+
**Status:** Implemented
4
+
4
5
**Scope:**`@onkernel/cua-agent` and the tool-building surface in `@onkernel/cua-ai`
5
6
**Compatibility:** Not a goal; these packages are alpha and may make breaking API changes.
6
7
@@ -17,7 +18,7 @@ The array may contain:
17
18
18
19
Provider-recommended tools are intentionally distinct from CUA-authored tools. The former reproduce the basic tools or schemas a model provider recommends in its computer-use examples; the latter are additional capabilities designed and maintained by CUA. A caller should be able to combine either category with custom application tools while seeing exactly what the model receives.
19
20
20
-
The current`extraTools`, `mode`, `nativeTool`, and `playwright` constructor options should be removed. `activeToolNames`, `setActiveTools()`, `setMode()`, `getMode()`, `computer_use_extra`, and CUA-generated default system prompts should also be removed. No global or derived mode should replace them.
21
+
The former`extraTools`, `mode`, `nativeTool`, and `playwright` constructor options are removed. `activeToolNames`, `setActiveTools()`, `setMode()`, `getMode()`, `computer_use_extra`, and CUA-generated default system prompts are also removed. No global or derived mode replaces them.
21
22
22
23
Each CUA tool specification must contain enough information to build, expose, execute, and describe that tool independently. Convenience toolsets may return arrays of tool specifications, but they must not establish hidden runtime state or add undeclared tools.
23
24
@@ -79,7 +80,7 @@ This terminology must also be used consistently in the architecture document, pa
79
80
- Silently replacing incompatible tools when the model changes
80
81
- Preserving CUA's current default system prompts
81
82
82
-
## Proposed public namespace
83
+
## Public namespace
83
84
84
85
Tool factories and toolsets should be exported through one discoverable namespace rather than as a collection of global functions.
85
86
@@ -118,7 +119,7 @@ The distinction is deliberate:
118
119
119
120
The exact property names may be refined, but the final exports must remain namespaced, autocomplete-friendly, and free of a large flat list of package-level tool factory functions.
120
121
121
-
## Proposed constructor API
122
+
## Constructor API
122
123
123
124
Both constructors accept one required top-level `tools` array:
124
125
@@ -331,7 +332,7 @@ A tool specification has a stable identity and a preferred model-facing name. Th
331
332
332
333
Composition sees the complete requested list and must detect name collisions before the first request. It must never silently shadow a tool.
333
334
334
-
The naming policy is a design blocker that must be resolved before implementation. Candidate behavior is:
335
+
The implemented naming policy is:
335
336
336
337
1. Keep preferred provider-recommended names when unique.
337
338
2. Reject collisions by default with an error naming both tool identities.
@@ -341,7 +342,7 @@ The naming policy is a design blocker that must be resolved before implementatio
341
342
342
343
A toolset factory should not need hidden global state. The central composer sees all expanded tool specs and applies the collision policy. A toolset may expose explicit naming or namespace options, but automatic context-sensitive aliasing must not make the resulting catalog unpredictable.
343
344
344
-
This policy must be prototyped with provider-recommended computer tools plus CUA browser tools before implementation begins.
345
+
Catalog tests cover provider-recommended computer tools composed with CUA browser and caller tools.
345
346
346
347
## Tools and actions
347
348
@@ -365,7 +366,7 @@ Examples:
365
366
366
367
An operation selected through a tool's arguments.
367
368
368
-
Current or proposed action-bearing tools include:
369
+
Current action-bearing tools include:
369
370
370
371
- provider-native computer and browser tools, which use an `action` discriminator
371
372
-`computer_batch`, which accepts an ordered `actions` array
@@ -392,15 +393,15 @@ A CUA or provider-recommended toolset may choose and document a default batch co
392
393
393
394
### Browser batch
394
395
395
-
CUA should offer a browser-plane equivalent that does not dispatch OS computer-use input:
396
+
CUA offers a browser-plane equivalent that does not dispatch OS computer-use input:
The browser batch would execute browser/CDP operations and return their ordered read results. Its action schema, ref lifetime behavior, failure short-circuiting, and result grounding must be specified explicitly.
404
+
The browser batch executes browser/CDP operations sequentially over one shared ref table and returns ordered read results. It short-circuits on the first failed or unsatisfied boundary, reports the failed index and skipped count, and follows the browser result-grounding policy.
404
405
405
406
### Browser batch versus browser act
406
407
@@ -409,7 +410,7 @@ The browser batch would execute browser/CDP operations and return their ordered
409
410
-`browser_batch` is a mechanical ordered container for explicitly selected browser actions and read results.
410
411
-`browser_act` is a dependent plan with per-step and final semantic expectations, causal outcomes, deadlines, stop reasons, and stable successor feedback.
411
412
412
-
The overlap still needs a design review before implementation. In particular, the design must decide whether ref-producing reads can feed later actions inside one batch and whether a simpler batch should instead be a restricted form of the action-plan tool.
413
+
The implemented batch is intentionally not a restricted action-plan tool. Ref-producing reads update the shared ref table before later actions, but the input has no interpolation, saved-value, branch, or workflow syntax. `browser_act` remains the semantic planning surface.
413
414
414
415
### Native action restrictions
415
416
@@ -522,11 +523,11 @@ A provider capability description may include:
522
523
523
524
Coordinate uncertainty in one computer tool must not disable coordinate-free browser tools such as snapshots, refs, semantic waits, or action plans.
524
525
525
-
Tzafon and Yutori require adapter changes before arbitrary composition is safe because their current payload hooks replace or suppress tools by name. That limitation should be reported against the affected requested tools, not represented as a blanket rejection of browser or mixed configurations.
526
+
Tzafon and Yutori adapters compose by selected identity: Tzafon replaces only its native computer placeholder, while Yutori removes only selected native placeholders and preserves unrelated function tools.
526
527
527
528
## Removal of `computer_use_extra`
528
529
529
-
`computer_use_extra`should be deleted entirely: definition, executor, implicit installation, exports, tests, and documentation.
No replacement navigation helper is added automatically or under a new hidden name. A caller who needs navigation chooses an explicit capability, such as:
532
533
@@ -564,7 +565,7 @@ CUA must not silently drop tools, substitute a different toolset, append fallbac
564
565
565
566
## Removal of current API
566
567
567
-
The following constructor options should be removed rather than deprecated:
568
+
The following constructor options are removed rather than deprecated:
568
569
569
570
```ts
570
571
extraTools
@@ -574,15 +575,15 @@ playwright
574
575
activeToolNames
575
576
```
576
577
577
-
The following methods should be removed from the CUA-facing API:
578
+
The following methods are removed from the CUA-facing API:
578
579
579
580
```ts
580
581
setMode()
581
582
getMode()
582
583
setActiveTools()
583
584
```
584
585
585
-
`computer_use_extra` and CUA-generated default system prompts should be removed with them.
586
+
`computer_use_extra` and CUA-generated default system prompts are removed with them.
586
587
587
588
Their replacements are direct tool-list entries:
588
589
@@ -598,7 +599,7 @@ Their replacements are direct tool-list entries:
598
599
599
600
## Documentation requirements
600
601
601
-
The future implementation must update:
602
+
The implementation updates:
602
603
603
604
-`docs/architecture.md` with the tool-spec composition and provider-adapter ownership boundaries
604
605
- package READMEs with exact constructor examples and no legacy mode terminology
@@ -607,19 +608,15 @@ The future implementation must update:
607
608
608
609
Provider-recommended toolsets must link to or name the provider guidance they mirror. CUA-authored additions must be described as CUA capabilities rather than provider defaults.
609
610
610
-
## Design blockers before implementation
611
-
612
-
No implementation should begin until these questions have concrete prototypes or decisions:
613
-
614
-
1.**Name composition:** reject versus explicitly alias collisions, especially when provider-native names are fixed.
615
-
2.**Payload transforms:** compose native and function tools without classifying them by ambiguous model-facing names.
616
-
3.**Grounding ownership:** define post-action browser viewport versus OS display capture per tool, including mixed tool lists.
617
-
4.**Batch overlap:** settle the relationship among `computer_batch`, `browser_batch`, and `browser_act`, including intra-batch ref flow.
618
-
5.**Dynamic loading:** map `setTools()` onto pi's additive deferred-loading protocol while preserving CUA executors and session history.
619
-
6.**Shared resources:** share translators, CDP state, and refs without deriving a mode or allowing one tool to mutate another's public contract.
620
-
7.**Provider-recommended exports:** decide exactly which official or example tool shapes each provider namespace promises to mirror and how those promises are tested.
611
+
## Implemented design resolutions
621
612
622
-
These are architecture questions, not implementation details. The spec should be revisited after focused spikes for naming, Tzafon/Yutori payload composition, mixed grounding, and cache-preserving dynamic loading.
613
+
1.**Name composition:** exact and provider-normalized collisions reject; caller aliases/namespaces are explicit; native names are fixed.
614
+
2.**Payload transforms:** transforms consume stable identities, declare static write claims, and compose in a fixed phase order.
615
+
3.**Grounding ownership:** each tool carries browser, computer, request-grounded, read, or failure behavior as data.
616
+
4.**Batch overlap:** batches are mechanical; `browser_act` remains semantic; browser batches share ref state without a workflow DSL.
617
+
5.**Dynamic loading:**`setTools()` uses pi 0.80.10 additive markers only for final, cache-preserving in-tool additions; other changes are eager.
618
+
6.**Shared resources:** one resource pool survives tool/model changes and owns the translator and lazy CDP executor.
619
+
7.**Provider-recommended exports:** namespaced Anthropic, Google, Meta, xAI, Moonshot, Tzafon, and Yutori surfaces are tested against their declared contracts.
623
620
624
621
## Decisions recorded
625
622
@@ -632,7 +629,7 @@ These are architecture questions, not implementation details. The spec should be
632
629
-`browser_act` remains outside `cua.toolsets.browser()` until it has broader production evidence.
633
630
- Naming, payload-transform composition, grounding, and batch overlap must be resolved before code is written.
634
631
635
-
## Acceptance criteria for a future implementation
632
+
## Acceptance criteria
636
633
637
634
- Both constructors have one required tool-selection source of truth and accept `tools: []`.
638
635
- The current tool-related constructor options, active-tool option, and mode methods are removed.
0 commit comments