channels · routing · message surfaces
Platform-specific events converted to unified message format with metadata: author, channel, attachments, reply context.
Replies route back through originating channel. Sessions track the source surface. Cross-channel messaging supported.
conversation state · message history · thread binding
The session holds the full message thread: user messages, agent replies, and tool call results. This is the conversation history the agent sees each turn.
Talking to the agent on Telegram and Mattermost creates two sessions. Each has its own history — context from one doesn't leak into the other.
When a message arrives, the router matches it to an existing session (by channel + conversation ID) or creates a new one. The session then feeds its history into the agent loop.
The agent can spawn isolated sub-sessions for background work (cron jobs, delegated tasks). These run independently and report results back to the parent session.
core loop · tool execution · decision cycle
while loop. Each iteration sends the full conversation to the API, inspects the response, and either executes tool calls or returns the final text.description before each reply. If a skill applies, its SKILL.md is loaded and followed. Contains instructions, scripts, and domain-specific references.exec (shell), read/write/edit (files), browser (automation), web_search, message (channels), nodes (devices).deny, allowlist, full. Elevated mode runs on host. Ask modes (off, on-miss, always) require user approval for sensitive actions.MEMORY.md — curated long-term memory. memory/*.md — daily notes. memory_search — semantic vector search across all files. Workspace files injected as context each session.provider APIs · tool schemas · streaming
messages[] — conversation + system prompttools[] — function schemasmodel — target modelstream: true — token streaming
content — text (streamed or complete)tool_calls[] — function invocationsthinking — reasoning traceusage — token counts
inference · context window · reasoning
Fixed token budget (e.g. 200k). Messages, tools, system prompt, and results must fit. Older messages truncated or summarized.
Autoregressive generation. Each token sampled conditioned on all prior tokens. Temperature and top-p control randomness.
Models trained to emit structured tool calls. Chooses which tools to invoke based on task and available schemas.
Extended chain-of-thought reasoning before the final response. Toggleable. Produces reasoning trace alongside output.