# Dryv agent

The Dryv agent is a coding agent that runs on your machine. It reads and edits your project, runs commands, and uses Dryv itself: it can validate your contracts, plan generation, explain generated files and manage your tasks.

The agent runs inside the [local daemon](/docs/guides/local-daemon). It needs no Dryv account. It uses a model from a provider you choose, with **your own** provider API key. Dryv does not supply a model or a key.

> [!NOTE]
> The agent, tasks and the local daemon are in the current Dryv CLI. The published 0.1.0 build may not include them yet. See [Installation](/docs/usage/installation).

## When to use it

- You want an assistant that knows Dryv's loop (`validate`, `plan`, `generate`) and asks before it writes generated files.
- You want the agent to create and work through [tasks](/docs/guides/tasks) in your project.
- You want everything to stay on your machine, apart from the calls to your model provider.

## Before you start

You need:

- The `dryv` CLI. See [Installation](/docs/usage/installation).
- An API key from one of the supported model providers.

### Supported model providers

| Provider   | Environment variable  |
| ---------- | --------------------- |
| Google Gemini API | `GEMINI_API_KEY` |
| Groq       | `GROQ_API_KEY`        |
| Mistral    | `MISTRAL_API_KEY`     |
| Cerebras   | `CEREBRAS_API_KEY`    |
| OpenRouter | `OPENROUTER_API_KEY`  |

A provider is skipped until its key is set. One variable can hold several keys separated by commas. The agent tries them in order and moves to the next key when one is rejected or rate limited.

## Set your provider key

Pick one way.

**In your shell.** Export the variable before the daemon starts:

```bash
export GEMINI_API_KEY="your-key"
dryv local restart
```

**In the daemon's credentials file.** Create `~/.dryv/local/credentials.yaml`. It maps variable names to a key or a list of keys:

```yaml title="~/.dryv/local/credentials.yaml"
GEMINI_API_KEY:
  - first-key
  - second-key
GROQ_API_KEY: another-key
```

Make it readable by you only, then restart the daemon:

```bash
chmod 600 ~/.dryv/local/credentials.yaml
dryv local restart
```

A variable already set in your environment wins over the file. The daemon logs a warning when the file can be read by other users.

## Start the agent in the terminal

From your project folder:

```bash
dryv code
```

`dryv agent` and the `dryvcode` command do the same thing. The command starts the local daemon if it is not running, then opens the full-screen interface. It needs an interactive terminal.

Type a request and press Enter. Type `/` to see the commands.

### Commands in the interface

| Command | What it does |
| --- | --- |
| `/help` | Show the commands. |
| `/init [project name]` | Create a project and link it to this folder. |
| `/status` | Show the runtime and the current project. |
| `/projects [get\|open <project-id>]` | List or open projects. |
| `/workspace` | Show the current workspace and its folders. |
| `/chats [open\|new\|rename\|archive\|delete]` | Manage chats. |
| `/resume [chat-id]` | Open a previous chat. |
| `/new` | Start a new chat. |
| `/model [backend-id model-id]` | Show or set the model for this chat. |
| `/context reset` | Start the next turn with fresh context. |
| `/approval [set <allow\|require_approval\|block>]` | Show or change the approval policy. See [Approvals](#approvals). |
| `/runs [run-id]` | List the runs in this chat, or inspect one. |
| `/interactions [interaction-id]` | List or inspect questions and approvals in this chat. |
| `/artifacts <artifact-id>` | Inspect an artifact the agent produced. |
| `/diff` | Show the latest diff. |
| `/knowledge <query>` | Search what the agent has stored. |
| `/browser` | Find or manage browser resources. |
| `/copy [max-characters]` | Copy recent transcript text to the clipboard. |
| `/theme` | Choose the terminal colours. |
| `/clear` | Clear the transcript on screen. |
| `/retry` | Retry the connection to the daemon. |
| `/quit` | Exit (also `/exit`). |

### Choose a model

Run `/model` to see the current selection. Set one with `/model <backend-id> <model-id>`. The choice is saved for that chat.

## Run one command without the interface

`dryv code <command>` runs one command and exits. Add `--json` for machine-readable output. This is useful in scripts.

```bash
dryv code status
dryv code chats
dryv code runs get <run-id>
dryv code approval set <workspace-id> require_approval
```

| Command | What it does |
| --- | --- |
| `api start\|status\|stop\|restart\|logs` | Manage the local daemon. |
| `init [--name <name>]` | Create a project for this folder. |
| `status` | Show the runtime and current resources. |
| `projects [get\|open <id>]` | List or open projects. |
| `workspace <workspace-id>` | Show a workspace. |
| `chats [project-id]` | List chats. |
| `runs [chat-id]`, `runs get <run-id>` | List runs, or show one. |
| `interactions <chat-id> [interaction-id]` | List or show interactions. |
| `artifacts get\|content <artifact-id>` | Show an artifact's metadata or content. |
| `approval get <workspace-id>` | Show the approval policy. |
| `approval set <workspace-id> <allow\|require_approval\|block>` | Change the approval policy. |
| `knowledge search <query>`, `knowledge get <id>` | Search or read stored knowledge. |
| `browser installations\|resources` | List browsers or open browser resources. |
| `browser open <installation-id> [url]`, `browser close <resource-id>` | Open or close a managed browser. |
| `cwd` | Print the working folder. |
| `logs [--tail <n>]` | Print the daemon log. |
| `open <path>` | Open a path. Also `open .`, `open logs`, `open config`. |

Options for `dryv code`:

| Option | Meaning |
| --- | --- |
| `--project <path>` | Workspace folder. Defaults to the current directory. |
| `--runtime-home <path>` | Use a different daemon home (same as `DRYV_LOCAL_HOME`). |
| `--endpoint <url>` and `--token <token>` | Use an explicit loopback daemon address and its token. |
| `--json` | Print machine-readable output. |
| `--plain` | Turn off terminal styling. |

## Use the agent in VS Code

The VS Code extension adds a **Dryv Agent** view with a chat. See [VS Code](/docs/guides/vscode#agent-chat).

## What the agent can do

The agent works only inside the folder of the current workspace.

| Tool group | Examples |
| --- | --- |
| Files | Read, list and search files. Write, edit, patch, move, copy and delete files. |
| Content | Read and compare content and images. |
| Shell | Run a process or a script. |
| Environment | Find an executable, read the platform and environment variables. |
| Dryv | `dryv.docs.read`, `dryv.project.validate`, `dryv.project.status`, `dryv.generate.plan`, `dryv.generate.explain`, `dryv.generate.apply`, `dryv.generate.undo`. |
| Tasks | `task.list`, `task.show`, `task.search`, `task.validate`, `task.create`, `task.update`, `task.start`, `task.check`, `task.comment`. |

The Dryv tools run the same CLI commands you would. They use the local Engine, so they need no key or login.

## Approvals

Each workspace has an approval policy for tools that change things:

| Policy | Effect |
| --- | --- |
| `require_approval` | The agent asks you before each change. This is the default. |
| `allow` | Changes run without asking. |
| `block` | Changes are refused. |

Tools that only read are not affected by the policy.

Writing generated files is always your decision. `dryv.generate.apply` and `dryv.generate.undo` ask for approval even when the policy is `allow`, and are refused when it is `block`. The agent can only apply a plan it created in the same run.

Change the policy with `/approval set <mode>` in the interface, or `dryv code approval set <workspace-id> <mode>`.

## Where your data stays

- The agent and its data live in the daemon's home, `~/.dryv/local` by default.
- Your prompts and the files the agent reads go to the model provider you chose.
- Nothing is sent to Dryv. Signing in is only needed for [task sync](/docs/guides/sync).

## Desktop app

A desktop app for the agent is in development. It is not available to download yet.

## Troubleshooting

**"Dryv interactive mode requires a TTY."** You ran `dryv code` with redirected input or output. Run it in a terminal, or use a one-shot command such as `dryv code status --json`.

**The agent cannot answer, or no model is listed.** No provider key is set for the daemon. Set one as shown above and run `dryv local restart`. A key exported after the daemon started is not seen until it restarts.

**"dryv-local was not found."** The CLI could not find the local daemon. See [Local daemon troubleshooting](/docs/guides/local-daemon#troubleshooting).

**The agent keeps asking for approval.** That is the default policy. Change it with `/approval set allow`. Generated-file writes still ask.
