OpenCode Agent
OpenCode is a coding agent that runs in a workflow and that you use from the browser or from the ALIDA chat. The datasets you connect decide what it knows and how it behaves.

Before you begin
- An agent gateway key (
AGENT_GATEWAY_API_KEY), issued by the platform team. The default model needs it. - For GitLab work: a personal access token with
apiandwrite_repositoryscopes, and at least theMaintainerrole in the target group.Developercannot create branches. - The numeric ID of the GitLab group for new repositories, shown on the group's page.
Quick start
- Go to Workflows, create a workflow and open the Designer.
- Drag the opencode service (category Agent) onto the canvas.
- Optional: connect a Prompt dataset to
input-dataset-4, for exampleservice-writerto build ALIDA services. - Click the service and set
AGENT_GATEWAY_API_KEY,GITLAB_TOKENandGITLAB_GROUP. - Save and Run the workflow. Wait for the status
RUNNING. - Open the service's exposed URL (port
10001) from its panel. Add/L3dvcmtzcGFjZQto the URL to open the/workspaceproject directly.
Check it works: send a message. If the agent answers, the model and the key are configured correctly.
To use the agent from the platform, add it to the chat with the OpenCode protocol.
Push your work
/workspace may not survive a stop or restart of the workflow. Only what is pushed to GitLab is safe.
Parameters
| Parameter | Required | What to set |
|---|---|---|
AGENT_GATEWAY_API_KEY | With OpenRouter models, including the default | Virtual key for the agent gateway. The real OpenRouter key stays in the gateway. |
GITLAB_TOKEN | For GitLab work | Without it the agent can chat and edit files, but cannot clone, create or push repositories. |
GITLAB_GROUP | Yes | Numeric ID of the GitLab group for new repositories. |
GITLAB_HOST | Yes | GitLab base URL. |
GIT_URL | No | HTTP(S) URL of a repository to open at start, in /workspace/service. |
OPENCODE_MODEL | No | Model to use. Default: openrouter/meta/muse-spark-1.3-contributor. For another OpenRouter model use openrouter/MODEL_ID. |
AGENT_GATEWAY_URL | No | Agent gateway endpoint. The default is the in-cluster gateway. |
ALIDA_ENABLED_CATEGORIES | No | Comma-separated subset of skills,tools,data (default: all three). An empty value disables these imports. It does not filter Prompt datasets. |
portsToExpose | No | Leave the default, port 10001. |
| CPU / memory limit | No | Defaults: 800m and 2 Gi. Raise them if the agent is slow or restarts. |
Connect datasets
The service has six optional inputs: input-dataset-1 to 3 for MCP URLs, and input-dataset-4 to 6 for files. File datasets are handled according to their category. To create these datasets and choose their category, see Extend an agent with datasets.
| Category | What happens |
|---|---|
Prompt | The whole dataset becomes the agent's configuration, imported into /opencode. |
Skill | Only skills/NAME/... folders are imported. Each one must contain SKILL.md. |
Tool | tools/*.ts, lib/ and a root package.json are imported. Tools must sit directly in tools/. |
none / Data | Copied to /workspace/data as working data. |
Plural forms are accepted. An unknown category stops startup; disabled categories and unreachable datasets are logged and skipped. When two datasets contain the same file, the higher port wins.
Prompt dataset
Every item is optional:
AGENTS.md Agent instructions, always loaded
opencode.json Merged over the image configuration
agents/ Subagents
skills/ Skills, one folder each with SKILL.md
tools/ Custom tools, directly in this folder
lib/ Code shared by the tools
plugins/ Plugins
docs/ Reference material
init.d/ Scaffold copied into new repositoriesFor the file formats, see the OpenCode documentation on config, agents, skills, tools and plugins.
Use only trusted Prompt datasets
A Prompt dataset is imported completely, including tools, plugins and permissions. It can override the default permissions.
MCP servers
Connect a URL dataset to input-dataset-1, 2 or 3. The server is added to the agent even if it does not answer at startup, with a warning in the logs. To use an ADK Agent as a tool, connect its output port here. A2A agent cards are not supported and are skipped.
Good to know
- Default permissions: shell commands are denied except listing
/workspaceand/workspace/repos; the agent cannot edit/opencode, read.envfiles or ask interactive questions. - Kafka: each release also has a
VERSION-kafkavariant with a Kafkaoutput-datasetport. Tools receiveKAFKA_TOPICandKAFKA_BOOTSTRAPto publish to it. - Tracing to MLflow is automatic: see Observability.
Troubleshooting
Open the workflow logs with the show-logs button on the workflow page.
| Symptom | Check |
|---|---|
| The agent does not answer, or the model returns an authentication error | AGENT_GATEWAY_API_KEY and OPENCODE_MODEL. |
Unsupported category ... | A dataset has a category other than Prompt, Skill, Tool, Data or empty. |
... has no importable files | The dataset is empty, or a Skill dataset has no skills/NAME/SKILL.md. |
Tool ... must sit directly in tools/ | Move the tool into tools/ and shared code into lib/. |
| A tool or skill is missing | The dataset category, and that paths are relative to the dataset root. |
MCP warning about /mcp | The endpoint did not answer at startup. Check the URL. |
| The agent cannot create or push repositories | The GITLAB_TOKEN scopes and your role in GITLAB_GROUP. |