harness-agents
Skill này làm gì
Skill này mô tả cách một harness agent đầy đủ, như Claude Code, Codex hoặc Cursor, được thêm vào Agent-Native qua lớp runtime riêng của nó. Nó bao gồm việc bắt đầu một lần chạy, lưu trạng thái phiên và hiển thị công việc nền. Skill dành cho lập trình viên muốn các agent này có mặt trong ứng dụng.
Khi nào nên dùng
- ✓Khi bạn muốn Claude Code hoặc Codex chạy một tác vụ trong ứng dụng Agent-Native.
- ✓Khi một chương trình agent bên ngoài cần trạng thái phiên được lưu giữa các lượt.
- ✓Khi bạn muốn hiển thị các lần chạy agent nền trong ứng dụng.
Liên kết skill
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/harness-agents/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể để Codex chạy một tác vụ lập trình trong ứng dụng của tôi và giữ phiên để nó tiếp tục sau được không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Lập trình viên đăng ký bộ chuyển đổi harness và bắt đầu một lần chạy qua trình quản lý run. Trạng thái phiên được lưu trong cơ sở dữ liệu của ứng dụng, còn harness giữ vòng lặp riêng của nó.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
- Register or resolve a harness adapter.
import {
registerBuiltinAgentHarnesses,
resolveAgentHarness,
} from "@agent-native/core/agent/harness";
registerBuiltinAgentHarnesses();
const harness = resolveAgentHarness("ai-sdk-harness:codex");
- 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,
});
- Persist native session state in SQL.
Use saveAgentHarnessSession, updateAgentHarnessSession, and
getLatestAgentHarnessSessionForThread. The resumeState is opaque; Agent
Native stores it but does not inspect it.
- 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;installPackagesurfaces 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 throughnpxby default and the command/args are overridable because agent ACP entry flags still evolve. permissionModemaps onto ACPsession/request_permissionusing the reported tool-call kind: reads always run, edits run underallow-edits, everything risky prompts unlessallow-all. Approvals surface asapproval-requestevents; answer them through the harness session'sapprove().resumeStatecarries the ACPsessionId; resume works when the agent advertises theloadSessioncapability and degrades to a fresh session otherwise.fs/read_text_fileandfs/write_text_fileare 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
defineActionauth, request context, timeouts, truncation, and read-only metadata.
Code Execution Sandbox
- The
run-codetool executes through a pluggableSandboxAdapter(packages/core/src/coding-tools/sandbox/). The defaultLocalChildProcessAdapterspawns a locked-down local Node child process; swap it viaAGENT_NATIVE_SANDBOXor `registerSandboxAdapt
Câu hỏi thường gặp
Harness có giống nhà cung cấp mô hình không?
Không. Skill nói các harness đầy đủ tự quản lý vòng lặp và trạng thái của mình, nên chúng không được cắm vào như nhà cung cấp mô hình.
Ai có thể đọc trạng thái phiên đã lưu?
Framework lưu trạng thái mà không kiểm tra nội dung, vì Agent-Native không đọc được nội dung của trạng thái đó.
Những harness nào được hỗ trợ?
Skill nêu tên nhiều harness, gồm Claude Code, Codex, Pi, Cursor và Mastra.
Chi tiết
Mô tả gốc của tác giả
Add or use full agent harness runtimes like Claude Code, Codex, Pi, Cursor, Mastra, or ACP agents inside Agent-Native.
repo: BuilderIO/agent-native
Độ phổ biến
- Sao GitHub
- 7.6k
- Vị trí xếp hạng
- #13163
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
design-exploration
7.6kGiúp agent của bạn khám phá nhiều hướng thiết kế giao diện song song, để bạn chọn một hướng rồi tinh chỉnh thiết kế đã chọn.
visual-edit
7.6kGiúp agent của bạn mở một ứng dụng cục bộ đang chạy trong trình chỉnh sửa trực quan, để bạn xem và sửa các màn hình thật cùng nhau.
turn-into-app
7.6kBiến quy trình, bảng tính hoặc dự án thành ứng dụng trực quan có màn hình đầy đủ dữ liệu, với agent làm việc phía sau các điều khiển.
visual-plan
7.6kBiến một kế hoạch viết bằng văn bản thuần thành kế hoạch trực quan tương tác, có sơ đồ, bản đồ file, đoạn code và các câu hỏi còn mở.
Skill tương tự
add-model-provider
394kGiúp agent của bạn kết nối nhà cung cấp mô hình AI mới với OpenClaw bằng lệnh an toàn, giữ API key khỏi văn bản thuần và chạy thử.
acp-router
394kGiúp agent của bạn gửi một tác vụ đến trợ lý lập trình như Claude Code hoặc Cursor qua OpenClaw, để công việc chạy ngay trong công cụ đó.
browser-automation
394kHướng dẫn agent của bạn điều khiển trang web từng bước, gồm đăng nhập, tab và cách khôi phục khi trang ngừng phản hồi.