Docs › Agent
Running commands
How the agent runs shell commands, background tasks for dev servers, and the read-only command list in Ask mode.
The agent's commands run as hidden background processes, so they never take over your terminal: the terminal you type in stays yours. Each command's card shows its output, and Open in terminal shows it in a read-only terminal of its own. To watch them run in the integrated terminal instead, set astracode.agent.terminal to integrated.
Limits
- After 60 seconds a command moves to the background rather than being stopped. The agent carries on, is told when it finishes, and can wait for it when its next step needs the result.
- Output is capped at 10,000 characters, keeping the start and the end: the first error of a build is at the top, and a plan's summary or a test runner's verdict is at the bottom. It is also compressed to save context, and the agent can re-run with raw output if that hid something.
- A command that would wait for a keyboard is refused before you are asked to approve it, with the form that does not:
git rebase -i,git commitwith no message,npm initwithout-y, a REPL,docker run -it, a bareterraform apply. Pagers and prompts are switched off for every command.
Long-running processes
Dev servers, watch-mode test runners, build watchers and tunnels do not exit on their own, so the agent starts them as background tasks instead. It gets a task id back, can read the output later, and can stop the task. Every background task is killed when the window closes.
This matters because waiting on a dev server would block the run until the timeout, and the timeout would then kill the thing you wanted running.
Ask mode is read-only
Ask mode can run commands, but only from an allowlist: a short list of programs whose only effect is output, with the flags that would make them write named and refused. No pipes, redirects, chaining or command substitution, because any of those can turn a read into a write.
env and printenv are not on the list. They read, and what they read is secrets.
All documentation
Get started
Agent
- Agent overview
- Approvals and permissions
- Plan mode
- What the agent can do
- Running commands
- Browser tools
- Checkpoints and undo
- Infrastructure as code
- Running several agents at once