Introducing Agent Client Protocol Support for Mastra Agents

Delegate coding tasks to Claude Agent, Codex CLI, Cursor, or any ACP-compatible harness.

Paul ScanlonPaul Scanlon·

Jun 2, 2026

·

2 min read

Mastra agents now support the Agent Client Protocol (ACP). Run Claude Agent, Codex CLI, Cursor, Gemini CLI, or any other compatible harness directly from your Mastra agents.

Delegate coding tasks to a harness with specialized tools you'd otherwise have to build yourself: codebase reasoning, file editing, shell execution, self-correcting test loops, and Git operations.

The Mastra agent is the supervisor that orchestrates the run, providing skills and context before handing off to a subagent and harness to complete the task.

Get started

Install the ACP package:

npm install @mastra/acp
note

Requires @mastra/core@1.34.0 or later, added in PR #16423.

Create an AcpAgent with an ACP-compatible harness and a workspace filesystem where the work can be completed safely.

Then attach it to your Mastra agent following the subagent pattern. Add skills to the supervisor's workspace with instructions explaining how to delegate coding tasks.

TypeScriptsrc/mastra/agents/supervisor-agent.ts
import { Agent } from "@mastra/core/agent";
import { AcpAgent } from "@mastra/acp";
import { Workspace, LocalFilesystem } from "@mastra/core/workspace";
 
const TARGET_REPO = "/path/to/your/local/repo";
const BASE_PATH = process.cwd();
 
// Subagent with harness
const claudeAgent = new AcpAgent({
  id: "claude-agent",
  name: "Claude Agent",
  description: "Claude Agent, enabled over the Agent Client Protocol",
  command: "npx",
  args: ["-y", "@agentclientprotocol/claude-agent-acp"],
  cwd: TARGET_REPO,
  workspace: new Workspace({
    id: "claude-agent-workspace",
    filesystem: new LocalFilesystem({ basePath: TARGET_REPO })
  })
});
 
// Supervisor agent
export const supervisorAgent = new Agent({
  id: "supervisor-agent",
  name: "Supervisor Agent",
  description: "Plans and delegates coding tasks to Claude Agent",
  instructions: `
    Delegate code tasks to the claude-agent subagent,
    including any relevant skills in the prompt.`,
  model: "anthropic/claude-sonnet-4-5",
  workspace: new Workspace({
    id: "supervisor-workspace",
    filesystem: new LocalFilesystem({
      basePath: BASE_PATH,
      readOnly: true
    }),
    skills: [
      "skills/frontend-design",
      "skills/web-design-guidelines"
    ]
  }),
  agents: {
    claudeAgent
  }
});

See the ACP registry for more ACP-compatible harnesses.

Production config

When running in production, clone a target repo and set cwd to point to its location on disk:

TypeScriptsrc/mastra/agents/supervisor-agent.ts
// Location of cloned repo
const REPO_PATH = "/var/app/repos/your-project";
 
const claudeAgent = new AcpAgent({
  //…
  command: "npx",
  args: ["-y", "@agentclientprotocol/claude-agent-acp"],
  cwd: REPO_PATH,
  workspace: new Workspace({
    id: "claude-agent-workspace",
    filesystem: new LocalFilesystem({ basePath: REPO_PATH })
  })
});

For more information and full configuration options, see:

Share:
Paul Scanlon
Paul ScanlonTechnical Product Marketing Manager

Paul Scanlon sits between Developer Education and Product Marketing at Mastra. Previously, he was a Technical Product Marketing Manager at Neon and worked in Developer Relations at Gatsby, where he created educational content and developer experiences.

All articles by Paul Scanlon