Skip to main content

Program Claude Code, Codex, Pi and other agent harnesses with AI SDK

By Steven Van ·

HarnessAgent ships as an experimental API on the AI SDK canary release, with Claude Code, Codex, and Pi as launch adapters.

Vercel's AI SDK 7 adds HarnessAgent, a single API for running established agent harnesses instead of building an agent loop from scratch. Initial adapters cover Claude Code, Codex, and Pi, with more planned.

Harnesses handle the parts of an agent that sit above the model call: skills, sandboxes, sessions, permission flows, compaction, runtime configuration, and sub-agents. HarnessAgent normalizes access to those, so switching from one harness to another, say from claudeCode to codex or pi, means swapping one import while the rest of the agent code stays the same. Every harness runs inside a sandboxed workspace, and both generate() and stream() return AI SDK-compatible results, so apps already using useChat can adopt HarnessAgent without changing their UI code.

HarnessAgent is available now on the AI SDK canary release as an experimental feature, with breaking changes expected between releases as the API is refined.

Vercel
Vercel
The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.
View Vercel →

Read the original announcement →

Read Program Claude Code, Codex, Pi and other agent harnesses with AI SDK on Creators Toolbox