---
title: "Analytics and exports"
id: "1715"
type: "page"
slug: "analytics"
published_at: "2026-09-20T20:36:25+00:00"
modified_at: "2026-11-18T17:59:48+00:00"
url: "https://xedant.com/agents/multiagent/docs/analytics/"
markdown_url: "https://xedant.com/agents/multiagent/docs/analytics.md"
excerpt: "The analytics report has not gone anywhere — but there is no separate “Analytics” screen…"
---

# Analytics and exports

[https://xedant.com/agents/multiagent/docs/analytics/.md](https://xedant.com/agents/multiagent/docs/analytics/.md)

The analytics report has not gone anywhere — but there is no separate “Analytics” screen in MultiAgent any more. Its content moved to where it is used every day: the “Tokens”, “Cost”, “Speed” and “Chats” screens in the “Management” section (details on the [Tokens, cost and speed](/agents/multiagent/docs/tokens)
 page). The report itself remains the shared data source: the header badge, the chat tables and every machine address described on this page take their numbers from it.

Everything is computed from a local copy of the chat list: MultiAgent refreshes it itself — roughly once a minute, plus right after changes on the agents — and once an hour it reconciles the copy with the agents in full, so the numbers do not drift from reality even after a history recount on an agent. Fresh changes land on the open screens immediately, without a page reload. Opening any screen sends no requests to the live agents: everything is already computed from the copy.

## Metrics for Prometheus

The same numbers the screens show are served at `/metrics` in a format Prometheus and compatible systems understand. The answer is built from the same copy of the data the screens read, so there is no drift between the panel and the external series; the scraper accumulates the history itself — MultiAgent computes nothing all the time.

- charts — cost, tokens by kind, models, messages, prompts, commits, hours of the day and weekdays, distributions and all-time totals;
- live state — whether an agent is up, how many chats are running right now, how many agents sit on each server and in each fleet;
- a label set on every row — the agent and its number, the server (factory) and the fleet; fleets also get separate summary rows with the same numbers.

The address stays silent until both environment variables are set — `MULTIAGENT_METRICS_USERNAME` and `MULTIAGENT_METRICS_PASSWORD`: without them the answer is “not found”, with a wrong pair — a rejection with the standard password request. The password can be given as a SHA-256 fingerprint instead of plaintext. The variables are read on every request, so collection can be switched on and off without a restart, and the panel login is never used for scraping — that is a separate pair.

Two settings change the shape of the data: `MULTIAGENT_METRICS_GRANULARITY` — the step of a point (default `daily`, also `hourly`, `weekly`, `monthly`) and `MULTIAGENT_METRICS_LOOKBACK_DAYS` — how far back the history reaches, in days (default 30). Day boundaries follow the system time zone, so the numbers match the screens.

Scraping is cheap: a ready answer lives in memory for 15 seconds, and however often it is asked for, the database is read at most once in that time. The order of rows is stable, and non-numeric values are never emitted: two scrapes in a row over unchanged data give an identical answer.

```
scrape_configs:
  - job_name: multiagent
    scrape_interval: 60s
    basic_auth:
      username: prometheus
      password: <password from the variable>
    static_configs:
      - targets: ["multiagent:8080"]
    metrics_path: /metrics
```

No manual setup is needed if you deploy the **Prometheus** service from the tools library onto the factory: it receives the address and the credentials of that factory’s app by itself and collects its metrics — see [Tools](/agents/multiagent/docs/tools)
.

## GraphQL: the same report for your own apps

The second machine address is `/graphql`. It serves the same analytics report as the screens, but as structured data: the summary, cost breakdowns, work counters, every time series, cuts by model, agent and factory, the hourly and weekday profiles, the distributions and the recent-chat rows. The answers are computed by the same code as on the screens, so the numbers match by definition.

- read-only: the schema has no operation that changes anything;
- self-describing: the schema is available as a query or as the `/graphql/schema` file — an external program assembles its query itself;
- report conditions: one agent, labels, a fleet, a period and a time step; chats deleted on the agent are left out of the answer by default;
- more than the report: fleets, factories and agents with their own analytics are available as separate fields, plus the summary behind the header badge;
- big numbers survive: tokens and other large counters are carried without precision loss.

Access is separate here too: until `MULTIAGENT_GRAPHQL_USERNAME` and `MULTIAGENT_GRAPHQL_PASSWORD` are set, the address answers “not found”; without a correct pair — a rejection with the standard password request. The password is accepted both as a SHA-256 fingerprint and as plaintext, and it changes without a restart.

```
curl -u portal:<password> -X POST https://multiagent.example.com/graphql \
  -H 'Content-Type: application/json' \
  -d '{"query":"{ analytics(filter:{granularity: DAILY}) { overview { totalCost totalOutputTokens } } }"}'
```

## ClickHouse archive

Optionally, MultiAgent keeps a long-term analytics archive in ClickHouse — for when you need history deeper than a year. Set the environment variable `MULTIAGENT_CLICKHOUSE_URL`, and the database and its `chat_analytics` table are created automatically. From then on, once a minute the chat-copy stats (snapshots updated since the last upload) are appended to the archive, so you can study the history with external tools.

The **“Backfill ClickHouse Stats”** button appears only when the archive is configured, and it uploads everything the archive is missing (for example, after a long downtime).

ClickHouse is an optional addition to the database, not its replacement: the screens still compute from the local tables, so an unavailable archive is never critical and breaks nothing.

Balances and quotas of your LLM accounts are analyzed separately — see [Accounts](/agents/multiagent/docs/accounts)
.

[← Back to documentation](/agents/multiagent/docs)
