Overview

Bots are packaged Allternit agents: the same runtime engine as any agent, but wrapped with a user-facing identity, discovery surface, and autonomous primitives. Every bot is an agent, and every agent can be packaged as a bot. Bots appear in the Bot Hub (inside Agent Studio), the CommRails left rail, the chat composer, and as @mention targets. Once running, a bot session exposes work progress, gate reviews, deliverables, activity history, and a virtual computer that can be paused, observed, or taken over.

Packaged identity

A bot is an agent plus a botProfile with display name, tagline, welcome message, starter prompts, and accent color.

Autonomous runtime

Connectors, vault secrets, identity channels, messaging, and a virtual computer are resolved at session start.

Multi-bot collaboration

Group chats, swarm consensus, A2A delegation, and subagent families let bots hand off work.

Observable work

WIH progress, gate reviews, deliverables, ledger events, and an activity stream keep humans in the loop.

Bot vs Agent

Allternit uses Agent as the execution primitive and Bot as the packaged, user-facing instance of that primitive. One-line rule: Every Bot is an Agent; not every Agent is a Bot. The canonical contract lives in surfaces/ai.allternit.com/src/lib/bots/BOT_AGENT_CONTRACT.md and is enforced by validateBot() in src/lib/bots/bot-contract.ts.

Bot Hub and discovery

Agent Studio / Bot Hub

Bots are authored and discovered inside Agent Studio. The studio header has an All / Bots / Agents filter and a context-aware Create Bot / Create Agent button. Selecting Bots shows every agent where isBot === true. Bot cards use:
  • botProfile.displayName
  • tagline
  • accentColor
  • @name handle
  • botCategory
Clicking a bot opens its Bot Home (viewType: bot-home), a dedicated management surface for that bot.

CommRails Bots panel

The CommRails left-rail surface aggregates active bot sessions, group chats, and WIH summaries. It exposes two dynamic sections: The panel is backed by useCommRailsStore (src/lib/bots/comrails-store.ts) and persists to local browser storage.

Bot Roster Sidebar

Inside the chat surface, a collapsible Bot Roster Sidebar lists every bot the user owns. Each row shows the bot avatar, display name, and @handle, with hover actions:
  • Open Bot Home
  • Start session
  • Open Inbox
  • Edit
  • Duplicate
The composer also has a Bot pill/tab. Turning it on opens the bot picker; the selected bot is rendered as an @BotName pill, and sending a message starts or continues a bot session.

Bot Session View

A bot session is a regular agent session with metadata.isBot = true, metadata.botProfile, and the bot’s autonomous primitives copied in. The session view contains:

Welcome card

When a bot session is empty, the chat surface renders a welcome card using the bot’s welcomeMessage and a set of clickable starterPrompts. In the Bot Home, the same welcome message and prompts are shown as quick-start chips.

Agent Context Strip

Bot sessions render an Agent Context Strip above the chat with four drawers: The Runtime drawer mirrors the Runtime tab in Bot Home, so users can verify exactly what the bot can access while it is running.

WIH progress

Bots participate in CommRails DAG/WIH work. A WIH (Work-In-Hand) tracks a node of work through its lifecycle: The Bot Home Tasks tab lists every session/task scoped to the bot, grouped by date, and the CommRails bot row can surface the active wihId and badge count.

Gate review

When a bot’s work crosses a policy gate, a review request is emitted to the Rails ledger and surfaced in Agent Activity. Review threads can be:
  • Code-diff reviews — linked to a diffRef.
  • Decision reviews — a plain human approval/denial ask.
From the Agent Activity detail view, operators can Approve (key 1) or Deny (key 2). The decision is recorded as a ReviewDecision ledger event. Gate endpoints are exposed through the Rails API:

Deliverables

Bot outputs are collected as artifacts and canvases. The Bot Home Artifacts tab shows code, markdown, diagrams, browser captures, and images produced across all sessions. Artifacts are extracted from agentElementsParts on assistant messages. When a WIH is closed, the bot can attach evidence (links, files, verification steps) via the WIH close request:

Bot automation

Bots can own scheduled and recurring work through the Automation API and the bot-scoped Routines panel. The three primitives are:

Automation API

Base URL:
Key endpoints: Routines and loops can execute in local or cloud domains. Cloud schedules are dispatched through the Gizzi cron daemon.

Example: create a bot-scoped routine

The Bot Home Automation Tasks tab and the bot session Routines side pane both render routines scoped to the active bot via agent_id.

Multi-bot collaboration

Bot group chat

Bots can be added to persistent group conversations. A group is defined by:
  • id, name, status
  • members — bot id, display name, SwarmRole, weight, status
  • strategy — swarm coordination strategy
  • consensusThreshold — default 0.6
The useBotGroupStore (src/lib/bots/bot-group-store.ts) manages group creation, membership, and per-member status updates. Groups appear in the CommRails Groups section. A bot must have botProfile.groupChatEnabled === true to be added to a group.

Swarm consensus

