本文へスキップ
Skillpedia
エージェント7.6k · #13163

harness-agents

できること

このスキルは、Claude Code、Codex、Cursor などの本格的なエージェントのハーネスを、Agent-Native の実行基盤を通して追加する方法を説明します。実行の開始、セッション状態の保存、バックグラウンド作業の表示を扱います。アプリの中でこれらのエージェントを使いたい開発者向けです。

使う場面

  • ✓Claude Code や Codex にアプリ内でタスクを実行させたいとき。
  • ✓外部のエージェントプログラムで、ターン間のセッション状態を保存する必要があるとき。
  • ✓バックグラウンドで実行中のエージェントの作業をアプリに表示したいとき。

スキルのリンク

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/harness-agents/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/harness-agents/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“Codex にアプリ内でコーディングタスクを実行させてもらえますか。後で続けられるように、セッションも保持してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

開発者はハーネスのアダプターを登録し、実行マネージャーを通じて実行を開始します。セッション状態はアプリのデータベースに保存され、ハーネス自身が独自のループを保ちます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Harness Agents

Rule

Full agent harnesses are not AgentEngine providers. Use the AgentHarness substrate in @agent-native/core/agent/harness.

Why

AgentEngine is for one model round trip beneath runAgentLoop. Harnesses like Claude Code, Codex, Pi, Cursor, and Mastra own their own loop, workspace, native tools, session state, compaction, approval model, and sandbox behavior. Putting a harness under AgentEngine.stream() double-runs the loop and loses session lifecycle semantics.

How

  1. Register or resolve a harness adapter.
import {
  registerBuiltinAgentHarnesses,
  resolveAgentHarness,
} from "@agent-native/core/agent/harness";

registerBuiltinAgentHarnesses();
const harness = resolveAgentHarness("ai-sdk-harness:codex");
  1. Start a turn through the run-manager bridge.
import { startAgentHarnessRun } from "@agent-native/core/agent/harness";

startAgentHarnessRun({
  runId,
  threadId,
  adapter: harness,
  input: { prompt },
  createSession: {
    sessionId,
    resumeState,
    instructions,
    sandbox,
    permissionMode: "allow-reads",
  },
  ownerEmail,
  orgId,
});
  1. Persist native session state in SQL.

Use saveAgentHarnessSession, updateAgentHarnessSession, and getLatestAgentHarnessSessionForThread. The resumeState is opaque; Agent Native stores it but does not inspect it.

  1. Surface runs through background agents.

Harness runs are projected into the shared BackgroundAgentRun shape with createAgentHarnessBackgroundAgentController() and are available through the existing run routes as goalId=agent-harness.

ACP Agents

Agent-Native can act as an ACP (Agent Client Protocol) client and drive a local coding agent — Gemini CLI, Claude Code, or any ACP-compliant agent — through this same substrate. This is scoped to local coding: the agent is spawned as a child process speaking newline-delimited JSON-RPC over stdio, and inherits the parent environment so it reuses the user's local CLI login. It is not a hosted/sandboxed transport, and it is not a chat/A2A transport.

import {
  registerBuiltinAgentHarnesses,
  resolveAgentHarness,
} from "@agent-native/core/agent/harness";

registerBuiltinAgentHarnesses();

// Built-in presets (commands overridable via the resolve config):
const gemini = resolveAgentHarness("acp:gemini");
const claude = resolveAgentHarness("acp:claude-code");

// Or any ACP agent by command:
const custom = resolveAgentHarness("acp", {
  command: "gemini",
  args: ["--experimental-acp"],
});
  • The protocol transport (@zed-industries/agent-client-protocol) is an optional dependency loaded lazily; installPackage surfaces a clear install hint.
  • The agent binary (e.g. @google/gemini-cli, @zed-industries/claude-code-acp) is a separate external CLI the user installs; presets launch it through npx by default and the command/args are overridable because agent ACP entry flags still evolve.
  • permissionMode maps onto ACP session/request_permission using the reported tool-call kind: reads always run, edits run under allow-edits, everything risky prompts unless allow-all. Approvals surface as approval-request events; answer them through the harness session's approve().
  • resumeState carries the ACP sessionId; resume works when the agent advertises the loadSession capability and degrades to a fresh session otherwise.
  • fs/read_text_file and fs/write_text_file are served against the session workspace and refuse paths that escape it; terminal methods are not advertised (the agent uses its own shell).

Adapter Guidance

  • Keep harness packages optional. Use dynamic imports in adapters and expose an install hint through installPackage.
  • Use the AI SDK harness adapter as one implementation, not as Agent-Native's public abstraction.
  • For bridge-backed coding harnesses, require a real sandbox/workspace provider. Do not run arbitrary coding agents in the host process by default.
  • Pass only a narrow, intentional set of Agent-Native actions as host tools. Preserve defineAction auth, request context, timeouts, truncation, and read-only metadata.

Code Execution Sandbox

  • The run-code tool executes through a pluggable SandboxAdapter (packages/core/src/coding-tools/sandbox/). The default LocalChildProcessAdapter spawns a locked-down local Node child process; swap it via AGENT_NATIVE_SANDBOX or `registerSandboxAdapt
よくある質問

ハーネスはモデルのプロバイダーと同じものですか?

いいえ。スキルによれば、ハーネスは独自のループと状態を持つため、モデルのプロバイダーとしては差し込まれません。

保存されたセッション状態は誰が読めますか?

フレームワークは中身を確認せずに保存します。その状態は Agent-Native からは中身が見えません。

どのハーネスに対応していますか?

スキルは、Claude Code、Codex、Pi、Cursor、Mastra など複数の名前を挙げています。

詳細

作者による元の説明

Add or use full agent harness runtimes like Claude Code, Codex, Pi, Cursor, Mastra, or ACP agents inside Agent-Native.

repo: BuilderIO/agent-native

人気

GitHubのスター
7.6k
ランキング
#13163
ライセンス
MIT
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル