+
Grok Build — {exampleLabel}
+
+ chat id: {chatId}
+
+
+
+ {messages.map(message => (
+
+
{message.role === 'user' ? 'You: ' : 'AI: '}
+ {message.parts.map((part, index) => {
+ switch (part.type) {
+ case 'text': {
+ return (
+
+ {part.text}
+
+ );
+ }
+ case 'reasoning': {
+ return (
+
+ {part.text}
+
+ );
+ }
+ case 'file':
+ case 'reasoning-file': {
+ if (part.mediaType.startsWith('image/')) {
+ return (
+ // eslint-disable-next-line @next/next/no-img-element
+

+ );
+ }
+ return null;
+ }
+ case 'tool-bash': {
+ return
;
+ }
+ case 'dynamic-tool': {
+ if (part.toolName === 'fileChange') {
+ if (typeof part.input !== 'object' || part.input === null) {
+ return null;
+ }
+ return (
+
+ );
+ }
+ return
;
+ }
+ }
+ })}
+
+ ))}
+
+ {status === 'submitted' && (
+
+ )}
+
+ {error && (
+
+
+ {error.message || String(error)}
+
+
+
+ )}
+
+
+
+
sendMessage({ text })}
+ />
+
+ );
+}
diff --git a/examples/harness-e2e-next/package.json b/examples/harness-e2e-next/package.json
index d18ffc262242..15148291ff19 100644
--- a/examples/harness-e2e-next/package.json
+++ b/examples/harness-e2e-next/package.json
@@ -12,6 +12,7 @@
"@ai-sdk/harness": "workspace:*",
"@ai-sdk/harness-claude-code": "workspace:*",
"@ai-sdk/harness-codex": "workspace:*",
+ "@ai-sdk/harness-grok-build": "workspace:*",
"@ai-sdk/harness-pi": "workspace:*",
"@ai-sdk/provider-utils": "workspace:*",
"@ai-sdk/react": "workspace:*",
diff --git a/examples/harness-e2e-tui/agents/grok-build/ai-sdk-coding-agent.ts b/examples/harness-e2e-tui/agents/grok-build/ai-sdk-coding-agent.ts
new file mode 100644
index 000000000000..17088d4ab740
--- /dev/null
+++ b/examples/harness-e2e-tui/agents/grok-build/ai-sdk-coding-agent.ts
@@ -0,0 +1,52 @@
+import { HarnessAgent } from '@ai-sdk/harness/agent';
+import { grokBuild } from '@ai-sdk/harness-grok-build';
+import { createVercelSandbox } from '@ai-sdk/sandbox-vercel';
+import type { InferUITools, UIMessage } from 'ai';
+
+// Default sandbox resources won't allow for a full parallel build of all packages.
+// Not worth bumping all demo sandboxes' resources for just this, we can easily
+// work around this by guiding the harness.
+const instructions = `
+Building all packages at once (e.g. running \`pnpm build\` or \`pnpm build:packages\`)
+will exceed sandbox memory. When asked to do this, use the corresponding
+\`pnpm exec turbo\` call directly with a lower \`--concurrency=4\` flag.
+`;
+
+export const aiSdkCodingGrokBuildHarnessAgent = new HarnessAgent({
+ harness: grokBuild,
+ instructions,
+ sandbox: createVercelSandbox({
+ runtime: 'node24',
+ ports: [4000],
+ }),
+ onSandboxSession: async ({ session, sessionWorkDir, abortSignal }) => {
+ const result = await session.run({
+ command:
+ 'test -d .git || git clone --depth 1 https://github.com/vercel/ai.git .',
+ workingDirectory: sessionWorkDir,
+ abortSignal,
+ });
+ if (result.exitCode !== 0) {
+ throw new Error(
+ `Failed to clone vercel/ai (exit ${result.exitCode}): ${result.stderr}`,
+ );
+ }
+
+ const installResult = await session.run({
+ command: 'test -d node_modules || pnpm install',
+ workingDirectory: sessionWorkDir,
+ abortSignal,
+ });
+ if (installResult.exitCode !== 0) {
+ throw new Error(
+ `Failed to install dependencies (exit ${installResult.exitCode}): ${installResult.stderr}`,
+ );
+ }
+ },
+});
+
+export type AiSdkCodingGrokBuildHarnessAgentMessage = UIMessage<
+ unknown,
+ never,
+ InferUITools