Skip to content

OpenCode Agent

OpenCode Agent puts OpenCode, the open-source coding agent, in your flow with your OpenCode Go subscription, OpenCode Zen credit or any OpenRouter model. It works on a Git repository or an empty folder, in an isolated workspace for your conversation only: it reads the code, changes it, runs commands and tests, and returns its answer and the list of files it changed.

It works as a normal node (an instruction in, the answer out) and as a tool of an Agent or a Voice Agent, so you can ask for changes in your code by voice or chat.

When to use it

  • You want an agent to fix a bug, add a small feature, write tests or review a change in a repository.
  • You want to program by voice: the voice agent passes on what you say and tells you what was done.
  • You want to automate code work from a flow: for example, every new issue produces a branch with a proposed fix.

How it works

  • Each conversation (a playground chat, a call, an API session) has its own isolated container with its files. Nobody else sees it.
  • Later messages of the same conversation continue the work: the agent remembers what it did and the files are still there.
  • The workspace for Run Instruction stops by itself after 15 minutes without use and is kept for 7 days; the next message starts it again as it was. List Sessions, Delete Session and Get Changes run on the fly in a short-lived container destroyed immediately on exit without counting against simultaneous container limits.
  • Only Instruction (left) and Tools (bottom) appear on the collapsed node; configure the rest from the side panel or toggle their visibility if you need to wire them.
  • The API key reaches only the agent’s process and the Git token only the platform’s own Git commands: the agent never sees the token.

Configuration

FieldWhat it does
ProviderOpenCode Go (default): your monthly OpenCode Go subscription. OpenCode Zen: pay-as-you-go credit on opencode.ai (includes Claude, GPT and Gemini models). OpenRouter: with an OpenRouter key.
OpenCode API KeyWith Go or Zen: filled in by the OpenCode credential (the key of your opencode.ai account).
OpenRouter API KeyOnly with OpenRouter: your OpenRouter key.
Operation (tool)Action to run on the workspace: Run Instruction (default), List Sessions (returns saved sessions with session_name, conversation_id, timestamp and summary), Delete Session (forgets a saved session without touching workspace files), or Get Changes (lists uncommitted changes without spending tokens).
InstructionWhat to do, in plain words. As a tool, the calling agent writes it.
Agent InstructionsStanding rules for every instruction: project conventions, what to avoid, how to answer.
ModelA model of the chosen provider, for example kimi-k3 or glm-5.3 on Go, claude-sonnet-5-5 on Zen, anthropic/claude-sonnet-5.5 on OpenRouter.
PermissionsWhat it may do in its workspace: Read only (read and explain), Edit files, or Edit files and run commands (default; needed to run tests). Anything above is refused and listed in the result.
Repository URLThe repository cloned the first time. Empty starts from an empty folder.
Workspace NameUnique name to persist the working folder in your Storage (opencode_data/<name>). Left empty, nothing is persisted. Enter the same name on multiple OpenCode Agent nodes or flows to share files and sessions.
SkillsSkills of your platform account (yours and those installed from the marketplace) the agent may use. Press refresh to load the list; they are copied to the agent before each instruction.
When DoneCommit and push a new branch pushes each instruction’s changes to a new branch nappai/opencode-<date>.

Advanced options

FieldWhat it does
BranchThe branch to clone. Empty, the repository’s default branch.
Git Access TokenToken for a private repository and for pushing. Only the platform’s Git commands use it.
Keep WorkspaceDuring the conversation (default) keeps files and memory between messages; Only for this run discards everything at the end.
Session Name (tool)Logical task name or conversation_id of the session to continue or resume. Empty uses the default session; use a distinct name per task to keep contexts separate inside the same persistent workspace.
New Session (tool)When enabled (true), starts a fresh conversation from scratch instead of resuming the current session.
Reasoning EffortHow much the model thinks before acting. Higher is slower and costs more.
Output SchemaAn optional JSON schema: the agent ends with an answer in that shape, in structured of the result.
Time Limit (s)One instruction taking longer is stopped. Default 600.
API Base URLOnly for a compatible gateway of your own. Empty, the provider’s official address.

Output

  • Response: for Run Instruction, the agent’s final answer; for List Sessions, Delete Session and Get Changes, parseable JSON ready for automations ({"sessions": [...], "count": N}, {"changed_files": [...], "diff_summary": "...", "count": N}, or {"deleted": true, "session_name": "..."}).
  • Result: structured Data. For Run Instruction it includes changed_files, diff_summary, branch, denied_actions, steps, conversation_id, session_name, structured, usage and cost_usd; for List Sessions, Delete Session and Get Changes it exposes the structured payload under structured and at top level (sessions, changed_files, deleted, count). This is what an agent receives when using the node as a tool.

Example

Programming by voice on a repository:

  1. Add a Voice Agent and a OpenCode Agent with your OpenCode credential.
  2. Set your repository in Repository URL and, if it is private, the Git Access Token.
  3. Turn on the node’s tool mode and connect it to the Voice Agent’s Tools.
  4. Call and say “fix the failing test in the invoices module”: the voice agent passes it on and tells you what changed.

Security

  • Always use your API key: subscription logins (claude.ai, ChatGPT) cannot be used in NappAI.
  • The agent works isolated: no access to NappAI’s internal network or to other people’s workspaces.
  • Only the chosen provider is used: a model it does not have gives an error; it is never swapped for another model or provider.
  • Do not write keys or tokens in the instruction: use the credential and the Git Access Token field.

Claude Agent, Codex Agent, Antigravity Agent.