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

# Agentic execution

> How the AI agent runs commands, edits files, fetches URLs, and uses MCP tools to complete tasks end-to-end.

The Rumus AI isn't just a chat box that replies in words — it's an **agent** that can take actions on your behalf. When you ask "find the largest files under /var/log", the agent doesn't just suggest a command, it proposes one and runs it (with your approval), then reads the output and answers based on what it actually saw.

## What the agent can do

The agent's core toolkit:

| Tool                | What it does                                                                  |
| ------------------- | ----------------------------------------------------------------------------- |
| **Run command**     | Execute a shell command in your active terminal — local or remote             |
| **Read file**       | Open a file and put its contents into the conversation                        |
| **Write file**      | Create or overwrite a file with new content                                   |
| **Edit file**       | Make targeted edits to existing files                                         |
| **Web fetch**       | Pull a specific URL — see [Web search](/docs/ai/web-search) for broader search     |
| **Web search**      | Query the web for information — see [Web search](/docs/ai/web-search)              |
| **MCP tools**       | Anything you've connected via Model Context Protocol — see [MCP](/docs/ai/mcp)     |
| **Create plan**     | Auto-draft a multi-step plan for larger jobs — see [Plan mode](/docs/ai/plan-mode) |
| **Spawn sub-agent** | Fan out independent work in parallel — see [Sub-agents](/docs/ai/sub-agents)       |

## The execution loop

When you send a prompt, the agent:

1. Reads your message and any context (active terminal, attached files, your [rules and skills](/docs/ai/rules-skills)).
2. Decides what to do — answer directly, or call a tool.
3. If a tool is called, requests approval if needed (see [Command approval](/docs/ai/command-approval)), runs the tool, and reads the result.
4. Loops back — keeps calling tools until the job is done or it hits the iteration cap.
5. Replies to you with what it learned and did.

The iteration cap (default 20 tool calls per turn) prevents runaway loops. You can adjust it under **Settings → AI → Conversation**.

## How tool calls render in the sidebar

Each tool call shows up inline in the conversation as a collapsible block:

* The **tool name and arguments** at the top.
* The **status**: pending → running → succeeded / failed.
* The **result** — for commands, the captured stdout / stderr; for file reads, the contents; for web fetches, the page text.
* A small **info icon** with token / timing details.

Click the block header to expand or collapse. Long results auto-collapse to keep the conversation scannable.

## Cancelling

If a tool call is taking too long, or the agent is heading the wrong way, hit **Stop generating**. The agent finishes the current tool call and stops; partial work is preserved in the conversation.

## Approval gates

The agent's tools fall into three approval categories:

* **Always allowed** — read-only or low-risk operations (read file, web fetch).
* **Approval-required** — anything that changes state by default (run command, write file, edit file). You can pre-approve patterns; see [Command approval](/docs/ai/command-approval).
* **Blocked** — explicitly forbidden patterns the agent will not run, even if you click approve. Configure under **Settings → AI → Conversation → Command Control**.

## Where the agent runs commands

The "active terminal" is whichever terminal you most recently focused before opening / interacting with the AI sidebar. If you have prod and staging tabs open and you ask the agent to run `restart`, **double-check which tab is focused** — the agent runs in that one.

For multi-host fan-out, use [multi-terminal broadcast](/docs/terminal/canvas#multi-terminal-broadcast) directly rather than asking the agent to do it; broadcast is purpose-built for that case.

## Tips for getting the most out of the agent

* **Be specific about scope.** "Find why my service is failing" is fine, but "Find why nginx is failing on prod-web-1; check `/var/log/nginx/error.log` for the last hour" gets you there faster.
* **Tell it to plan first when the job is bigger than a single command.** Or just give it a complex job and let [plan mode](/docs/ai/plan-mode) trigger automatically.
* **Use [skills](/docs/ai/rules-skills)** to encode the multi-step procedures you do regularly — the agent invokes them by name when relevant.
* **Switch models per task.** Reasoning-heavy work (debugging tricky failures) often benefits from a stronger model; high-volume routine ops can run on a faster, cheaper one. The picker remembers your choice per conversation.

## Next steps

<CardGroup cols={2}>
  <Card title="Plan mode" icon="list-check" href="/docs/ai/plan-mode">
    What auto-planning does and how to read the resulting checklist.
  </Card>

  <Card title="Command approval" icon="shield" href="/docs/ai/command-approval">
    Pre-approve safe patterns so the agent doesn't pause for `ls`.
  </Card>

  <Card title="Sub-agents" icon="diagram-project" href="/docs/ai/sub-agents">
    When the agent spawns parallel workers for independent tasks.
  </Card>

  <Card title="MCP" icon="plug" href="/docs/ai/mcp">
    Give the agent access to your own tools.
  </Card>
</CardGroup>
