Aller au contenu
Skillpedia
Agents7.6k · #13163

harness-agents

Ce qu’il fait

Cette compétence décrit comment un harnais d'agent complet, comme Claude Code, Codex ou Cursor, est ajouté à Agent-Native par sa propre couche d'exécution. Elle couvre le lancement d'une exécution, la sauvegarde de l'état de session et l'affichage des tâches en arrière-plan. Elle s'adresse aux développeurs qui veulent ces agents dans une application.

Quand l’utiliser

  • ✓Quand vous voulez que Claude Code ou Codex réalise une tâche dans une application Agent-Native.
  • ✓Quand un programme d'agent externe doit conserver son état de session entre les tours.
  • ✓Quand vous voulez afficher les exécutions d'agent en arrière-plan dans l'application.

Lien du skill

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

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/harness-agents/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Peux-tu laisser Codex exécuter une tâche de code dans mon application et conserver sa session pour qu'il puisse reprendre plus tard ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

Le développeur enregistre l'adaptateur du harnais et démarre une exécution via le gestionnaire d'exécutions. L'état de session est enregistré dans la base de données de l'application, et le harnais conserve sa propre boucle.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis 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
Questions fréquentes

Un harnais est-il la même chose qu'un fournisseur de modèle ?

Non. La compétence indique que les harnais complets possèdent leur propre boucle et leur état, ils ne sont donc pas branchés comme des fournisseurs de modèle.

Qui peut lire l'état de session enregistré ?

Le framework le stocke sans l'inspecter, car cet état est opaque pour Agent-Native.

Quels harnais sont pris en charge ?

La compétence en cite plusieurs, dont Claude Code, Codex, Pi, Cursor et Mastra.

Détails

Description originale de l’auteur

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

repo: BuilderIO/agent-native

Popularité

Étoiles GitHub
7.6k
Position au classement
#13163
Licence
MIT
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires