new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

pi/setup

8 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Pi harness adapter packages to install

To use the Pi harness adapter, install the following packages: @ai-sdk/harness, @ai-sdk/harness-pi, and @ai-sdk/sandbox-vercel.

Pi harness import statement

Import Pi harness using: import { pi, createPi } from '@ai-sdk/harness-pi'. The pi export is equivalent to createPi() with default configuration.

Pi harness basic usage example

Example code for using HarnessAgent with Pi harness: import { HarnessAgent } from '@ai-sdk/harness/agent'; import { pi } from '@ai-sdk/harness-pi'; import { createVercelSandbox } from '@ai-sdk/sandbox-vercel'; const agent = new HarnessAgent({ harness: pi, sandbox: createVercelSandbox({ runtime: 'node24', }), }); const session = await agent.createSession(); let exitCode = 0; try { const result = await agent.stream({ session, prompt: 'Check the test failures and fix the production code.', }); for await (const part of result.stream) { if (part.type === 'text-delta') { process.stdout.write(part.text); } } } catch (err) { exitCode = 1; console.error(err); } finally { await session.destroy(); process.exit(exitCode); }

Pi harness authentication methods

Pi can use AI Gateway credentials or custom provider environment variables. When no explicit auth is configured, it checks the host environment for AI_GATEWAY_API_KEY or VERCEL_OIDC_TOKEN. For multiple providers, pass auth.customEnv with standard environment pairs such as OPENAI_API_KEY, OPENAI_BASE_URL, ANTHROPIC_API_KEY, or ANTHROPIC_BASE_URL.

Pi harness authentication configuration example

Example of configuring Pi harness with AI Gateway credentials: const harness = createPi({ auth: { gateway: { apiKey: process.env.AI_GATEWAY_API_KEY, }, }, });

Pi harness sandbox requirements

Pi needs a HarnessV1SandboxProvider but does not require exposed ports. It can use a network sandbox adapter like @ai-sdk/sandbox-vercel or a local emulation like @ai-sdk/sandbox-just-bash.

Pi harness runtime information

Pi runs in the host Node.js process and uses the sandbox as a remote filesystem and shell. It does not install a bridge inside the sandbox.

Pi harness experimental status

Harness packages are experimental. Breaking changes should be expected between releases as this early API gets further refined.

Give your agent this brain