11# ` @onkernel/cua-agent `
22
3- Kernel browser computer-use classes built on
4- [ ` @earendil-works/pi-agent-core ` ] ( https://github.com/earendil-works/pi/tree/main/packages/agent ) .
3+ Kernel browser computer-use classes built on vendored pi ` Agent ` and
4+ ` AgentHarness ` source .
55
6- This package keeps pi- agent-core semantics intact and adds browser execution
6+ This package keeps pi agent semantics intact and adds browser execution
77plumbing for canonical CUA tools.
88
99## Installation
@@ -33,12 +33,12 @@ const agent = new CuaAgent({
3333await agent .prompt (" Open news.ycombinator.com and summarize the top story." );
3434```
3535
36- ## Quick Start (` CuaHarness ` )
36+ ## Quick Start (` CuaAgentHarness ` )
3737
3838``` ts
39- import { CuaHarness } from " @onkernel/cua-agent" ;
39+ import { CuaAgentHarness } from " @onkernel/cua-agent" ;
4040
41- const harness = new CuaHarness ({
41+ const harness = new CuaAgentHarness ({
4242 browser ,
4343 client ,
4444 model: " openai:gpt-5.5" ,
@@ -54,17 +54,15 @@ lifecycle events, custom streaming, and explicit prompt/continue/queue control.
5454Reach for the harness shape when you want an app layer around the loop:
5555session/transcript helpers, resource and prompt entry points, provider/auth
5656hooks, active tool selection, compaction/tree workflows, and higher-level queue
57- events. ` CuaHarness ` is the thin CUA version of that shape today: it installs
58- CUA defaults, delegates runtime methods to the wrapped ` Agent ` , and adds
59- ` getTranscript() ` .
57+ events. ` CuaAgentHarness ` extends pi ` AgentHarness ` , installs CUA defaults, and
58+ refreshes provider-specific runtime state when ` setModel() ` changes models.
6059
6160## Core Concepts
6261
6362### Class-First API
6463
6564- ` CuaAgent extends Agent `
66- - ` CuaHarness ` wraps a pi ` Agent ` with a harness-style constructor and
67- delegated runtime methods.
65+ - ` CuaAgentHarness extends AgentHarness `
6866
6967Both classes mirror pi constructor shapes and behavior, with minimal additions:
7068- ` browser ` (Kernel browser response)
@@ -84,6 +82,17 @@ If tools are omitted, the classes install canonical CUA computer tool executors
8482using runtime specs from ` @onkernel/cua-ai ` . If tools are provided, they are
8583used exactly.
8684
85+ ### Model Switching
86+
87+ ` CuaAgent ` follows pi ` Agent ` semantics: assign ` agent.state.model ` to a
88+ concrete model or CUA model ref. CUA-owned tools and the default system prompt
89+ refresh with the new provider runtime.
90+
91+ ` CuaAgentHarness ` follows pi ` AgentHarness ` semantics: call
92+ ` await harness.setModel(model) ` . The harness updates its model through pi's
93+ snapshot machinery and refreshes CUA-owned tools and default prompt state for
94+ the next provider request.
95+
8796### Tool Composition
8897
8998Use ` createCuaComputerTools() ` to compose your own tool list from canonical
@@ -105,4 +114,4 @@ const tools = [
105114```
106115
107116For full event semantics, steering, follow-up queues, and tool execution
108- details, see the pi- agent- core README .
117+ details, see the pi agent core source vendored in this package .
0 commit comments