KaibanJS ExternalCodingAgent with Claude Code and OpenCode
Discover how KaibanJS can delegate team tasks to external coding platforms like Claude Code and OpenCode while preserving native workflow orchestration, task chaining, and structured agent roles. This example shows how modern coding-native AI tools can become execution backends for real KaibanJS teams.

Why External Coding Platforms Matter
Coding-native AI tools such as Claude Code and OpenCode are quickly becoming part of the modern developer stack because they operate directly on real repositories, understand project context, and work through the same CLI surfaces engineers already trust. They are not just chat interfaces: they are execution environments for reading code, following instructions, and producing tangible engineering output.
ExternalCodingAgent brings that momentum into KaibanJS. Instead of replacing KaibanJS orchestration, it extends it. Your team still defines agents, tasks, sequencing, and expected outputs in the KaibanJS way, but each task can now be executed by an external coding CLI that is purpose-built for repository work.
The result is a powerful hybrid model: KaibanJS remains the orchestrator, while external coding tools become the specialists that execute implementation-oriented work with strong workspace awareness.
The Challenge: Orchestrating Coding-Native AI Reliably
External coding tools are incredibly capable, but teams still need a structured way to coordinate them, split responsibilities, and pass results across a reproducible workflow.
Single-Agent Bottlenecks
A coding CLI may be strong on execution, but complex workflows still need separate roles for exploration, critique, verification, and handoff.
Fragile Prompt Handoffs
Without orchestration, moving outputs from one step to the next becomes ad hoc, hard to trace, and difficult to reuse in repeatable engineering workflows.
Backend Switching Friction
Teams often want to compare Claude Code, OpenCode, or a safe mock mode, but doing that manually usually means rewriting scripts or changing execution logic.
Missing Workflow Visibility
Developers need a normal KaibanJS team experience, not a pile of disconnected CLI calls. Coordination, task boundaries, and output contracts still matter.
The Solution: KaibanJS Orchestration, External CLI Execution
The new agent type delegates the final task execution to an external coding backend, but keeps KaibanJS in charge of the team structure. This means you can model a workflow exactly as you would with any other KaibanJS team and simply swap the execution layer.
Backend-Aware Agent Type
ExternalCodingAgent supports claude-code, opencode, and mock backends without changing the team design.
Native KaibanJS Task Flow
The team still defines ordered tasks, expected outputs, agent personas, and interpolated prompts. External execution plugs into the same workflow lifecycle.
Repository-First Execution
Each task runs in a real workspace through a coding CLI, giving the external agent direct repository context instead of a simplified chatbot abstraction.
Safe Demo Mode
The mock backend echoes the interpolated prompt, making it easy to validate wiring, prompt construction, and task chaining before invoking a real external CLI.
Integration Architecture
How a normal KaibanJS team hands execution to Claude Code or OpenCode in the playground example
Select the backend
The playground resolves KAIBAN_CODING_BACKEND from the environment and falls back to PLAYGROUND_DEFAULT_BACKEND in index.ts. That lets the same team run against Claude Code, OpenCode, or a mock executor.
Instantiate ExternalCodingAgent workers
Two agents are created: RepoExplorer and AnswerReviewer. Both share the same backend settings, workspace root, timeout, and optional CLI path, but each keeps its own role, goal, and background for clear team semantics.
Build prompts with normal KaibanJS interpolation
The first task answers the input question. The second task reads the first result through {taskResult:task1}, showing that external coding backends still participate in standard KaibanJS task chaining.
Delegate the prompt to the selected CLI
The agent implementation packages the task prompt and invokes the backend-specific runner. For Claude Code, the example uses useBare: true and allowedTools: 'Read' for deterministic, repository-aware scripted runs.
Return results to the KaibanJS workflow
The external CLI output becomes the task result, KaibanJS updates agent status as usual, and the overall team completes like any other workflow. In other words, the execution surface changes, but the orchestration contract stays native.
Key Components
- ✓ExternalCodingAgent: Agent type that wraps external coding backends while exposing the standard KaibanJS agent interface
- ✓Backend resolver: Supports
claude-code,opencode, andmockselection - ✓CLI drivers: Backend-specific runners for Claude Code and OpenCode translate task prompts into real CLI invocations
- ✓Prompt interpolation: Team inputs and prior task results are compiled into the final prompt before delegation
- ✓Workspace root: Each backend runs inside the target repository so coding agents operate on real project context
- ✓Mock mode: Useful for demos, tests, and wiring verification before enabling expensive or stateful CLI execution
Playground Implementation Details
The demo is intentionally small, but it highlights the essential design pattern for coding-native orchestration in KaibanJS.
Team Design in the Playground
The example runs a compact two-step team that feels like a normal KaibanJS workflow:
- RepoExplorer receives
{question}and answers it using the repository context exposed to the selected external coding backend - AnswerReviewer reads the previous result via
{taskResult:task1}and adds strengths, gaps, and a concrete follow-up question
This is the important point: even when tasks execute in Claude Code or OpenCode, the workflow remains structured by KaibanJS.
Backend-Specific Behavior
The playground demonstrates practical nuances for each backend:
- 1.Claude Code: configured with
useBare: trueandallowedTools: 'Read'to support controlled scripted repository analysis - 2.OpenCode: can be selected with the same team shape and optional model configuration, proving the orchestration layer is backend-agnostic
- 3.Mock: echoes the interpolated prompt so you can inspect exactly what would be sent to a real coding CLI
Why This Is a Strategic Addition to KaibanJS
Coding-native execution
KaibanJS can now orchestrate work that is explicitly designed for repository-centric coding agents, not only general-purpose LLM calls.
Same team, multiple surfaces
Developers can keep their KaibanJS mental model while choosing the execution backend that best fits the task or runtime environment.
Interoperable ecosystem signal
Alongside A2A, MCP, and OpenClaw integrations, ExternalCodingAgent reinforces KaibanJS as a framework that integrates with the real AI developer stack.
Demo: KaibanJS Team Running Through External Coding Platforms
Watch the playground execute a standard KaibanJS team while routing each task through Claude Code or OpenCode, including task-result handoff and backend selection.
Demo: ExternalCodingAgent Playground
The demo shows the practical pattern behind this new agent type: define a team once, choose the backend, let KaibanJS orchestrate task sequencing, and let an external coding CLI execute the work inside a real repository context.
View Source Code on GitHubGetting Started with ExternalCodingAgent
Run the playground locally and test the same KaibanJS team against different coding-native backends.
1. Clone, install, and build
git clone https://github.com/kaiban-ai/KaibanJS.git
cd KaibanJS
npm install
npm run build
cd playground/external-coding-agents
npm install2. Choose a backend
Set the default in index.ts or override it with KAIBAN_CODING_BACKEND.
# index.ts
const PLAYGROUND_DEFAULT_BACKEND = 'claude-code'
# or in .env
KAIBAN_CODING_BACKEND=opencode3. Configure the CLI you want to use
Claude Code requires ANTHROPIC_API_KEY. If either CLI is not on your system path, point KaibanJS to the executable explicitly.
ANTHROPIC_API_KEY=...
KAIBAN_CLAUDE_CLI=/full/path/to/claude
KAIBAN_OPENCODE_CLI=/full/path/to/opencode4. Start the playground
npm startUse the mock backend first if you want to inspect the exact prompts and team wiring before running a real coding CLI.
Explore Related KaibanJS Integrations
ExternalCodingAgent is part of a broader interoperability story in KaibanJS: open standards, external tools, and production-friendly execution patterns.
KaibanJS Team as OpenClaw Agent
See how a full KaibanJS team can act as an OpenClaw backend through the OpenResponses API.
Read the OpenResponses example →KaibanJS Team as Native OpenClaw Plugin
Compare this pattern with a tool-based integration where OpenClaw calls a KaibanJS team as a native plugin.
Read the plugin example →Build KaibanJS Teams That Run on Today's Coding Agents
ExternalCodingAgent lets you keep KaibanJS orchestration while tapping into the momentum of coding-native AI tools. Model the workflow once, choose the backend that fits, and ship faster.
We’re almost there! 🌟 Help us hit 100 stars!
Star KaibanJS - Only 100 to go! ⭐