Coder Integration
OpenFlows is a thin orchestration brain that runs on top of a self-hosted Coder deployment. Coder is the runtime. OpenFlows does not provision virtual machines, manage SSH keys, host models, or maintain a user directory. It tells Coder to create a workspace, binds a worker to it, and then coordinates the agents through the Coder API. When the ticket is done, it tells Coder to destroy the workspace. Everything that is hard about infrastructure - identity, isolation, audit, cost tracking, and model governance - is delegated to Coder.
This split is intentional. Coder is a mature, self-hosted platform for development environments. It already knows how to provision ephemeral workspaces, enforce SSO, route LLM calls through a central gateway, and log every action. OpenFlows adds the layer that turns those capabilities into an autonomous engineering pipeline: a directed flow graph, a typed state store, adversarial review, and crash recovery. The two layers are complementary, not competitive.
Coder is the only runtime
What Coder Provides
Coder is responsible for the runtime substrate. A single Coder deployment can serve many OpenFlows tenants, and each tenant benefits from Coder's built-in controls without OpenFlows reimplementing them.
| Capability | What it means for OpenFlows |
|---|---|
| Ephemeral workspaces | Terraform-defined templates; created per ticket and destroyed after merge. |
| Control-plane AI agents | Coder exposes AI agents at the control plane, not inside every workspace. |
| Model governance | LLM provider configuration, rate limits, cost tracking, and audit in one place. |
| Identity | SSO, RBAC, and Git external auth are managed by Coder. |
| Audit logging | Every workspace action, agent chat, and admin change is logged by Coder. |
| Cost tracking | Per-user and per-workspace compute and token cost attribution. |
| External auth | GitHub OAuth providers can be attached to Coder users - no PATs required. |
OpenFlows as a Thin Orchestration Brain
If Coder is the body - the workspaces, the network, the identity, the model gateway - OpenFlows is the nervous system. It decides which agent should act on which ticket, in what order, with what review gates, and with what recovery behaviour. It does this by maintaining the SharedStore and driving the PocketFlow graph.
The orchestrator is a Rust process that runs somewhere with network access to Coder and Redis. It does not need a large GPU or a model server. It only needs to call the Coder API, the GitHub API (via Coder external auth), and Redis. All LLM calls are forwarded to the Coder AI Gateway, which owns the keys and the model configuration. The orchestrator never sees an API key.
{
"workspace_provider": "coder",
"coder_module": "claude-code",
"ai_gateway": {
"primary": "coder",
"fallback": "litellm"
}
}Control-Plane AI Agents vs Workspace Agents
Coder has two ways of using AI agents, and the distinction is important for understanding OpenFlows.
Control-plane AI agents run in the Coder control plane and are exposed through APIs. They are centrally managed, can see all workspaces, and are governed by the Coder AI Gateway. They are ideal for orchestration: long-running tasks, routing decisions, and multi-workspace coordination.
Workspace agents run inside an individual Coder workspace, usually attached to the editor or IDE. They have local context, can edit files in that workspace, and are tied to the user's chat session. They are ideal for interactive coding assistance, not for autonomous, cross-workflow orchestration.
OpenFlows uses the control-plane model for orchestration. NEXUS, FORGE, and SENTINEL are not sitting in
a chat window inside a workspace; they are worker identities that the orchestrator dispatches to Coder
workspaces. The coder_module field in registry.json determines which CLI tool (Claude Code,
Codex, Aider) is installed inside the workspace for the agent to use.
Chats API vs AgentAPI
Coder exposes two APIs for agent interaction. OpenFlows uses the Chats API for orchestration. The AgentAPI is the in-workspace API used by editor-embedded agents.
| Aspect | Chats API | AgentAPI |
|---|---|---|
| Where agents run | Control plane (Orchestrator host) | Inside the Coder workspace |
| Best suited for | Orchestration, planning, routing, long-running workflows | Inline coding assistance, short edits, ad-hoc questions |
| State management | OpenFlows SharedStore + Redis | Workspace-local context and chat history |
| LLM key exposure | Keys stay in Coder AI Gateway; never in workspace | Keys may be in the workspace depending on module setup |
| Lifecycle | Bound to a ticket and torn down after merge | Bound to a chat session |
| Scalability | Many parallel workers, each isolated | One chat per workspace, shared context |
| OpenFlows uses it | Yes - for all orchestration | No - worker agents run via the CLI module inside the workspace |
OpenFlows uses Chats API, not AgentAPI
Complementary Layers
The cleanest way to think about the architecture is as a stack of responsibilities. Coder owns the bottom two layers: the infrastructure and the AI gateway. OpenFlows owns the orchestration layer. The CLI module inside the workspace is the narrow bridge between the two. GitHub and CI sit below and above the stack as external systems of record.
| Layer | Responsibility |
|---|---|
| Coder | Runtime, identity, workspaces, model governance, audit, external auth. |
| OpenFlows | Orchestration brain: flow graph, agent roles, state machine, review gates, recovery. |
| Coder Agent / CLI module | The tool FORGE/SENTINEL use inside a workspace to edit files and run tests. |
| GitHub / CI | External systems of record for issues, PRs, and required checks. |
This separation means that improvements in Coder automatically improve OpenFlows. If Coder adds a new identity provider, OpenFlows can use it without code changes. If Coder improves workspace isolation or model governance, every OpenFlows worker benefits. OpenFlows, in turn, can focus on the hard problem of coordinating multiple agents toward a mergeable PR.
Workspace Lifecycle
The Coder integration is most visible in the workspace lifecycle. Every worker gets a fresh workspace from a template, runs a single ticket's worth of work, and is destroyed. The workspace is identified by the worker ID and the ticket ID, so NEXUS can map state back to the correct agent even if many workspaces are running concurrently.
- Provision: NEXUS calls the Coder API to create a workspace from the configured
template. The
coder_moduleis installed automatically by the Coder Registry. - Bind: NEXUS creates a Chats API session bound to the workspace and assigns it to the worker identity.
- Execute: FORGE, SENTINEL, or VESSEL runs inside the workspace via the CLI module, reading and writing files as a normal Coder user would.
- Complete: when the ticket reaches a terminal state (merged, awaiting human, or failed recovery), NEXUS releases the worker slot.
- Teardown: NEXUS calls the Coder API to destroy the workspace. Any local files, downloaded dependencies, or cached model outputs are deleted with it.
Extension Point: registry.json v2
The bridge between OpenFlows and Coder is configured in
orchestration/agent/registry.json. The v2 schema adds explicit fields for workspace
provisioning, AI Gateway routing, and per-agent CLI modules. This is the extension point for adding new
models, new agent CLIs, or new Coder templates without changing the orchestrator code.
| Field | What it controls |
|---|---|
agents.<role>.coder_module | Which Coder Registry module installs the code agent CLI in the worker workspace. |
agents.<role>.provider | LLM provider and model passed through the Coder AI Gateway. |
agents.<role>.instances | How many parallel worker slots NEXUS may provision for that role. |
ai_gateway.primary | Set to "coder" to route all calls through the Coder AI Gateway. |
{
"agents": {
"forge": {
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"coder_module": "claude-code",
"active": true,
"instances": 2
},
"sentinel": {
"provider": "openai",
"model": "gpt-4.1",
"coder_module": "codex",
"active": true,
"instances": 1
}
}
}Why the Split Matters
Running autonomous agents inside long-lived workspaces with local secrets and accumulated context is a security and reliability anti-pattern. Coder solves the workspace problem; OpenFlows solves the coordination problem. By composing the two, OpenFlows gets enterprise-grade isolation, identity, and audit for free, and can concentrate on the orchestration logic that makes the agents useful.
For operators, the split is also a clean responsibility boundary. If a workspace fails to provision, the problem is in Coder or the template. If the wrong agent is assigned to a ticket, the problem is in OpenFlows. Debugging is simpler because each layer only worries about its own concerns.