{% extends "base.html" %} {% block title %}{{ agent_name }} - Help{% endblock %} {% block content %}

Getting Started

What is oAI-Web?

oAI-Web (agent name: {{ agent_name }}) is a secure, self-hosted personal AI agent built on the Claude API with full tool-use support. It runs on your home server and exposes a clean web interface for use inside your local network. The agent can read email, browse the web, manage calendar events, read and write files, send push notifications, generate images, and more — all via a structured tool-use loop with optional confirmation prompts before side-effects.

System Requirements

  • An API key for at least one AI provider: Anthropic or OpenRouter
  • Python 3.12+ (or Docker)
  • PostgreSQL (with asyncpg) — the main application database
  • PostgreSQL + pgvector extension only required if you use the 2nd Brain feature (can be the same server)

First-Time Setup Checklist

  1. Copy .env.example to .env and set ANTHROPIC_API_KEY (or OPENROUTER_API_KEY), AIDE_DB_URL (PostgreSQL connection string), and DB_MASTER_PASSWORD
  2. Start the server: python -m uvicorn server.main:app --host 0.0.0.0 --port 8080 --reload
  3. On first boot with zero users, you are redirected to /setup to create the first admin account
  4. Open SettingsCredentials and add any additional credentials (CalDAV, email, Pushover, etc.)
  5. Add email recipients via Settings → Whitelists → Email Whitelist
  6. Add filesystem directories via Settings → Whitelists → Filesystem Sandbox — the agent cannot touch any path outside these directories
  7. Optionally set system:users_base_folder in Credentials to enable per-user file storage (e.g. /data/users)
  8. Optionally configure email accounts and Telegram via their respective Settings tabs

Key Concepts

Agent
A configured AI persona with a model, system prompt, optional schedule, and restricted tool set. Agents run headlessly — no confirmation prompts, results logged in run history.
Tool
A capability the AI can invoke: read a file, send an email, fetch a web page, generate an image, etc. Every tool call is logged in the Audit Log.
Confirmation
Before any side-effect tool (send email, write file, delete calendar event) executes in interactive chat, a modal asks you to approve or deny. Agents skip confirmations.
Audit Log
An append-only record of every tool call, its arguments, and outcome. Never auto-deleted unless you configure a retention period.
Credential Store
An AES-256-GCM encrypted key-value store in PostgreSQL. All secrets (API keys, passwords) live here — never in the agent's context window.
User Folder
When system:users_base_folder is set, each user gets a personal folder at {base}/{username}/. Agents and the Files page scope all file access to this folder automatically.

Quick Start

