Skip to content

laguagu/claude-code-nextjs-skills / skills/ai-sdk-7

ai-sdk-7

Verified

Vercel AI SDK v7 development and migration. Use when building or upgrading AI SDK 7 apps, especially ToolLoopAgent, WorkflowAgent, HarnessAgent, Claude Code/Codex/Pi harnesses, runtimeContext, toolsContext, toolApproval, telemetry, reasoning, file or skill uploads, realtime, video generation, or v6-to-v7 breaking changes. For version discovery, v6 code and general doc lookup use ai-sdk.

references/harnesses.md

View on GitHub
---
title: AI SDK Harnesses
description: Use HarnessAgent to run Claude Code, Codex, Pi, and other agent harnesses.
---

# Harness runtime contracts

`HarnessAgent` runs an existing agent runtime, not a model provider. Its native
tools, permissions, compaction, workspace and conversation history belong to
that runtime. Packages/adapters are experimental; verify installed docs/types.

Choose an adapter and compatible sandbox from
[harness docs](https://ai-sdk.dev/docs/ai-sdk-harnesses/overview). Bridge-backed
adapters require a reachable network sandbox; lighter host runtimes may differ.
Do not copy sandbox runtime strings or broad permission defaults from a demo.

Configuration belongs to the reusable agent; live state belongs to a session.
Every session needs an explicit lifecycle: destroy discards resumability,
detach/stop produce opaque resume state with different runtime behavior.
Persist that state per authorized chat/session. Continue an unfinished resumed
turn before accepting a new prompt.

A harness consumes the latest user input against its own history. Replaying the
entire UI conversation is not equivalent to resuming its session. UI routes must
inject the session and persist its resume state at the appropriate completion
boundary; ordinary agent response helpers may need adaptation.

Built-in tool permissions are adapter/runtime policy; host SDK tools use
`toolApproval`. Do not assume one covers the other. Keep workspace setup,
credentials and host tools scoped to the session.

Skill bundles use skill-relative POSIX paths and are separate from provider
`uploadSkill`. Verify file-change/compaction dynamic parts in UI renderers and
exercise restart, resume, denial and cleanup in the selected adapter.

Names to look up in `ai/docs/03-ai-sdk-harnesses/` (all experimental):
`agent.createSession({ sessionId, resumeFrom, sandboxSession })`, `session.destroy()`/
`detach()`/`stop()`/`suspendTurn()`, `continueStream()`/`continueGenerate()`
for an unfinished turn, `permissionMode` (`allow-all`, `allow-edits`,
`allow-reads`) for built-in tools, `sandboxConfig` (`workDir`, `onBootstrap` +
`bootstrapHash`, `onSession`). Prefer `agent.getSandboxTemplate()`
or `createHarnessSandboxTemplate({ harnesses, sandboxConfig })` from
`@ai-sdk/harness/agent`; `prepareHarnessSandboxTemplate()` is deprecated, still
exported. Pass a caller-created `sandboxSession` to `createSession`; the caller
owns its lifecycle.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall