Command line
Running the agent from a terminal or a script with draggy run: flags, exit codes and the stream-json events. Serving it to an editor with draggy acp.
draggy run runs the agent on one prompt in a project folder, with the file tools, commands and read-only git, and prints the answer. It talks to a provider from the bundled catalog with a key from the environment. It does not read the keys saved in the app, and it writes nothing to the app's data folder.
draggy run -p openai -m gpt-4.1 "Fix the failing test in src/parse.rs"
draggy run -p custom --base-url http://127.0.0.1:8080/v1 -m my-model --output stream-json - < prompt.txtUse - as the prompt to read it from stdin. The key comes from DRAGGY_API_KEY, or from the provider's own variable such as OPENAI_API_KEY. A local provider such as Ollama needs none.
Flags#
| Flag | What it does | Default |
|---|---|---|
-p, --provider <id> |
Catalog provider id | ollama |
-m, --model <id> |
Model id, or set DRAGGY_MODEL |
none |
--base-url <url> |
The provider's address, needed for custom |
the catalog's |
--cwd <dir> |
The project folder the tools work in | the current folder |
--tools <list> |
all, none, or tool names joined by commas |
all |
--mode <mode> |
plan, ask, accept-edits or yolo |
ask |
--network |
Let commands in the sandbox VM reach the public internet through a proxy. Does nothing with --mode yolo |
off |
--max-turns <n> |
Most model requests in one run | |
--output <format> |
text, json or stream-json |
text |
--json |
Same as --output json |
|
--system <text> |
Extra instructions, added to Draggy's own | |
--max-tokens <n> |
Limit each answer's length | |
--temperature <x> |
Sampling temperature, 0 to 2 | |
--timeout <secs> |
Stop the whole run after this long | 600 |
The tools are read_file, write_file, edit_file, run_command, git_status and git_diff, with the same descriptions the app gives the model. On Windows the CLI runs commands only in the sandbox, so until it is set up, and in yolo, draggy run leaves run_command out and says why.
Modes#
The modes match the app's permissions, with one difference: there is no Turbo, and --mode turbo is refused.
planreads and refuses everything else.askasks before every edit and every command.accept-editsmakes edits and asks before commands.yoloasks for nothing, and runs commands on your computer, not in the VM.
Draggy asks on the terminal. y allows the call once, a allows the same path for the rest of the run, and anything else refuses it. For a command it asks every time, and there is no a. When stdin is not a terminal, as in a pipe or a script, a call that needs a question is refused and the model is told why.
Sandbox#
draggy sandbox says where commands run. draggy sandbox install downloads the guest's disk (about 155 MB) from Draggy's releases, checks its SHA-256 against the hash pinned in Draggy, and unpacks it with zstd. It needs access to /dev/kvm, and libkrun in a krun folder next to draggy or in the folder DRAGGY_KRUN_LIB_DIR names. --from <dir> takes the same file from a folder instead of downloading it. The VM keeps its files in Draggy's data folder.
On Windows, draggy sandbox install first installs WSL when it is missing or too old for containers. It asks before it does: Windows then asks for administrator rights, and WSL works only after Windows restarts. After the restart, run draggy sandbox install again. It downloads the image (about 155 MB), checks its SHA-256 and imports it into your own WSL session, so run it as yourself, not from a terminal opened as administrator. draggy sandbox says when virtualization is off or Virtual Machine Platform is not enabled, since WSL cannot start then.
Each project gets one VM. It starts with the run, stops after five idle minutes, and starts from a clean disk every time: only changes in the project folder last. The VM has no network unless you pass --network. With it, commands reach the public internet only through a proxy that Draggy runs on your computer, so only tools that use the HTTP_PROXY and HTTPS_PROXY variables get out, and nothing on your local network or on this computer can be reached. The proxy connects only to ports 80 and 443, so a git remote over SSH does not work; use its https address. If a command in the VM creates a git repository, or changes the config, hooks or attributes of one, draggy run names its path on stderr and leaves it in place: an editor or a terminal that runs git there could run what is in it. When the VM created the repository, Draggy's own git stays off for that project until you remove it. The CLI looks for the draggy-sandbox launcher next to draggy, or where DRAGGY_SANDBOX_LAUNCHER points.
Exit codes#
| Code | Meaning |
|---|---|
| 0 | Done |
| 1 | The provider or the network failed, or stdout was closed |
| 2 | Usage: a bad flag, an unknown provider, a missing key |
| 3 | Stopped early: the last answer hit the length limit |
| 4 | Timed out (--timeout) |
| 5 | Reached --max-turns |
| 130 | Cancelled with Ctrl+C |
A tool that fails does not change the exit code. The model reads the failure and carries on.
Output#
text prints the answer as it streams, and the name of each tool on stderr. json prints one object when the run ends: the result event below. stream-json prints one JSON object per line, from start to result.
stream-json events#
This is schema version 1. The version is on the start line and goes up whenever a field changes meaning or goes away. Every event has a type. Draggy does not copy the prompt or the key into the stream. What a tool reads or the model writes goes into it unchanged.
type |
Fields |
|---|---|
start |
version, provider, model, mode, cwd, tools |
message_delta |
text: the next piece of the answer |
reasoning_delta |
text: the next piece of the model's reasoning |
tool_call |
id, name, arguments |
permission_request |
tool, target, reason, decision (allow_once, allow_for_run or deny) |
tool_result |
id, name, output: what the model reads back, refusals included |
result |
stop_reason, exit_code, turns, usage, cost, text, and error or notice when there is one |
stop_reason is one of done, failed, length, timeout, max_turns and cancelled, matching the exit codes. turns counts model requests. usage adds up every request: input, output, reasoning, cache_read and cache_write tokens, each counted once. A provider that does not report a split counts reasoning as output. cost holds micros (millionths of a dollar), currency and source, which is table, reported or estimated. It is priced from the rate card that ships with Draggy, and is null when the price is unknown, as for a local server or a model the card does not list. notice explains an empty or cut answer, such as a model that spent its whole budget reasoning.
{"type":"start","version":1,"provider":"custom","model":"my-model","mode":"ask","cwd":"/home/me/project","tools":["read_file","write_file","edit_file","run_command","git_status","git_diff"]}
{"type":"tool_call","id":"call_0","name":"write_file","arguments":{"path":"out.txt","content":"x"}}
{"type":"permission_request","tool":"write_file","target":"out.txt","reason":"This changes something outside Draggy, so the user is asked first.","decision":"deny"}
{"type":"tool_result","id":"call_0","name":"write_file","output":"TOOL RESULT (write_file): Not allowed. This changes something outside Draggy, so the user is asked first."}
{"type":"message_delta","text":"I was not allowed to write the file."}
{"type":"result","stop_reason":"done","exit_code":0,"turns":2,"usage":{"input":200,"output":20,"reasoning":0,"cache_read":0,"cache_write":0},"cost":null,"text":"I was not allowed to write the file."}Editors (ACP)#
draggy acp serves the same agent to an editor such as Zed over the Agent Client Protocol (ACP). The editor starts Draggy, sends it JSON-RPC messages on stdin and reads the replies on stdout. Draggy speaks version 1 of ACP. An editor that only speaks a later version will not connect.
It takes the flags of draggy run that choose the model and the agent: -p, -m, --base-url, --tools, --mode, --network, --max-turns, --system, --max-tokens, --temperature and --timeout, which here limits each prompt. The key comes from the same variables. The editor sends the prompts and the project folder of each session, so there is no prompt, --cwd or --output.
- The default mode is
ask: every edit and every command becomes a permission question in the editor. You can allow the call once or reject it. For the file tools you can also allow that path for the rest of the session. Draggy asks before every command. - When the editor says it can read and write files,
read_file,write_fileandedit_filego through the editor, so they see unsaved changes and the editor saves the result. Otherwise they work on the disk. - Stopping the reply in the editor cancels the turn, including a permission question that is still open.
- Commands run as they do with
draggy run: in the sandbox VM on Linux once it is set up, except inyolo, otherwise directly on your computer; on Windows only in the sandbox.
In Zed, add Draggy as a custom agent in your settings file, then pick it from the new-thread menu of the agent panel:
{
"agent_servers": {
"Draggy": {
"type": "custom",
"command": "draggy",
"args": ["acp", "-p", "openai", "-m", "gpt-4.1"],
"env": { "OPENAI_API_KEY": "sk-..." }
}
}
}Not supported yet: images, audio and embedded files in prompts (text and links only), loading or resuming earlier sessions, MCP servers passed by the editor (they are ignored), the editor's terminals, session modes, and the tool calls of earlier prompts. A new prompt sees the earlier prompts and answers only, so the model reads a file again when it needs it. Keys saved in the app are not read.