Program Claude Code, Codex, Pi and other agent harnesses with AI SDK
Write your agent once. Switch harnesses without rewriting—Vercel's AI SDK 7 just made Claude Code, Codex, and Pi interchangeable.

Why it matters
Vercel's new HarnessAgent abstraction reduces vendor lock-in for agent builders, letting teams swap between different agent execution environments (Claude Code, Codex, Pi) without rewriting application logic. This lowers friction for enterprises evaluating multiple agent platforms and accelerates adoption of agentic workflows.
The key facts
6 to knowAI SDK 7 introduces HarnessAgent API for unified agent harness programming
Supports Claude Code, Codex, and Pi harnesses with more coming soon
Harnesses manage skills, sandboxes, sessions, permissions, runtime config, and sub-agents
HarnessAgent.generate() and HarnessAgent.stream() return AI SDK-compatible results
Available on AI SDK canary release
Drop-in compatible with existing useChatHat and AI SDK tooling—no UI code changes required
Go to the source
Vercel Blogvercel.com
Publisher excerpt: introduces , a single API for running established agent harnesses, including Claude Code, Codex, and Pi. AI SDK has always let you switch models without rewriting your agent. Now you can switch the harness the same way.AI SDK 7HarnessAgent Write the agent once. Use the best harness available.…

