> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datazone.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Orion Code

> Orion Code builds and changes a project for you. It works in a sandbox, deploys to your branch or opens a pull request, and keeps going after you close the tab.

Orion Code is Orion's agent for building in a project. Ask it to add a pipeline, fix a failing extract, build a Studio App or change an Intelligent App. It edits the project's files, runs commands and waits for runs to finish. Its changes stay **pending** until you deploy them or open a pull request.

## Start a chat

* **From the Orion page.** Open Orion, pick **Orion Code** from the agent picker in the box, and send. Choose a project and a branch, then click **Start**. You can also click **New Orion Code chat** in the sidebar.
* **From a project.** Open Orion in the project's drawer and choose **Agent** mode. Agent mode lets Orion change files and act. **Ask** mode only answers questions.

Orion Code chats are listed under **Orion Code** in the Orion sidebar. This includes chats started from a project's code view.

## The sandbox

Orion Code works in a sandbox: a separate environment that holds a copy of the project, including your unsaved changes and Orion's own edits. Commands run there.

In the sandbox, Orion can:

* build, test and lint the project, and install packages
* run a script to check something
* use the `datazone` CLI and the Datazone REST API, with your permissions
* wait for pipeline and extract runs and Studio App builds to finish
* open a Studio App in a browser to check it

Orion asks before it creates, changes, runs or deletes anything on the platform, unless you have asked for exactly that.

The sandbox starts with the first command, which can take up to a minute. Later commands reuse it. The workspace panel shows its status as **Not started**, **Starting**, **Running** or **Stopped**.

After a deploy, the sandbox is refreshed from the deployed branch before its next command. It then runs what is now deployed.

### Waiting for runs

Some steps depend on a run that is still going. Orion then waits instead of polling. The chat shows **Orion is waiting for 2 runs to finish and will continue by itself.** When the runs end, the chat continues on its own with a new message that says how they ended. You can close the tab in the meantime.

### When there is no sandbox

Some deployments have no sandbox. The workspace panel shows **Sandbox off**, and Orion works only with files:

* It cannot run commands, such as installs, builds or tests.
* It cannot build or preview a Studio App, run a pipeline or an extract, or use the CLI or the REST API.
* It can edit project files, then land them with **Deploy** or **Open pull request**.
* It checks its work by reading the code. It tells you which steps are left for you in the UI, and says plainly what it did not build or run.

> [!NOTE]
>
> On a self-hosted installation, the sandbox is switched on or off in the deployment configuration.

## Pending changes, deploy and pull requests

Orion's edits are proposals until you land them. The workspace panel lists the **Changed files**, and each one opens a diff against the branch. Nothing is committed until you act:

* **Deploy** commits the pending changes to the branch the chat is on, and deploys it. You confirm first. The dialog says how many files will be committed and to which branch.
* **Open pull request** commits the changes to a new branch of their own, and opens a pull request into the branch you pick under **Into**. The chat then continues on the new branch.

The branch is chosen in the input. It is locked while changes are pending, so commit or discard them before you switch.

## Permission levels

The **Permission** control in the input sets how far Orion goes without asking.

| Level | What Orion does |
| - | - |
| **Manual** | Asks before each command, deploy and pull request. |
| **Accept edits** | Runs commands, deploys and pull requests without asking. |
| **Auto** | Owns the whole task. Before it starts, it asks everything unclear, including where the result should land: a branch, a pull request, or left pending. Then it builds, checks its work in the sandbox and lands the result without stopping. |

When Orion asks for approval, you can choose **Allow once**, **Allow all in this chat** or **Deny**.

Orion Code starts on **Manual**. In a project's drawer, the level you choose is remembered in this browser.

## Model

Next to the permission control, a button shows **Default (model name)**. That is the organisation's default model for Orion Code. Click it to run your questions on another chat model. The choice applies to your questions until you reload the page. Models come from the [model accounts](https://docs.datazone.co/reference/development/model-accounts.md) of your organisation.

## Ask, stop and queue

An Orion Code run keeps going on the server. If you close the tab or lose the connection, the answer carries on. When you reopen the chat, the run appears where it was.

* **Stop** ends the current answer. The answer shows **Stopped.** Its partial answer is kept.
* **Queue**: type while Orion is still answering. Your message waits, marked **Queued — starts when the current answer finishes**. Click **Cancel** to remove it.
* **Connection lost, reconnecting…** shows while the page reconnects. Nothing is lost.
* If the platform restarts during a run, the answer shows **The run was interrupted before it finished. Ask Orion to continue.** Ask it to continue, and it picks up from the partial answer.
* A queued message that is cancelled before it starts shows **Cancelled before it started.**

## Related

* [Orion Prime](https://docs.datazone.co/reference/orion/prime.md)
* [Orion Skills](https://docs.datazone.co/reference/orion/skills.md)
* [Projects](https://docs.datazone.co/reference/development/project.md)
* [Policies](https://docs.datazone.co/reference/development/policy.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.