# Monitor

The **Monitor** (`/organizations/{org}/workspaces/{ws}/monitor`) is one timeline of what happened for the agents of the active workspace: recorded tool calls, hook executions, conversations started by a webhook and scheduled runs, newest first, with live updates on top. It is the workspace sidebar's **Monitor** entry. It replaces the earlier **Activity** feed and **Tool Traces** table, and their addresses redirect here (see [Old addresses](#old-addresses)).

Each agent has the same timeline pinned to it: the **Monitor** section of its *Overview* group (`?tab=logs`), which used to be called Logs. It is the same component without the agent filter.

The Monitor adds no storage of its own. Each row is read at request time from the table that already records it, so the Monitor cannot disagree with the page that owns the row.

## What it lists

The group chips at the top (**All**, **Agents**, **Automations**) narrow the list to a family of types. The **Type** column names the type of each row:

| Type | Group | What a row is | Read under |
|---|---|---|---|
| **Tools** | Agents | one tool call, with its arguments, result, duration and error | `audit_log:read` |
| **Hooks** | Agents | one hook execution | `conversation:read` |
| **Webhooks** | Automations | a conversation a webhook started | `conversation:read` |
| **Scheduled** | Automations | one run of a scheduled task, manual or scheduled | `agent.task:read` |

Each type is read under the permission that guards the same rows on their own page. A type the caller may not read is left out of the list rather than failing it, and the chips are drawn from the types the engine says the caller can read. The sidebar entry and the agent section appear to anyone who holds at least one of those keys.