Group strategies map to SwarmStrategy values: Swarm roles include leader, worker, critic, planner, specialist, and observer. A swarm can be represented as a single agent via swarmToAgent() (src/lib/agents/swarm-as-agent.ts), giving it an agent card and making it @mentionable.

A2A delegation and subagents

Bots delegate work through agent-to-agent (A2A) messaging. The useA2ADelegation hook handles three cases:
  1. Swarm agent@swarm_<id> starts a swarm run.
  2. Delegating agent — an agent with agentCard.canDelegate === true receives an A2A direct message.
  3. Regular agent — no delegation layer; message is routed directly.
Subagents are declared with parentAgentId on the agent record, or modeled through SubagentConfig in src/lib/agents/agent-advanced.types.ts. The bot family tree is derived from:
  • parentAgentId — direct parent/child relationships.
  • agentCard.canDelegate — which agents may spawn subagents.
  • relationships on AdvancedAgentConfig — typed relationships (parent, child, peer, depends-on, delegates-to).
A2A and direct messages are routed through the agent communication store and Rails mail endpoints:

Computer attachment, idle, and takeover

A bot can be configured with a virtual computer through vmOperator on the agent record. This lets the bot run commands, operate browsers, read/write files, and stream a desktop inside an isolated sandbox.

VM operator configuration

At session start, buildBotRuntimeEnv() injects ALLTERNIT_VM_* environment variables from the config, and useStartBotSession() can create or reuse the bot’s persistent sandbox.

Desktop states

The Bot Home Desktop tab streams the sandbox desktop over VNC/noVNC. Control states: When a human takes over, isBotDesktopPaused(agentId) returns true, and the runtime stops issuing sandbox commands until the desktop is handed back. The platform endpoints are: This lets a bot work autonomously, idle while a human investigates, and resume exactly where it left off.

Bot activity stream and event store

Every bot action leaves a trace in the Allternit event store. The primary surfaces are:
  • Agent Activity panel — a bell-icon slide-over listing threads across every agent.
  • Agent Activity page — a full-page view at /agent-activity.
  • Thread detail — messages, ledger events, receipts, and review requests for a single thread.

Events collected

The unified store (src/lib/agents/unified.store.ts) merges several event sources into a per-thread timeline:

Session analytics

getSessionAnalytics(threadId) returns a computed summary including:
  • Total messages, unread count, participants
  • Ledger event count, tool-call count
  • Token usage and estimated cost
  • Tool/model breakdown
  • Session duration
  • Status (active, idle, complete, error)

Ledger API

Secret redaction for bots

Bots never store raw credential material in the agent record. Secrets are declared as secretRefs:

Sealing and resolution

  • Values are sealed server-side via POST /api/v1/agents/:agent_id/secrets/:key and stored encrypted in the agent_secrets table using token_crypto::seal.
  • Responses from the agent API never include the value field.
  • At session start, resolveAgentSecrets() calls POST /api/v1/agents/:agent_id/secrets/resolve, returning decrypted values only for that runtime invocation.
  • Resolved secrets are merged into runtimeEnv by buildBotRuntimeEnv() and passed in AgentContext.
The Bot Home Runtime tab and the session Runtime drawer show:
  • Resolved keys (with values masked in the UI)
  • Missing required keys
  • Connector bindings and their allow-lists
The same pattern applies to connector credentials via resolveAgentConnectors() and POST /api/v1/agents/:agent_id/connectors/resolve.

Creating bots with defineAgent()

Programmatic creation must go through defineAgent() (src/lib/agents/agent-definition.ts). The factory takes industry-standard definition fields (name, description, instructions, model, tools) plus platform-specific overrides, fills canonical defaults, and validates against both the zod schema and the AGENT_CREATION_CHECKLIST.
The checklist covers: canonical schema & identity, registry contract, harness configuration, workspace artifacts, character layer, allowed surfaces/skills, mode surface wiring, routines/loops/goals, tests, and documentation. See AGENT_CREATION_CHECKLIST.md for the full list.

Character layer and 5-layer workspace

Every agent and bot is initialized with a character layer and a 5-layer workspace.

Character layer

The character layer defines how the bot behaves and speaks: Hard-ban categories include publishing, deploy, data_exfil, payments, email_send, file_delete, system_modify, external_communication, code_execution, and other.

5-layer workspace

Agent creation triggers workspace initialization (/api/v1/agents/:id/workspace/initialize). The persisted manifest contains: The workspace file tree and generated documents (identity, role card, hard bans, escalation, voice rules) are written through agentWorkspaceService.

API references

Agents API

The Agents API is the primary surface for creating, updating, discovering, and running agents and bots. For the remote-model-compatible surface, see Agents v1 API.

Automation API

Manage goals, routines, and loops: Full details: Automation API.

Proposed: Bot Activity API

A dedicated /api/v1/bot-activity group would unify bot-specific activity endpoints that today span Rails, Photon, and the agent API: This is not yet implemented; use the Rails mail/ledger endpoints and the agent metrics endpoint (/api/v1/agents/metrics) in the meantime.

Error codes