Navigate to the Chat page, type a message and press Enter. The agent responds, uses tools as needed (you'll see spinning indicators), and may ask for confirmation before sending email or writing files.

Chat Interface

Sending Messages

Press Enter to send. Use Shift+Enter for a newline within your message. The Clear History button (✕) in the status bar wipes the in-memory conversation for the current session — the agent starts fresh.

File Attachments

The paperclip button (📎) in the input bar opens a file picker. Only shown when the active model supports vision or documents. Supported formats:

  • Images: JPEG, PNG, GIF, WebP, AVIF — shown as thumbnails in the preview strip
  • PDF: shown as a file chip with the filename in the preview strip

You can also paste images directly from the clipboard (Ctrl/Cmd+V in the chat input). Multiple files can be attached in one message. Remove any attachment by clicking the ✕ on its preview chip.

Attachments are sent inline with the message as base64-encoded data. Large files (especially PDFs) will increase the token count and cost of the request.

Model Picker

The button in the status bar (bottom of the chat area) shows the currently active model. Click it to open a searchable modal listing all available models from all configured providers. Use arrow keys to navigate, Enter to select, Esc to close. Your selection is persisted in localStorage across page loads.

Capability Badges

Small badges in the status bar show what the active model supports:

  • 🎨 Image Gen — can generate images (use via the image_gen tool in agents)
  • 👁 Vision — can read images and PDFs; the attachment button is shown
  • 🔧 Tools — supports tool/function calling
  • 🌐 Online — has live web access built in

Tool Indicators

While the agent is working, small badges appear below each message:

  • Pulsing blue — tool is currently running
  • Solid green — tool completed successfully
  • Solid red — tool failed or returned an error

Confirmation Modal

When the agent wants to execute a side-effect tool (send email, write/delete a file, send a push notification), a yellow modal appears showing the tool name and arguments. Click Approve to proceed or Deny to block the action. The agent receives your decision and continues.

Pausing the Agent

The Pause button in the sidebar is a global kill switch. While paused, no agent runs, scheduled tasks, inbox processing, or Telegram responses will execute. The button turns green and shows Resume when paused. Click it again to re-enable everything.

Files

The Files page is a browser for your personal data folder (provisioned automatically when system:users_base_folder is configured by your admin). It lets you navigate, download, and delete files directly from the web UI.

Browsing

  • Click a folder to enter it. Use the breadcrumb trail at the top to navigate back.
  • Hidden files (names starting with .) are not shown.
  • Columns show file size and last-modified timestamp.

Downloading

  • Download — downloads an individual file.
  • ↓ ZIP — downloads an entire folder (and its contents) as a ZIP archive. The Download folder as ZIP button in the header always downloads the current folder.

Deleting Files

A red Delete button appears next to downloadable files. Clicking it shows a confirmation dialog before the file is permanently removed. Deletion is instant and cannot be undone.

Protected files: files whose names start with memory_ or reasoning_ cannot be deleted from the UI. These are agent memory and decision logs maintained by email handling agents — deleting them would disrupt the agent's continuity.

No Folder Configured?

If the Files page shows "No files folder configured", ask your administrator to set the system:users_base_folder credential to a base path (e.g. /data/users). Your personal folder at {base}/{username}/ is created automatically.

Agents

Agents are headless AI personas with a fixed system prompt, model, and optional cron schedule. Unlike interactive chat, agents run without confirmation modals — their allowed tools are declared at creation time. Results and token usage are logged per-run in the Agents page.

Email handling agents (created automatically by Email Accounts setup) are hidden from the Agents list and Status tab. They are managed exclusively via Settings → Email Accounts.

Creating an Agent

Click New Agent on the Agents page. Required fields:

  • Name — displayed in the UI and logs
  • Model — any model from a configured provider
  • Prompt — the agent's task description or system prompt (see Prompt Modes below)

Optional fields:

  • Description — shown in the agent list for reference
  • Schedule — cron expression for automatic runs
  • Allowed Tools — restrict which tools the agent may use
  • Max Tool Calls — per-run limit (overrides the system default)
  • Sub-agents — toggle to allow this agent to create child agents
  • Prompt Mode — controls how the prompt is composed (see below)

Scheduling

Enter a cron expression in the Schedule field. The format is:

minute  hour  day-of-month  month  day-of-week

Examples:

  • 0 8 * * 1-5 — weekdays at 08:00
  • */15 * * * * — every 15 minutes
  • 0 9 * * 1 — every Monday at 09:00
  • 30 18 * * * — every day at 18:30

Use the Enable / Disable toggle to pause a schedule without deleting the agent. The Run Now button triggers an immediate run regardless of schedule.

Prompt Modes

Three modes control how the agent prompt is combined with the standard system prompt (SOUL.md + security rules):

Combined (default)
The agent prompt is prepended as the highest-priority instruction. The standard system prompt (SOUL.md, date/time, USER.md, security rules) is appended after. Best for most agents.
System only
The standard system prompt is used as-is; the agent prompt becomes the task message sent to the agent. Useful when you want {{ agent_name }}'s full personality but just need to specify a recurring task.
Agent only
The agent prompt fully replaces the system prompt — no SOUL.md, no security rules, no USER.md context. Use with caution. Suitable for specialized agents with a completely different persona.

Tool Restrictions

Leave Allowed Tools blank to give the agent access to all tools. Select specific tools to restrict — only those tool schemas are sent to the model, making it structurally impossible to use undeclared tools.

MCP server tools appear as a single server-level toggle (e.g. Gitea MCP), which enables all tools from that server. Individual built-in tools are listed separately.

Follow the least-privilege principle: give each agent only the tools it actually needs.

Sub-agents

Enable the Sub-agents toggle to give an agent access to the create_subagent tool. This allows the agent to spin up child agents to handle parallel or specialized tasks. Sub-agents run synchronously (the parent waits for the child to finish) and are logged separately in run history with parent_agent_id set.

Image Generation in Agents

Agents can generate images using the image_gen tool. Important: the agent model must be a text/tool-use model (e.g. Claude Sonnet), not an image-generation model. The image_gen tool calls the image-gen model internally, saves the result to disk, and returns the file path. The default image-gen model is openrouter:openai/gpt-5-image — override via the system:default_image_gen_model credential.

Generated images are saved to the agent's user folder. The file path is returned as the tool result so the agent can reference it.

MCP Servers

MCP (Model Context Protocol) is an open protocol for exposing tools to AI models over a network. oAI-Web can connect to external MCP servers and use their tools exactly like built-in tools. Tool names are namespaced as mcp__{server}__{tool}.

Requirements for a Compatible MCP Server

To be compatible with oAI-Web, an MCP server must:

  • Expose an SSE endpoint at /sse
  • Use SSE transport (not stdio)
  • Be compatible with mcp==1.26.*
  • If built with Python FastMCP: use uvicorn.run(mcp.sse_app(), host=..., port=...)not mcp.run(host=..., port=...) (the latter ignores host/port in mcp 1.26)
  • If connecting from a non-localhost IP (e.g. 192.168.x.x): disable DNS rebinding protection:
    from mcp.server.transport_security import TransportSecuritySettings
    mcp = FastMCP(
        "my-server",
        transport_security=TransportSecuritySettings(
            enable_dns_rebinding_protection=False
        ),
    )
    Without this, the server rejects requests with a 421 Misdirected Request error.
  • oAI-Web connects per-call (open → use → close), not persistent — the server must handle this gracefully

Adding an MCP Server

  1. Go to Settings → MCP Servers
  2. Click Add Server
  3. Enter:
    • Name — display name; also used for tool namespacing (slugified)
    • URL — full SSE endpoint, e.g. http://192.168.1.72:8812/sse
    • Transport — select sse
    • API Key — optional bearer token if the server requires authentication
  4. Click Save

oAI-Web will immediately attempt to connect and discover tools. The tool count is shown in the server list.

Tool Namespacing

A server named Gitea MCP (slugified: gitea_mcp) exposes tools as mcp__gitea_mcp__list_repos, mcp__gitea_mcp__create_issue, etc. In the agent tool picker, the entire server appears as a single toggle — enabling it grants access to all of its tools.

Refreshing Tool Discovery

Click Refresh on any server in Settings → MCP Servers to re-discover tools without restarting oAI-Web. Useful after adding new tools to an MCP server.

Settings

{% if current_user and current_user.is_admin %}

General (Admin)

  • Agent Control: Pause / Resume the global kill switch
  • Runtime Limits: Max Tool Calls (per run) and Max Autonomous Runs per Hour — stored in the credential store for live override without restart
  • Trusted Proxy IPs: Comma-separated IPs for X-Forwarded-For trust (requires restart)
  • Users Base Folder: Set system:users_base_folder to an absolute path (e.g. /data/users) to enable per-user file storage. Each user's folder at {base}/{username}/ is created automatically.
  • Audit Log Retention: Set a retention period in days (0 = keep forever); manual clear available

Whitelists (Admin)

  • Email Whitelist: Only addresses on this list can receive emails from {{ agent_name }}. Supports per-address daily send limits.
  • Web Whitelist (Tier 1): Domains always accessible to the agent, regardless of session type. Subdomains are automatically included (e.g. wikipedia.org covers en.wikipedia.org).
  • Filesystem Sandbox: Absolute paths the agent may read/write. The agent cannot access any path outside these directories (unless it falls within a user's personal folder). Add directories before using filesystem tools.

Credentials (Admin)

A generic AES-256-GCM encrypted key-value store for API keys and other secrets. Keys use a namespace:key convention. Service-specific credentials (CalDAV, CardDAV, Pushover) are managed in their own dedicated tabs — they do not appear here. See the Credential Key Reference for a full list of system keys.

DAV (CalDAV & CardDAV) (Admin)

Configure CalDAV and CardDAV for the admin user. There is no system-wide fallback — every user configures their own credentials independently via this tab (admin) or the CalDAV / CardDAV tab (regular users).

  • CalDAV: server URL, username, password, and calendar name. Bare hostnames (e.g. mail.example.com) are accepted — https:// is prepended automatically.
  • CardDAV: tick Same server as CalDAV to reuse the same credentials, or enter a separate URL, username, and password. The SOGo URL pattern (/SOGo/dav/{user}/Contacts/personal/) is built automatically.
  • Allow contact writes: when enabled, agents can create, update, and delete contacts (not just read them). This is per-user — enabling it for your account does not affect other users.
  • Test buttons: verify CalDAV and CardDAV connectivity without saving.

Pushover (Admin)

Pushover sends push notifications to iOS and Android devices.

  • App Token: registered once at pushover.net for this oAI-Web installation. Shared by all users — they cannot see or change it.
  • User Key: the admin's personal Pushover user key, shown on your pushover.net dashboard. Each user sets their own User Key in Settings → Pushover.
{% endif %}

Inbox

The Inbox tab manages trigger rules for the legacy global IMAP/SMTP account. For per-user or multi-account email handling, use the Email Accounts tab instead.

  • Trigger Rules: keyword phrases that, when matched in an incoming email subject/body, dispatch a specific agent and optionally send an auto-reply
  • Matching is case-insensitive and order-independent — all tokens in the phrase must appear somewhere in the message

Email Accounts

Email Accounts is the main email management area, separate from the legacy Inbox tab. Each account is independently configured with its own IMAP/SMTP credentials and an account type:

Trigger account
Uses IMAP IDLE (instant push). Dispatches agents based on keyword trigger rules in incoming emails.
Handling account
Polls every 60 seconds. A dedicated AI agent reads and handles each email. The agent gets access to email, Telegram (optional), and filesystem tools scoped to the user's data folder.

For handling accounts, you can also configure:

  • Extra tools: optionally give the handling agent access to Telegram and/or Pushover for notifications
  • Telegram keyword: a short slug (e.g. work) that creates a /work Telegram command. Send /work <message> to interact with the email agent via Telegram. Built-in sub-commands: /work pause, /work resume, /work status
  • Pause / Resume: temporarily suspend a handling account without disabling it entirely. Also available via the Telegram /keyword pause command

The handling agent uses memory files (memory_<username>.md) and reasoning logs (reasoning_<username>.md) stored in the user's data folder to maintain continuity across email sessions. These files are visible in the Files page but cannot be deleted there.

Telegram

  • Bot Token: your Telegram bot's API token (from @BotFather). Admins set a global token here; non-admin users can set their own per-user token in their Profile tab.
  • Chat ID Whitelist: only messages from listed chat IDs are processed
  • Default Agent: agent dispatched for messages that don't match any trigger rule
  • Trigger Rules: same keyword-matching logic as email inbox
{% if not (current_user and current_user.is_admin) %}

CalDAV / CardDAV

Configure your personal CalDAV and CardDAV connection. There is no system-wide fallback — if you don't configure it, the tools are unavailable to you.

  • CalDAV: server URL, username, password, and calendar name. Bare hostnames are accepted — https:// is added automatically.
  • CardDAV: tick Same server as CalDAV to reuse credentials, or enter separate details.
  • Allow contact writes: when enabled, agents can create, update, and delete contacts.
  • Test buttons: verify connectivity before saving.

Pushover

Set your personal User Key to receive push notifications on your Pushover-connected devices. Your User Key is shown on your pushover.net dashboard. The App Token (the shared application credential) is managed by the admin — you only need your own User Key.

{% endif %}

Webhooks

Inbound webhooks let external services trigger agents via HTTP — useful for iOS Shortcuts, GitHub actions, Home Assistant automations, or any tool that can send an HTTP request.

  • Create a webhook: assign a name, description, and target agent. The secret token is shown once at creation — copy it immediately. Use Rotate Token to generate a new one if it is ever compromised.
  • Trigger via POST: POST /webhook/{token} with body {"message": "..."}
  • Trigger via GET: GET /webhook/{token}?q=your+message — useful for iOS Shortcuts URL actions
  • Enable/disable: toggle a webhook on/off without deleting it

The Outbound Targets section (same tab) manages named URLs that agents can send JSON payloads to via the webhook tool.

Profile

Available to all users. Contains:

  • Theme: choose from 7 built-in themes (Dark, Darker, Light, Nord, Solarized Dark, Gruvbox, Catppuccin Mocha). Applied immediately server-side with no flash of wrong theme.
  • Account Info: username and email (read-only); editable display name
  • Change Password: update your login password
  • Two-Factor Authentication (TOTP): enable/disable TOTP-based MFA. On setup, a QR code is shown to scan with any authenticator app (e.g. Aegis, Google Authenticator). Once enabled, every login requires a 6-digit code.
  • Data Folder: shows the path of your auto-provisioned personal folder (set by admin via system:users_base_folder). This folder is where the Files page browses and where agent memory files are stored.
  • Telegram Bot Token: per-user Telegram bot token (optional). Overrides the global token for your sessions.

Personality

Edit SOUL.md (agent identity, values, communication style) and USER.md (owner context: name, location, preferences) directly in the browser. Changes take effect immediately — no restart required. Both files are injected into every system prompt in order: SOUL.md → date/time → USER.md → security rules.

2nd Brain

Requires PostgreSQL + pgvector (BRAIN_DB_URL env var). When connected, shows connection status, recent captured thoughts, and a manual capture form. The brain MCP server is exposed at /brain-mcp/sse and requires the brain:mcp_key credential for authentication.

MCP Servers

Add, edit, remove, enable/disable, and refresh external MCP servers. See the MCP Servers section for full setup details.

{% if current_user and current_user.is_admin %}

Security (Admin)

Five independently toggleable security options:

  1. Enhanced Sanitization: strips extended prompt-injection patterns from all external content
  2. Canary Token: a daily-rotating secret injected into the system prompt; if it appears in any tool argument, the call is blocked and you receive a Pushover alert
  3. LLM Content Screening: after fetching web/email/file content, sends it to a cheap screening model for a SAFE/UNSAFE verdict before returning it to the agent
  4. Output Validation: blocks email auto-replies from inbox sessions back to the trigger sender (prevents exfiltration loops)
  5. Content Truncation: caps content length from web fetch, email, and file reads to configurable character limits

See the Security Model section for the broader security architecture.

Branding (Admin)

Customize the sidebar brand name (default: {{ agent_name }}) and logo (default: logo.png). Upload a PNG/JPG/GIF/WebP/SVG logo (max 2 MB). Changes take effect immediately. Reset to defaults by clearing the name field or deleting the logo.

API Key (Admin)

Protects the REST API for external programmatic access (scripts, home automations, other services, Swagger). The web UI always works without a key — a signed session cookie is set automatically on login. The API key is only required for:

  • External tools and scripts calling /api/* directly
  • Swagger UI (/docs) — click Authorize and enter the key

The raw key is shown once at generation time — copy it to your external tool. Only a SHA-256 hash is stored server-side. Regenerating invalidates the previous key immediately.

Use header X-API-Key: <key> or Authorization: Bearer <key> in external requests. If no key is configured, the API is open (home-network default).

{% endif %}
{% if current_user and current_user.is_admin %}

User Management (Admin)

oAI-Web supports multiple users with role-based access. Manage users at Admin → Users.

Roles

Admin
Full access to all settings, whitelists, credentials, and user management. Can see and manage all agents and audit logs across all users.
User
Access to chat, agents, files, and their own settings (Profile, CalDAV, Telegram, Email Accounts, MCP Servers). Cannot access system-wide whitelists, credentials, branding, or security settings.

Creating Users

  1. Go to Admin → Users
  2. Click New User
  3. Enter username, email, password, and select a role
  4. If system:users_base_folder is configured, a personal folder is created automatically at {base}/{username}/

MFA Management

Users set up their own TOTP in Settings → Profile → Two-Factor Authentication. As admin, you can clear any user's MFA from the Users page (useful if they lose their authenticator). The Clear MFA button resets their TOTP secret — they must set it up again on next login.

User Filesystem Scoping

Non-admin users' agents automatically receive a scoped filesystem tool limited to their personal folder ({base}/{username}/). They cannot access paths outside their folder, even if those paths are in the global filesystem whitelist. Admin agents continue to use the global whitelist-based sandbox.

{% endif %} {% if current_user and current_user.is_admin %}

Credential Key Reference

All keys are stored in the encrypted credential store. System keys use the system: prefix.

KeyDescription
system:pausedKill switch — set to "1" to pause all agent activity
system:max_tool_callsLive override of MAX_TOOL_CALLS env var
system:max_autonomous_runs_per_hourLive override of MAX_AUTONOMOUS_RUNS_PER_HOUR
system:audit_retention_daysDays to keep audit entries (0 = keep forever)
system:trusted_proxy_ipsComma-separated IPs for X-Forwarded-For trust (requires restart)
system:users_base_folderBase path for per-user folders (e.g. /data/users). Each user's folder is created at {base}/{username}/.
system:default_image_gen_modelModel used by the image_gen tool (default: openrouter:openai/gpt-5-image)
system:brand_nameCustom sidebar brand name
system:brand_logo_filenameCustom sidebar logo filename in /static/
system:security_sanitize_enhancedOption 1: enhanced injection pattern sanitization
system:security_canary_enabledOption 2: canary token detection enabled
system:canary_tokenAuto-generated daily canary token (read-only)
system:canary_rotated_atTimestamp of last canary rotation (read-only)
system:security_llm_screen_enabledOption 3: LLM content screening enabled
system:security_llm_screen_modelModel for LLM screening (default: google/gemini-flash-1.5)
system:security_llm_screen_blockOption 3 block mode — block vs flag on UNSAFE verdict
system:security_output_validation_enabledOption 4: output validation for inbox sessions
system:security_truncation_enabledOption 5: content truncation
system:security_max_web_charsMax chars from web fetch (default: 20 000)
system:security_max_email_charsMax chars from email body (default: 6 000)
system:security_max_file_charsMax chars from file read (default: 20 000)
system:security_max_subject_charsMax chars of email subject (default: 200)
telegram:bot_tokenGlobal Telegram bot API token
telegram:default_agent_idUUID of agent for unmatched Telegram messages
pushover_app_tokenPushover App Token — managed via Settings → Pushover, not this tab
brain:mcp_key2nd Brain MCP authentication key
system:api_key_hashSHA-256 hash of the external API key (raw key never stored)
system:api_key_created_atTimestamp of last API key generation
system:session_secretHMAC secret for signing web UI session cookies (auto-generated)
{% endif %}

REST API Reference

All endpoints are prefixed with /api. Responses are JSON. If an API key is configured (Settings → General → API Key), external requests must include X-API-Key: <key>. The web UI is exempt via session cookie.

API Explorer: Browse and test endpoints interactively via Swagger UI at /docs or ReDoc at /redoc. Click Authorize in Swagger and enter your API key to make authenticated calls.

Credentials

MethodPathDescription
GET/api/credentialsList all credential keys (values not returned)
POST/api/credentialsSet a credential {key, value, description}
GET/api/credentials/{key}Get a single credential value
DELETE/api/credentials/{key}Delete a credential

Audit Log

MethodPathDescription
GET/api/auditPaginated audit log; params: start, end, tool, session_id, task_id, confirmed, page, page_size
DELETE/api/auditDelete audit entries older than ?older_than_days=N (0 = all)

API Key

MethodPathDescription
GET/api/settings/api-keyReturns {configured: bool, created_at} — never returns the raw key
POST/api/settings/api-keyGenerate a new key — returns {key} once only; invalidates previous key
DELETE/api/settings/api-keyRevoke the current key

Settings

MethodPathDescription
GET/api/settings/limitsCurrent runtime limits
POST/api/settings/limitsUpdate {max_tool_calls, max_autonomous_runs_per_hour}
GET/api/settings/securityCurrent security option states
POST/api/settings/securityUpdate security options
GET/api/settings/brandingCurrent brand name and logo URL
POST/api/settings/brandingUpdate {brand_name}
POST/api/settings/branding/logo/uploadUpload a logo file (multipart)
DELETE/api/settings/branding/logoReset logo to default
GET/api/settings/audit-retentionCurrent audit retention setting
POST/api/settings/audit-retentionUpdate {days}
GET/api/settings/caldavAdmin CalDAV & CardDAV config (same as /api/my/caldav/config)
POST/api/settings/caldavSave admin CalDAV & CardDAV config
GET/api/settings/pushoverCurrent Pushover App Token and admin User Key
POST/api/settings/pushoverSave App Token and admin User Key

Whitelists

MethodPathDescription
GET/api/email-whitelistList whitelisted email recipients
POST/api/email-whitelistAdd/update {email, daily_limit}
DELETE/api/email-whitelist/{email}Remove a recipient
GET/api/web-whitelistList Tier-1 web domains
POST/api/web-whitelistAdd {domain, note}
DELETE/api/web-whitelist/{domain}Remove a domain
GET/api/filesystem-whitelistList sandbox directories
POST/api/filesystem-whitelistAdd {path, note}
DELETE/api/filesystem-whitelist/{path}Remove a directory
GET/api/filesystem-browserServer-side directory listing; param: ?path=

Agents & Runs

MethodPathDescription
GET/api/agentsList agents (excludes email handling agents)
POST/api/agentsCreate an agent
GET/api/agents/{id}Get agent details
PUT/api/agents/{id}Update agent
DELETE/api/agents/{id}Delete agent
POST/api/agents/{id}/runTrigger immediate run
POST/api/agents/{id}/toggleEnable / disable schedule
GET/api/agents/{id}/runsList runs for an agent
GET/api/agent-runsList recent runs across all agents (excludes email handlers)
GET/api/agent-runs/{run_id}Get a specific run including full result text
POST/api/runs/{run_id}/stopStop a running agent

Models

MethodPathDescription
GET/api/modelsAvailable model IDs + default
GET/api/models/infoFull model metadata: name, context, pricing, capabilities

MCP Servers

MethodPathDescription
GET/api/mcp-serversList all MCP servers
POST/api/mcp-serversAdd a server
PUT/api/mcp-servers/{id}Update a server
DELETE/api/mcp-servers/{id}Remove a server
POST/api/mcp-servers/{id}/toggleEnable / disable a server
POST/api/mcp-servers/{id}/refreshRe-discover tools

Telegram & Inbox

MethodPathDescription
GET/api/telegram/configGlobal Telegram bot config
POST/api/telegram/configSave bot token + default agent
GET/api/telegram/whitelistChat ID whitelist
POST/api/telegram/whitelistAdd chat ID
DELETE/api/telegram/whitelist/{chat_id}Remove chat ID
GET/api/telegram/triggersList trigger rules
POST/api/telegram/triggersCreate trigger rule
DELETE/api/telegram/triggers/{id}Delete trigger rule
GET/api/inbox/configLegacy IMAP/SMTP configuration
POST/api/inbox/configSave legacy IMAP/SMTP credentials
GET/api/inbox/triggersList email trigger rules
POST/api/inbox/triggersCreate email trigger rule
DELETE/api/inbox/triggers/{id}Delete email trigger rule
GET/api/inbox/statusStatus of all inbox listeners

Email Accounts

MethodPathDescription
GET/api/my/email-accountsList user's email accounts
POST/api/my/email-accountsCreate an email account
PUT/api/my/email-accounts/{id}Update email account
DELETE/api/my/email-accounts/{id}Delete email account
POST/api/my/email-accounts/{id}/pausePause a handling account
POST/api/my/email-accounts/{id}/resumeResume a paused handling account
POST/api/my/email-accounts/list-folders-previewList IMAP folders using raw credentials (without saving an account)
GET/api/my/email-accounts/available-extra-toolsWhich notification tools are available for handling accounts

Files

MethodPathDescription
GET/api/my/filesList files/folders in the user's data folder; param: ?path=
DELETE/api/my/filesDelete a file; param: ?path=. Protected names (memory_*, reasoning_*) return 403.
GET/api/my/files/downloadDownload a single file; param: ?path=
GET/api/my/files/download-zipDownload a folder as ZIP; param: ?path=
GET/api/my/data-folderReturn the user's provisioned data folder path

User Profile & Settings

MethodPathDescription
GET/api/my/profileGet display name
POST/api/my/profileUpdate display name
GET/api/my/themeGet current theme
POST/api/my/themeSet theme {theme_id}
GET/api/my/mfa/statusWhether MFA is enabled for the current user
POST/api/my/mfa/setup/beginStart MFA setup — returns QR code PNG (base64) and provisioning URI
POST/api/my/mfa/setup/confirmConfirm setup with a valid TOTP code {code}
DELETE/api/my/mfa/disableDisable MFA for the current user
GET/api/my/caldav/configGet per-user CalDAV & CardDAV config
POST/api/my/caldav/configSave per-user CalDAV & CardDAV credentials
DELETE/api/my/caldav/configRemove per-user CalDAV & CardDAV config
POST/api/my/caldav/testTest CalDAV connectivity with current saved config
POST/api/my/caldav/test-carddavTest CardDAV connectivity with current saved config
GET/api/my/pushoverGet current user's Pushover User Key (masked)
POST/api/my/pushoverSave personal User Key {user_key}
DELETE/api/my/pushoverRemove personal User Key
GET/api/my/telegram/whitelisted-chatsList Telegram chat IDs whitelisted for the current user

Webhooks

MethodPathDescription
GET/api/webhooksList inbound webhook endpoints (admin)
POST/api/webhooksCreate endpoint — returns token once (admin)
PUT/api/webhooks/{id}Update name/description/agent/enabled (admin)
DELETE/api/webhooks/{id}Delete endpoint (admin)
POST/api/webhooks/{id}/rotateRegenerate token — returns new token once (admin)
GET/api/my/webhooksList current user's webhook endpoints
POST/api/my/webhooksCreate personal webhook endpoint
PUT/api/my/webhooks/{id}Update personal webhook endpoint
DELETE/api/my/webhooks/{id}Delete personal webhook endpoint
GET/webhook/{token}Trigger via GET — param: ?q=message (no auth)
POST/webhook/{token}Trigger via POST — body: {"message": "...", "async": true} (no auth)
GET/api/webhook-targetsList outbound webhook targets (admin)
POST/api/webhook-targetsCreate outbound target (admin)
PUT/api/webhook-targets/{id}Update outbound target (admin)
DELETE/api/webhook-targets/{id}Delete outbound target (admin)

Monitors

MethodPathDescription
GET/api/watched-pagesList page-change monitors
POST/api/watched-pagesCreate page monitor
PUT/api/watched-pages/{id}Update page monitor
DELETE/api/watched-pages/{id}Delete page monitor
POST/api/watched-pages/{id}/check-nowForce an immediate check
GET/api/rss-feedsList RSS feed monitors
POST/api/rss-feedsCreate RSS feed monitor
PUT/api/rss-feeds/{id}Update RSS feed monitor
DELETE/api/rss-feeds/{id}Delete RSS feed monitor
POST/api/rss-feeds/{id}/fetch-nowForce an immediate fetch

User Management (Admin)

MethodPathDescription
GET/api/usersList all users
POST/api/usersCreate a user {username, email, password, role}
PUT/api/users/{id}Update user (role, active status, etc.)
DELETE/api/users/{id}Delete a user
DELETE/api/users/{id}/mfaClear a user's MFA secret (admin reset)

System Prompt, Tools & Control

MethodPathDescription
GET/api/system-prompt/soulRead SOUL.md content
POST/api/system-prompt/soulSave SOUL.md content
GET/api/system-prompt/userRead USER.md content
POST/api/system-prompt/userSave USER.md content
GET/api/toolsList all registered tools with schemas
POST/api/pausePause all agent activity
POST/api/resumeResume agent activity
GET/api/statusPause state + pending confirmations
GET/healthHealth check

Security Model

Core Principle

External input is data, never instructions. Email body text, calendar content, web page content, and file contents are all passed as tool results — they are never injected into the system prompt where they could alter {{ agent_name }}'s instructions.

Three DB-Managed Whitelists

  • Email whitelist — {{ agent_name }} can only send email to addresses explicitly approved here
  • Web whitelist (Tier 1) — domains always accessible; subdomains included automatically
  • Filesystem sandbox — {{ agent_name }} can only read/write within declared directories (or a user's personal folder)

Tier 2 web access (any URL) is only available in user-initiated chat sessions, never in autonomous agent runs.

User Filesystem Isolation

Non-admin users' agents use a scoped filesystem tool restricted to their personal folder ({base}/{username}/). This is enforced at the tool level regardless of what the agent prompt says. Admin agents use the global whitelist-based sandbox as before.

Confirmation Flow

In interactive chat, any tool with side effects (send email, write/delete files, send notifications, create/delete calendar events) triggers a confirmation modal. The agent pauses until you approve or deny. Agents running headlessly skip confirmations — their scope is declared at creation time.

Five Security Options

  1. Enhanced Sanitization — removes known prompt-injection patterns from all external content before it reaches the agent
  2. Canary Token — a daily-rotating secret in the system prompt; any tool call argument containing the canary is blocked and triggers a Pushover alert, detecting prompt-injection exfiltration attempts
  3. LLM Content Screening — a cheap secondary model screens fetched content for malicious instructions; operates in flag or block mode
  4. Output Validation — prevents inbox auto-reply loops by blocking outbound emails back to the triggering sender
  5. Content Truncation — enforces maximum character limits on web fetch, email, and file content to limit the attack surface of large malicious documents

Audit Log

Every tool call — arguments, result summary, confirmation status, session ID, task ID — is written to an append-only audit log. Logs are never auto-deleted unless you configure a retention period. View them at Audit Log.

Kill Switch

The Pause button in the sidebar immediately halts all agent activity: no new runs, no inbox processing, no Telegram responses. The system:paused credential stores the state and is checked before every operation. Individual email handling accounts can also be paused independently via their Telegram keyword command or the Email Accounts UI.

No Credentials in Agent Context

API keys, passwords, and tokens are only accessed by the server-side tool implementations. The agent itself never sees a raw credential — it only receives structured results (e.g. a list of calendar events, a fetched page).

Telegram & Email Inbox

Telegram

oAI-Web connects to Telegram via long-polling (no webhook required). Admin setup:

  1. Create a bot via @BotFather and copy the bot token
  2. Go to Settings → Telegram and save the bot token
  3. Add your Telegram chat ID to the whitelist (messages from unlisted IDs are silently dropped)
  4. Optionally set a default agent for messages that don't match any trigger rule
  5. Add trigger rules to route specific messages to specific agents

Non-admin users can also set their own Telegram bot token under Settings → Profile → Telegram Bot Token. This creates a personal bot that routes to agents and email accounts scoped to that user.

Each chat maintains its own conversation history (session ID: telegram:{chat_id}), persisted in memory and reset on server restart.

Telegram Keyword Commands (Email Handling)

When an email handling account has a Telegram keyword set (e.g. work), Telegram messages starting with /work are routed directly to that email account's agent. This allows you to interact with the email agent via Telegram without any trigger rules.

Built-in sub-commands (e.g. for keyword work):

  • /work pause — temporarily pause the email account's listener
  • /work resume — resume the listener
  • /work status — show the account's current status
  • /work <any message> — pass the message to the handling agent

Only the Telegram chat ID associated with the email account can use its keyword commands. Other chat IDs are rejected.

Email Inbox — Trigger Accounts

Trigger accounts use IMAP IDLE for instant push notification. When a new email arrives:

  1. Subject + body matched against trigger rules; the first match wins
  2. If matched, the corresponding agent is dispatched; an auto-reply is sent if configured
  3. If no trigger matches, the email is silently ignored (no default agent for trigger accounts)

Sender whitelist check behavior:

  • Whitelisted sender + matching trigger → agent runs, reply sent
  • Whitelisted sender + no trigger → "no trigger word" reply
  • Non-whitelisted sender + matching trigger → agent runs, but Output Validation blocks the reply
  • Non-whitelisted sender + no trigger → silently dropped (reveals nothing to the sender)

Email Inbox — Handling Accounts

Handling accounts poll every 60 seconds. A dedicated AI agent reads each new email and decides how to handle it. The agent has access to:

  • Email tool — list, read, mark as read, move, create folders
  • Filesystem tool — scoped to the user's data folder (if configured)
  • Memory filesmemory_<username>.md (persistent notes) and reasoning_<username>.md (append-only decision log) are injected into each run
  • Telegram tool (optional) — bound to the account's associated chat ID; reply messages automatically include a /keyword <reply> footer for easy follow-up
  • Pushover tool (optional, admin only)

Trigger Rule Matching

Both Telegram and email inbox use the same trigger-matching algorithm:

  • Case-insensitiveURGENT matches urgent
  • Order-independent — all tokens in the trigger phrase must appear somewhere in the message, but not necessarily in sequence
  • Example: trigger phrase daily report matches "Send me the report for the daily standup" but also "Daily summary report please"
{% endblock %}