> **Managed services.** With Polyant managed services the workspace Monitor also lists governance decisions and spend-limit stops (Agents, under `agent.governance:read`), the changes people made in this workspace (**Changes**, under `audit_log:read`) and data purges (**Data retention**, under `conversation:read`), and the organization and the Admin Console have a Monitor of their own. See [The Monitor above the workspace](#the-monitor-above-the-workspace).

## Filters and the address

Beside the chips sit an **Agent** filter (on the workspace page only), an **Outcome** filter (**Succeeded**, **Failed**, **Blocked**, **Running**) and a search box. The search matches what each type can match cheaply: a tool's name, action and error, a hook's function, event and error, a task's name and error, a webhook conversation's title or id.

The filters live in the URL (`?group=`, `?type=`, `?agent=`, `?outcome=`, `?q=`), so a link opens the Monitor already narrowed and a reload keeps the view. A link can name exactly one type, which shows as an **Only: …** chip with a control to remove it; the redirects from the old addresses use that. The agent section keeps its filters in the page instead.

The list loads 50 rows at a time; **Load more entries** reads the next page.

## Live updates

The status beside the chips reads **Live**, **Paused** or **Not connected**. While live, new rows appear on top as the engine announces them: a tool call once it ends, a scheduled run as it starts, a webhook as it matches. A live row shows what the event carried and is replaced by the stored row a few seconds later, with its full details. **Pause** freezes the live rows where they are, so a busy list stops moving while you read it, and **Resume** catches up.

Live rows come from the workspace's [activity stream](https://docs.polyant.ai/concepts/activity-stream), which needs `analytics:read`. A caller without it still reads the stored rows, and a reload shows what arrived since. The stream is held in each engine process, so with several replicas the live rows are the ones the replica you are connected to saw; the page says so under the list.

Replies, reasoning and memory writes are not Monitor rows. They show in the live activity feed of the [header](https://docs.polyant.ai/admin-panel/overview#header-controls) and, for one conversation, in the **Live** view of its [detail page](https://docs.polyant.ai/admin-panel/conversations#show-activity-and-live).

## The detail drawer

Click a row to open its drawer. It shows when the row happened, the agent, the type, the outcome and the duration, a link to **Open the conversation** where the row has one, and the row's payload as labelled blocks: **Arguments** and **Result** for a tool call or a hook, **Started by** (**Scheduled** or **Manual**), **Result** and **Tools used** for a scheduled run, **Channel** and **Messages** for a webhook conversation. A block holding an object is shown as labelled rows, and only nested values keep their formatted JSON. An error, when there is one, comes first.

The foot of the drawer says how long rows of that type are kept.

## How long entries are kept

Tool calls, hook executions and scheduled runs are deleted by the daily housekeeping once they are older than the **Analytics retention** [installation policy](https://docs.polyant.ai/admin-panel/installation-policies) (90 days by default), and the page notes the number of days under the list. A webhook conversation is kept as long as the conversation exists. A conversation deleted by hand or by a [retention policy](https://docs.polyant.ai/admin-panel/retention) takes its tool calls and hook executions with it.

## Old addresses

The earlier pages redirect to the Monitor, already narrowed:

| Old address | Opens |
|---|---|
| `/organizations/{org}/workspaces/{ws}/activity` (Activity) | the Monitor |
| `/organizations/{org}/workspaces/{ws}/audit-logs` (Audit Logs) | the Monitor, **Tools** only |
| `/organizations/{org}/audit-logs` | the Monitor of the default workspace, **Tools** only |
| the agent's **Logs** section and its **Tool Traces** tab | the agent's **Monitor** section, at the same `?tab=logs` |

## The Monitor above the workspace

> **Managed services.** This capability is available with Polyant managed services.

The same timeline, with the same chips, columns and drawer, is read at two more levels:

- **Organization** (`/organizations/{org}/monitor`, the **Monitor** entry in the organization's *Overview* group): the organization's changes under `org.audit:read`, and the governance decisions, spend-limit stops and data purges of the workspaces the caller reaches. It opens on **Changes**. Above the timeline, a caller with `org.governance:read` sees the **Governance summary**, closed by default and shown only when the period holds events: how often governance rules fired across the organization, with the trend and the agents compared one click further. That summary used to be on the organization's home.
- **Admin Console** (`/platform/monitor`, platform admins only): the changes made in every organization of the installation.

The types this adds:

| Type | Group | What a row is | Workspace | Organization | Admin Console |
|---|---|---|---|---|---|
| **Governance** | Agents | a governance verdict, worded as gate, verdict and phase | `agent.governance:read` | `agent.governance:read` | |
| **Spend limit** | Agents | an agent stopped by a [spend cap](https://docs.polyant.ai/admin-panel/spend-cap), with the window and the amounts | `agent.governance:read` | `agent.governance:read` | |
| **Change** | Changes | a change a person made: the [management trail](https://docs.polyant.ai/admin-panel/audit-logs#the-three-audit-tiers) and, with the advanced-audit licence, the [authorization trail](https://docs.polyant.ai/admin-panel/authz-audit) | `audit_log:read` | `org.audit:read` | platform admin |
| **Retention** | Data retention | one [retention](https://docs.polyant.ai/admin-panel/retention) purge or dry run, with the cutoff and what it deleted | `conversation:read` | `conversation:read` | |

A change in the workspace Monitor is one recorded against that workspace. A change about the organization itself (its people, roles and own settings) belongs to no workspace and appears only in the organization's Monitor. A change names a person rather than an agent, so its row has no agent. Its drawer opens on **Who**, **Workspace**, **On what** and **IP address**, with the action code, the raw target and the stored record in a closed **Technical details** block. Governance and spend-limit rows are kept as long as their conversation; changes and purges have no automatic expiry.

The organization and Admin Console Monitors have no agent filter and no conversation links, since they span several workspaces. Each has its own live feed (`GET /api/activity-stream/live/organization` and `GET /api/activity-stream/live/platform`): changes and, for the organization, governance decisions and spend-limit stops, under the same connection caps as the workspace feed.

The old audit pages redirect to the **Changes** of these Monitors: the organization's **Audit** (`/organizations/{org}/settings/organization/audit`), its earlier **Management audit** and **Authorization audit** addresses, and the Admin Console's **Management audit** (`/platform/settings/audit`).

## API

`GET /api/monitor` reads the workspace Monitor for the workspace the request names. It takes `types` (comma-separated), `group`, `agent`, `outcome` (`ok`, `error`, `blocked`, `running`), `from` and `to` (ISO 8601), `q` (at most 200 characters), `cursor` and `limit` (default 50, at most 100). It answers with `items`, a `nextCursor` for the next page (`null` on the last), and `types`: the types the caller may read, each with its group and its retention in days (`null` when it has no expiry of its own). `GET /api/monitor/{type}/{id}` returns one row with its payload.

With managed services, `GET /api/organizations/{orgSlug}/monitor` and `GET /api/platform/monitor` (platform admin) take the same parameters, each with its own `/{type}/{id}`.

These routes answer a panel session. A personal API token reads an empty list, because its narrower ceiling is not evaluated per type. For scripted reads use the route each type comes from, such as `GET /api/audit-logs` for tool calls; see [Analyse production traffic](https://docs.polyant.ai/how-to/analyse-production-traffic).

See also: [Activity Stream (concept)](https://docs.polyant.ai/concepts/activity-stream) for the bus behind the live rows, and [Audit logs](https://docs.polyant.ai/admin-panel/audit-logs) for the trails the Monitor reads.
