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

# Architecture and technology stack

> The services and libraries Formation is built on, what each one is responsible for, and what you run to host it.

Formation is one Go binary backed by PostgreSQL and Temporal. The binary serves
the dashboard, the operator API, every connector endpoint, and the Temporal
worker that executes agent work. Everything else (model providers, sandboxes,
web providers, MCP servers) is an external service reached through an adapter.

```mermaid theme={null}
flowchart LR
    subgraph People and software
      S[Slack, Teams, Discord, Telegram, SMS]
      A[Your application]
      O[Operators in the dashboard]
    end
    subgraph Formation binary
      C[Connectors and intake]
      API[Dashboard and operator API]
      W[Temporal worker]
    end
    P[(PostgreSQL)]
    T[Temporal service]
    M[Model providers]
    X[Sandboxes]
    WB[Web providers]
    MCP[MCP servers and APIs]
    S --> C
    A --> C
    O --> API
    C --> P
    API --> P
    C --> T
    T --> W
    W --> P
    W --> M
    W --> X
    W --> WB
    W --> MCP
```

## What you run

| Component | Required | What it does |
| - | - | - |
| Formation binary (container image) | Yes | Connector ingress, dashboard, operator API, Temporal worker. Several replicas can run against the same database. |
| PostgreSQL | Yes | The record of everything: agents, encrypted credentials, the conversation graph, memories, runs, tool results, audit, settings. Migrations run at boot. The test suite runs against PostgreSQL 16. |
| Temporal service | Yes | Durable execution. Temporal Cloud or a self-hosted cluster. See [Temporal](https://docs.formation.texturehq.com/runtime/temporal.md). |
| At least one model provider | Yes | OpenRouter, an OpenAI-compatible endpoint, Anthropic, Google Gemini, or a model router. See [Model providers](https://docs.formation.texturehq.com/connectors/model.md). |
| A public HTTPS URL | Yes | Inbound webhooks, OAuth callbacks, vault drop links and sketch links all need `PUBLIC_URL` to be reachable by the people and services involved. See [Configuration](https://docs.formation.texturehq.com/operations/configuration.md#features-that-need-a-public-url). |
| Sandbox provider | Optional | Fly.io Sprites, Modal, or a remote execution broker, for code, shell commands and repository work. See [Sandboxed execution](https://docs.formation.texturehq.com/runtime/sandboxed-execution.md). |
| Web provider | Optional | Search, page reading and interactive browsing. Cloudflare is the default provider. See [Web capabilities](https://docs.formation.texturehq.com/runtime/web-capabilities.md). |
| Vector index | Optional | `pgvector` in the same PostgreSQL, or Qdrant, for semantic memory recall. Keyword search works without one. See [Memory backends](https://docs.formation.texturehq.com/runtime/memory-backends.md). |
| OpenTelemetry collector, error tracker | Optional | Traces, logs and error reports. See [Telemetry](https://docs.formation.texturehq.com/telemetry.md) and [Error tracking](https://docs.formation.texturehq.com/error-tracking.md). |

The [installation guide](https://docs.formation.texturehq.com/operations/installation.md) covers starting the service
and the full list of process settings.

## How work flows

1. **Intake.** A connector authenticates an inbound message (a Slack event, a
   Teams activity, a signed webhook from your application), identifies the
   speaker and the conversation, and writes it to the append-only
   conversation graph in PostgreSQL. Intake is durable before it is
   acknowledged, so a message is never lost because a worker was busy.
2. **Addressing.** Formation decides which messages are work for which agent.
   See [Addressing](https://docs.formation.texturehq.com/runtime/addressing.md).
3. **Execution.** Each admitted run starts a Temporal workflow. Model calls,
   tool calls and deliveries run as Temporal activities on the Formation
   worker. If a process restarts or deploys mid-run, Temporal resumes the
   workflow on another replica, and the [turn checkpoints](https://docs.formation.texturehq.com/runtime/turn-checkpoints.md)
   in PostgreSQL keep side effects from being repeated blindly.
4. **Context.** Each model call gets the agent's current permitted context:
   history, memories, profile, and tools. A change in that context partway
   through a run (a new participant, a revised memory, a follow-up message)
   never cancels or restarts the run. Later steps just see the current
   context. See [Design principles](https://docs.formation.texturehq.com/philosophy.md).
5. **Delivery.** Replies and progress updates go back through the connector.
   Each one is checked against the audience it is going to immediately before
   it is sent. See [Egress reliability](https://docs.formation.texturehq.com/runtime/egress-reliability.md).

## Why Temporal is core

Temporal is not an optional queue. It is the engine that runs agent work:

* **Runs.** Every agent run is a Temporal workflow, so long work survives
  deploys, crashes, provider outages, and waits on people.
* **Schedules.** Each occurrence of a recurring [schedule](https://docs.formation.texturehq.com/runtime/schedules.md)
  fires from a Temporal workflow.
* **Follow-ups.** When an agent decides to [check back later](https://docs.formation.texturehq.com/runtime/follow-ups.md),
  the wait is a durable Temporal timer.
* **Bounded retries.** Retryable provider failures are retried with bounds
  inside the workflow; terminal refusals end the run cleanly.

PostgreSQL stays the authority for what happened and who may see it. Temporal
decides what runs next. Without an active Temporal connection, Formation still
accepts and stores incoming messages, and the dashboard stays usable, but no
new work executes until Temporal is ready.

## Libraries and formats

| Area | Built with |
| - | - |
| Runtime | Go, `net/http`, `pgx` for PostgreSQL, `sqlc` for typed queries, forward-only embedded SQL migrations |
| Durable execution | Temporal Go SDK |
| Dashboard | React, TypeScript, Vite and Tailwind, compiled and embedded in the binary. No separate web server. |
| Tools | Model Context Protocol (official Go SDK) for remote MCP servers; REST API connections; built-in tools |
| Sketches | Excalidraw, served by the binary at `PUBLIC_URL/sketch/...` |
| Browser automation | Chrome DevTools Protocol, against a remote browser from the configured web provider |
| Telemetry | OpenTelemetry traces and logs over OTLP |
| Secrets | Envelope encryption in PostgreSQL under `MESH_AGENT_MASTER_KEY`, which never enters the database |

## Boundaries

* **Configuration lives in the database, not in environment variables, for
  anything agent-shaped.** Environment variables configure the process
  (database, public URL, encryption key, optional deployment-supplied
  services). Agents, connectors and their credentials are created at runtime
  and stored encrypted. See [Configuration](https://docs.formation.texturehq.com/operations/configuration.md).
* **No vendor lock-in above the adapters.** Model providers, sandboxes, web
  providers, and error trackers are each selected by configuration. A hosting
  operator can supply any of them through open protocols such as the
  [execution broker protocol](https://docs.formation.texturehq.com/runtime/execution-broker-protocol.md) and the
  [web broker protocol](https://docs.formation.texturehq.com/runtime/web-broker-protocol.md).
* **Perspective.** Agents on the same installation never see one another's
  private conversations, memories, or credentials. See
  [Perspective](https://docs.formation.texturehq.com/perspective.md).

For the component-level view of a run, read [Runtime architecture](https://docs.formation.texturehq.com/layers.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.