---
title: "An agent should see what's happening now"
description: "Give an AI agent your streams' state, their graphs and their logs, so it can answer questions about what's happening and help keep the streams running."
type: "docs-page"
url: "https://tatolab.com/docs/use-cases/agents"
site: "Tatolab"
section: "Use cases"
---

# An agent should see what's happening now

> Give an AI agent your streams' state, their graphs and their logs, so it can answer questions about what's happening and help keep the streams running.

Plenty of questions are about right now: is anyone at the loading dock, has the oven door been open too long, why did the camera feed go black. Answering one usually means a person opening a dashboard or a video feed and looking. An agent could answer it, if it could read what the streams report, and find out why something stopped.

The runtime serves MCP, so an agent connected to it can do those things with the streams you already run.

## What an agent gets

- **Status.** `list_streams` says which streams are running, which failed and why, and which are still loading; `graph` shows each node's state and counters, so a stalled camera or a dropping reader shows up.
- **History.** `logs` reads a project's log, so what your nodes log with `log.info(...)` is something the agent can look back through.
- **Context.** The node catalog describes every node type, with its inputs, their types and defaults, and its outputs, from your nodes' descriptions, and the live graph shows how each stream fits together.
- **Hands.** It can add, link, set and remove nodes in a running stream, each edit saved to the graph document, and open, play and stop projects.

## Three ways to use it

**A watcher** answers questions about what's happening from live data: "Is anyone at the loading dock?" It reads the summaries your nodes log, and the graph's counters.

**An operator** keeps streams healthy: "Why is the picture black?" It reads the graph, finds the node that isn't running, reads why in `failed_because` or the log, and fixes the input value or tells you what's wrong.

**A builder** changes streams: "Add a face blur after the camera." It creates a node file, writes the node, adds it to the running stream, and checks in the graph and the logs that it runs.

## Give the agent answers, not raw data

An agent does better with outputs that answer questions directly than with every detection. A small node that summarizes, and logs its summary, gives it both a live value and a history:

```python title="nodes/scene_summary.py"
from collections import deque

from tatolab.stream import Input, Output, Records, RuntimeContextLimitedAccess, log, node

SECOND_NS = 1_000_000_000


@node.meta(
    category="Analysis",
    description="Once a second, for each label the detector reports: how many are in view now, and the most at once in the last minute.",
)
@node.process
class SceneSummary:
    detections = Input(Records, delivery="newest", requires=("objects",))
    summary = Output(Records, names=("labels",))

    def __init__(self) -> None:
        self.history: deque[tuple[int, dict[str, int]]] = deque()
        self.next_summary_at_ns = 0

    def process(self, ctx: RuntimeContextLimitedAccess) -> None:
        detections = ctx.inputs.read(self.detections)
        if detections is None:
            return
        now = ctx.time
        counts: dict[str, int] = {}
        for found in detections["objects"]:
            counts[found["label"]] = counts.get(found["label"], 0) + 1
        self.history.append((now, counts))
        while self.history and self.history[0][0] < now - 60 * SECOND_NS:
            self.history.popleft()
        if now < self.next_summary_at_ns:
            return
        self.next_summary_at_ns = now + SECOND_NS
        labels = {label for _, seen in self.history for label in seen}
        summary = {
            label: {"now": counts.get(label, 0), "peak_last_minute": max(seen.get(label, 0) for _, seen in self.history)}
            for label in sorted(labels)
        }
        log.info("scene summary", labels=summary)
        ctx.outputs.write(self.summary, {"labels": summary}, timestamp_ns=now)
```

Link the camera into `ObjectDetector`, the detector from [Use your model](https://tatolab.com/docs/build/models), and its `detections` into `SceneSummary`. Now "is anyone at the loading dock?" is the agent reading the latest `scene summary` records with `logs`. The node's description tells the agent what the summary means. A dashboard elsewhere can read the summary too, if you send it to a relay with a `MoqTrackSend`.

## Connect the agent

On the machine that runs the streams:

```sh
claude mcp add tatolab -- tatolab mcp
```

For a camera machine elsewhere, over `ssh`, with the path where the installer put `tatolab`:

```sh
claude mcp add dock -- ssh dock-box .local/bin/tatolab mcp
```

See [Agents and MCP](https://tatolab.com/docs/share/agents) for the tools, the built-in recipes, and setup for other clients.

## Keep it safe

- **What the agent sees leaves the machine.** The logs it reads and the input values in the graph go to the agent's model provider. Decide for each camera whether that's acceptable before connecting an agent, and keep secrets out of input values.
- **Control stays local.** The runtime's control socket is reachable only by your user account on that machine; anything remote goes through `ssh`, with `ssh`'s keys and permissions.
- **Approve changes.** Agents can stop and rewire streams. Use your client's permission settings to approve the tool calls that change things.
- **Changes are recorded.** Each committed edit is one commit on the project's history, under the author the agent gives, and `undo` takes back its own.

## Limits

- **The agent reads what you log.** It has no tool that samples an output's data; log what it should know, and it reads the log.
- **The agent drives.** Tato answers tool calls; scheduling regular checks is up to your agent or its framework.

## Related guides

- [Agents and MCP](https://tatolab.com/docs/share/agents): tools, recipes and setup.
- [Tutorial step 6](https://tatolab.com/docs/tutorial/agents): connect an agent to the motion watcher.
- [Logs](https://tatolab.com/docs/run/logs): what a node's `log.info` calls turn into.
