Skip to main content

agents-tree

agents-tree is a live terminal CLI and optional herdr plugin for viewing coding-agent sessions and their nested subagents as a tree. It shows Antigravity CLI (agy), Claude Code, Codex and Grok Build with each agent's model and effort, context use, elapsed time and status.

In a terminal, agents-tree .:

agents-tree run in a demo project: a session and its five subagents, one nested

As a live overlay in herdr, one key away (prefix+a):

The same tree as a live overlay in herdr

It reads the transcripts Antigravity CLI (agy), Claude Code, Codex and Grok Build keep on disk and never talks to a session, so nothing it prints ends up in an agent's context. It has no dependencies beyond Python 3.10.

Antigravity CLI (agy), Claude Code, Codex and Grok Build are supported.

Install

uv tool install agents-tree      # or: pipx install agents-tree

From a checkout: uv tool install ., or run it in place with PYTHONPATH=src python3 -m agents_tree.

Optional: herdr plugin

Install the plugin to open the live tree over the focused agent pane with one key:

herdr integration install claude                 # herdr learns each pane's session id
herdr plugin install blavka/agents-tree
herdr plugin action invoke agents-tree.setup-keys

Use

agents-tree                 # every running session on this machine
agents-tree .               # sessions running in this directory (or its newest session)
agents-tree ~/src/api       # same, for another directory
agents-tree 1a2b3c4d        # one session, by id or a unique prefix (an ambiguous one lists the matches)
agents-tree -r              # only running subagents and their parents
agents-tree -w              # live view like top, refreshed every 2 s (-n 5 for 5 s)
agents-tree --json .        # one schema-versioned JSON document for scripts
agents-tree --provider agy   # Antigravity CLI sessions
agents-tree --provider codex # Codex sessions under ~/.codex (or $CODEX_HOME)
agents-tree --provider grok # Grok Build sessions under ~/.grok (or $GROK_HOME)

--json writes the provider-neutral session and agent tree, including each agent's detail, to stdout. It is intended for scripts and other tools; errors go to stderr and it cannot be combined with --watch.

In the live view:

Key Does
↑ ↓ / j k / wheel select an agent
Enter / → / click open its detail: the prompt it was given, its tool calls (and the one it is waiting on), its last message, request and token counts, transcript path
Esc / ← / q back to the tree (in the tree: clear the selection, then quit)
PgUp PgDn Home End scroll the detail, or jump through the tree
r toggle running-only
Ctrl+C quit

The live view takes the mouse for clicks and the wheel; most terminals still select text with Shift held, or start it with --no-mouse. When the tree is taller than the terminal, the oldest finished agents are folded into a "… N older finished agents hidden" line.

Enter on a row opens that agent's detail:

Detail of a running subagent: its prompt, tool calls and the command it waits on

Column Meaning
label agent-type: description as the spawning agent gave it; main for the session itself
model (effort) model of the agent's latest request, and its effort level (models without effort show none)
context tokens in the latest request (input + cache + output), and that as a share of the context window
elapsed first to last transcript entry; up to now while the agent runs
status subagents: running (active in the last 2 minutes, or waiting on a tool call), completed / failed (as Claude Code reported), done (finished, no outcome recorded), idle (a teammate waiting for its next message), stale (no sign of life and no completion marker); main: the session's own state, or not running

Caveats

  • Context window. Claude Code does not record it, so it is taken from the model family: 1M for Claude 5 models (Opus, Sonnet, Fable), 200k otherwise. Grok Build stores it in summary.json when set; otherwise 2M for grok-4 / grok-code, 128k for other models. Override with --window 200000 or AGENTS_TREE_WINDOW.
  • Transcript formats are internal to each agent CLI and may change between releases. Unknown lines are skipped, but a field that moves makes its column show - until agents-tree is updated.
  • Elapsed spans wall-clock time, so a session resumed over several days, or a subagent woken up again by a message, shows that whole span.
  • Running sessions (Claude) come from claude agents --json; without claude on PATH, agents-tree falls back to ~/.claude/sessions/ (interactive sessions only).
  • Running sessions (Grok) are the ones in ~/.grok/active_sessions.json (or $GROK_HOME) whose process is still alive, including a session that is only waiting. A session also counts while its updates.jsonl was written in the last two minutes, or while a subagent's meta.json still says running.
  • Running sessions (Codex) are inferred from a transcript written in the last two minutes, including one of its subagent transcripts. Codex's on-disk files do not retain the process id for a quiet, waiting session, so such a session may drop out of the all-sessions view until it writes again; a directory or session-id target still shows its newest saved session.
  • Running sessions (Antigravity CLI / agy) are inferred from transcripts written in the last two minutes under ~/.gemini/antigravity-cli/brain/ (or $ANTIGRAVITY_HOME). The older ~/.gemini/antigravity/ layout remains supported.

herdr plugin

herdr shows your agents, not their subagents. The plugin in this repository opens the live tree for the focused agent pane over that pane; closing it gives the layout back.

Key Action
prefix+a live tree of the focused agent's session; q or the same key closes it
prefix+shift+a live tree of every running session

On a pane without an agent, prefix+a shows every running session. The plugin runs the copy of agents-tree bundled in the repository, so it needs only python3 3.10+ (or AGENTS_TREE_PYTHON pointing at one). setup-keys writes one marked block into your herdr config.toml (backed up first) and leaves keys you already use alone; agents-tree.remove-keys takes it out again. The open-split and open-tab actions show the same tree in a split or a tab.

For development, link a checkout instead: herdr plugin link /path/to/agents-tree.

Development

uv sync
uv run pytest
uv run pylint src
uv run pylint tests --disable=redefined-outer-name,protected-access,unused-argument
uv run pyright

CI (.github/workflows/test.yaml) runs the same on every push and pull request: lint and types on Python 3.12, then the tests, a test run and a package build on 3.10 to 3.14.

To release, bump version in pyproject.toml, src/agents_tree/__init__.py and herdr-plugin.toml, then push a matching tag (git tag v0.2.0 && git push origin v0.2.0). .github/workflows/publish.yaml checks the tag against the version, tests, builds and publishes to PyPI through trusted publishing.

AGENTS.md is the guide for working on the code, including adding a provider; docs/demo/ shows how to check agents-tree against a real agent run in a throwaway project.

Providers live in src/agents_tree/providers/: each turns one agent CLI's files into the provider-neutral Session/Agent model in model.py, which render.py draws.

License

MIT

Metadata

Release files for agents-tree 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agents-tree 1.2.0
File Size Uploaded
agents_tree-1.2.0.tar.gz 40.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agents-tree 1.2.0
File Interpreter ABI Platform
agents_tree-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 91.6 kB

Release files / agents_tree-1.2.0.tar.gz

Download URL agents_tree-1.2.0.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c25bc14aee6f5223b381c967ad510f9e32e4c899f82c71cb66312f54faff510a
BLAKE2b-256 checksum
How to use checksums
3c38bce02c9bbf51a296ad2ce731d7711a5faee5853e8beb4855a8baa2562202
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / agents_tree-1.2.0-py3-none-any.whl

Download URL agents_tree-1.2.0-py3-none-any.whl
Size 50.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d789adc1364cb2a77d4e52260859133ddaf9d7b68c520d73e7233f4241aa1e4
BLAKE2b-256 checksum
How to use checksums
a12a75f94a724188be46f9022a07f8447d5a817b0fd2594fa3d63a4c3b17fe55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page