Get Started with the Mila Coding Agent¶
Mila provides a locally hosted AI agent running on the Mila cluster. Any agent harness that supports OpenAI-compatible API can use it.
We recommend the agent harness OpenCode in this guide, feel free to use another one.
Beta
The Mila agent is in beta. Announcements are posted on the #mila-local-agent Slack channel, but this is a community channel.
Feel free to reach out there or to the IDT team if you encounter issues or have ideas.
Requirements
sudoprivileges on your machine.
What this guide covers¶
- Overview of the Mila agent
- Get and store an API key
- Route traffic to the agent node from a local machine
- Test the connection with a direct API call
- Configure OpenCode
Overview of the Mila agent¶
Why use it?
A locally hosted coding agent
- Data do not leave the Mila ecosystem
- It runs on our own resources
- Free for Mila researchers
- You can be part of it by your feedback
What's in there?
| Model | Qwen3.8-Flash-Next-fp8 |
|---|---|
| Node | 8 x DGX-A100 (Node cn-d003.server.mila.quebec) |
Get an API key¶
-
Get an API key by filling this form.
-
Store it by adding the export to
~/.bashrc: -
Then reload the shell configuration:
Route traffic to the agent node from a local machine¶
How it works
The Mila agent stack listens on port 8080 at cn-d003.server.mila.quebec.
The node is not directly accessible from the Mila wifi yet, so traffic must
be routed through a Mila login node:
graph LR
A[Local machine] -->|"ssh mila -L 8080:...:8080"| B[Login node]
B -->|forwards port 8080| C[cn-d003:8080]
Once the route is active, the stack is reachable at
http://cn-d003.server.mila.quebec:8080 from the local machine.
OpenCode and other harnesses address the gateway by hostname, so the local
machine must resolve cn-d003.server.mila.quebec to itself and forward the port through the login node.
-
Start a SSH tunnel with port forwarding:
-L 8080:cn-d003.server.mila.quebec:8080forwards local port 8080 to port 8080 on the node, through the login node. Keep this session open while working with the Mila agent.
-
Then add this line to
/etc/hosts(editing/etc/hostsrequiressudo):
Test the connection¶
Send a direct request to the chat completions endpoint. The same command works from the local machine (with the SSH tunnel active) and from any login node or compute node on the cluster:
A successful call returns a JSON object whose message content echoes the prompt:
Plain HTTP, not HTTPS
The connection between the login node and the agent node currently uses
plain HTTP. In theory, someone on the cluster with network interface
access or sudo could capture the LiteLLM, Grafana, or API keys β not
the @mila.quebec account credentials. These cases are extreme, but
keep them in mind until HTTPS is set up.
Configure OpenCode¶
Endpoint for the harness
To use the agent with another harness, point the latter to the OpenAI-compatible endpoint:
-
Install OpenCode from https://opencode.ai/. Then create the configuration file at
~/.config/opencode/opencode.jsonc:Configuration explanation
- The skills part loads the Mila Skills, available in this Github repository.
- The mcp refers to the MCP of the Mila cluster documentation.
- The
a100provider speaks the OpenAI-compatible protocol to the gateway.baseURLis the agent node URLapiKeyreads theMILA_AGENT_KEYenvironment variable at runtime, so no key is stored in the file.- The
opencode-models-discoveryplugin lists the models available on the gateway automatically, so newly deployed models appear in OpenCode without a configuration change.
-
Launch OpenCode
Here you are! You can check:
- The model is
Qwen3.8 Flash Next Fp8. - Your repository is the repository where you want to work (
~/Desktop/my-repoon the screenshot). - One MCP is active (the Mila docs one, as described in the configuration).

- The model is
Key concepts¶
- Model discovery
- Querying the gateway's model list at runtime so the harness shows the currently deployed models without manual configuration.