Add Grok 4.5 computer-use provider - #61
Merged
Merged
Conversation
rgarcia
marked this pull request as ready for review
July 13, 2026 23:34
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Off thinking maps to null
- Updated the xAI Grok 4.5 thinking map so
offnow maps tolow(instead of omitting reasoning), and adjusted the corresponding model test expectation.
- Updated the xAI Grok 4.5 thinking map so
Or push these changes by commenting:
@cursor push 5bfae1d7ba
Preview (5bfae1d7ba)
diff --git a/packages/ai/src/models.ts b/packages/ai/src/models.ts
--- a/packages/ai/src/models.ts
+++ b/packages/ai/src/models.ts
@@ -301,7 +301,7 @@
...base,
api: XAI_CUA_RESPONSES_API,
baseUrl: "https://api.x.ai/v1",
- thinkingLevelMap: { off: null, minimal: "low", xhigh: "high" },
+ thinkingLevelMap: { off: "low", minimal: "low", xhigh: "high" },
cost: { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0 },
contextWindow: 500_000,
maxTokens: 500_000,
diff --git a/packages/ai/test/models.test.ts b/packages/ai/test/models.test.ts
--- a/packages/ai/test/models.test.ts
+++ b/packages/ai/test/models.test.ts
@@ -67,7 +67,7 @@
expect(grok.baseUrl).toBe("https://api.x.ai/v1");
expect(grok.contextWindow).toBe(500_000);
expect(grok.maxTokens).toBe(500_000);
- expect(grok.thinkingLevelMap?.off).toBeNull();
+ expect(grok.thinkingLevelMap?.off).toBe("low");
expect(grok.thinkingLevelMap?.minimal).toBe("low");
expect(grok.thinkingLevelMap?.xhigh).toBe("high");
});You can send follow-ups to the cloud agent here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Missing xAI provider docs links
- Added TSDoc source links and controlling comments for both
XAI_COMPUTER_INSTRUCTIONSandcoordinateSystemin the xAI provider module.
- Added TSDoc source links and controlling comments for both
Or push these changes by commenting:
@cursor push 035a5c0c9b
Preview (035a5c0c9b)
diff --git a/packages/ai/src/providers/xai/index.ts b/packages/ai/src/providers/xai/index.ts
--- a/packages/ai/src/providers/xai/index.ts
+++ b/packages/ai/src/providers/xai/index.ts
@@ -19,6 +19,13 @@
} from "./provider";
export type { XaiResponsesOptions } from "./provider";
+/**
+ * Base instructions for xAI computer-use runs, including CUA's normalized 0-1000 coordinate contract.
+ * Sources:
+ * - https://docs.x.ai/developers/grok-4-5
+ * - https://docs.x.ai/developers/tools/function-calling
+ * - https://docs.x.ai/developers/model-capabilities/images/understanding
+ */
export const XAI_COMPUTER_INSTRUCTIONS = `You control a Kernel cloud browser through individual browser tools. Coordinates are normalized from 0 to 1000 relative to the most recent screenshot, with (0, 0) at the top left and (1000, 1000) at the bottom right. Base each action on the latest observed state and request a screenshot when you need a fresh view.`;
/**
@@ -30,6 +37,10 @@
/**
* Return the normalized coordinate contract CUA supplies to Grok function tools.
+ * Sources:
+ * - https://docs.x.ai/developers/grok-4-5
+ * - https://docs.x.ai/developers/tools/function-calling
+ * - https://docs.x.ai/developers/model-capabilities/images/understanding
*/
export function coordinateSystem(): ComputerToolCoordinateSystem {
return { type: "normalized", range: [0, 1000] };You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 42b057b. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
xai:grok-4.5catalog entry instead of maintaining a local model copylow, apply xAI's long-context pricing tier, keep browser actions serial, and continue tool loops throughprevious_response_idupdate-modelsskill with xAI model discovery, function-tool smokes, action probes, official SDK evidence, and docs drift checks; fix its pi-ai registry lookup to usegetBuiltinModelTesting
npm cinpm run typechecknpm test --workspace @onkernel/cua-ai(158 tests)npm test --workspace @onkernel/cua-agent(160 tests; live matrix skipped in unit run)npm test --workspace @onkernel/cua-cli(88 tests; TUI fixtures skipped)npm run test:integration --workspace @onkernel/cua-ai -- test/computer-tool.integration.test.ts(8 live provider tests)CuaAgentandCuaAgentHarnessbrowser smokesxai:grok-4.5quickstartnpm run build --workspace @onkernel/cua-cliNote
Medium Risk
Introduces a new live API provider path (auth, Responses threading, reasoning, and tool loops) across ai/agent/cli, though it largely mirrors the existing Meta Responses pattern and is covered by unit and integration tests.
Overview
Adds xAI Grok 4.5 as a first-class CUA provider using screenshot input and developer-supplied function tools (normalized 0–1000 coordinates), not a native computer tool—same pattern as Meta Muse.
Runtime: New
xaiprovider module andxai-cua-responsesstream wraps pi-ai’s OpenAI Responses transport withstore: true,parallel_tool_calls: false, encrypted reasoning replay, andprevious_response_idthreading (agent/harnessresponseThreadingnow includes xAI).getCuaModel("xai:grok-4.5")uses pi-ai 0.80.6’s built-in catalog entry with routing overrides (API id, thinking-level map, 200k long-context pricing tier).Surface area:
CuaProvider/ annotations /XAI_API_KEY, CLI and README examples, integration and live e2e matrices, and CI secrets forXAI_API_KEY.Tooling: The
update-modelsskill gains xAI discovery, smokes, action probes, and doc drift checks; registry lookup switches togetBuiltinModel.Reviewed by Cursor Bugbot for commit 4be7168. Bugbot is set up for automated code reviews on this repo. Configure here.