Skip to content

AI Agent

The Dagu AI Agent is the built-in assistant integrated into the Web UI. It can read files, modify workflows, run tools, and help users operate Dagu through a persistent chat interface.

The same agent foundation also powers:

  • The Web UI assistant
  • The workflow type: agent step
  • Workflow Operator for Slack and Telegram

Accessing the Agent

Click the Agent button at the bottom-left corner of any page. The button shows a yellow pulsing indicator when the agent is processing.

Documentation Map

Use this section as the entry point for the agent-related docs:

Settings

All built-in agent configuration is managed through the Web UI at /agent-settings.

The documentation is split into smaller pages:

For Ollama and other local model servers, see Local AI for the exact Base URL format Dagu expects.

Chat Interface

Sessions

  • Each session is persisted per user
  • Select previous sessions from the sidebar
  • Click + in the header to start a new session
  • Each session tracks cost (token usage × model pricing)

DAG Context

The agent receives DAG context automatically:

  1. Automatic: When viewing a DAG or run page, that DAG's name, file path, run ID, and status are included
  2. Manual: Use the DAG picker in the input area to attach additional DAGs

Model and Soul Selection

The input area includes dropdowns to override the default model and select a soul (personality) for the current message.

Safe Mode

Toggle the shield icon in the header to enable/disable safe mode:

  • On (default): Bash commands denied by policy with ask_user behavior trigger an approval prompt
  • Off: Those same commands run immediately without prompting. Commands denied with block still fail.

Sending Messages

  • Type in the input area at the bottom
  • Press Enter to send (Shift+Enter for new line)
  • Click Stop (square icon) to cancel processing

Available Tools

The agent tool registry currently includes these tools. Skills and remote-node tools appear only when those features are configured:

ToolDescription
bashExecute shell commands (120s default timeout, 600s max)
readRead file contents with line numbers
patchCreate, edit, or delete files
thinkRecord reasoning without side effects
navigateOpen pages in the Dagu UI
ask_userPrompt the user with options or free-text input
delegateSpawn sub-agents for parallel tasks
use_skillExecute a skill from the skill store (when skills are configured)
search_skillsSearch available skills by query (when skills are configured)
remote_agentDelegate tasks to agents on remote nodes (when remote nodes are configured)
list_contextsList available remote nodes for remote_agent (when remote nodes are configured)

Provider-native web search is configured separately in agent settings. It is not exposed as a standalone tool.

Tools can be individually enabled or disabled in Tool Permissions & Bash Policy.

See Tools Reference for full parameter documentation.

Bash Command Policy

Bash command execution is controlled by a configurable policy with regex-based rules. Configure this in Tool Permissions & Bash Policy.

SettingValuesDefaultDescription
Default Behaviorallow, denyallowAction when no rule matches
Deny Behaviorask_user, blockask_userWhat happens when a command is denied. ask_user shows an approval prompt; block silently rejects.

Rules are evaluated in order. Each rule has:

FieldDescription
PatternRegex matched against the command
Actionallow or deny
EnabledToggle the rule on/off

Example: to require approval for destructive commands while allowing everything else, set default behavior to allow and add deny rules:

Pattern: ^rm\s+      Action: deny
Pattern: ^chmod\s+    Action: deny

When a command is denied with ask_user behavior and safe mode is on, a prompt appears showing the command and working directory. The user can approve or reject. Approval times out after 5 minutes. When safe mode is off, ask_user behaves like allow. block always blocks.

The policy also blocks shell constructs that could bypass rule matching: backticks, $(...) command substitution, heredocs (<<), and process substitution (<(...), >(...)).

Configuration Storage

Agent configuration is stored in {DAGU_HOME}/data/agent/config.json. A typical structure looks like:

json
{
  "enabled": true,
  "defaultModelId": "claude-sonnet",
  "toolPolicy": {
    "tools": { "bash": true, "read": true, "patch": true, "...": true },
    "bash": {
      "rules": [],
      "defaultBehavior": "allow",
      "denyBehavior": "ask_user"
    }
  },
  "enabledSkills": [],
  "selectedSoulId": "",
  "webSearch": { "enabled": true }
}

Models are stored separately and managed through their own API. Do not edit these files directly — use the Web UI at /agent-settings.

See Also

Released under the MIT License.