Turn any directed graph into colored ASCII art for your terminal
Project description
graphtty
Turn any directed graph into colored ASCII art for your terminal. Pure Python, zero external dependencies.
Installation
pip install graphtty
Deep Agent (ocean theme)
Supervisor Agent (dracula theme)
More examples available in the
screenshots/directory.
Quick start
from graphtty import render
graph = {
"nodes": [
{"id": "start", "name": "User Input", "type": "entry"},
{"id": "router", "name": "Router", "type": "condition"},
{"id": "search", "name": "Web Search", "type": "tool"},
{"id": "calc", "name": "Calculator", "type": "tool"},
{"id": "respond", "name": "Respond", "type": "model"},
],
"edges": [
{"source": "start", "target": "router"},
{"source": "router", "target": "search", "label": "search"},
{"source": "router", "target": "calc", "label": "calc"},
{"source": "search", "target": "respond"},
{"source": "calc", "target": "respond"},
],
}
print(render(graph))
┌ entry ─────┐
│ User Input │
└─────┬──────┘
│
▼
┌ condition ──┐
│ Router │
└──────┬──────┘
┌search─└──calc───┐
▼ ▼
┌ tool ──────┐ ┌ tool ──────┐
│ Web Search │ │ Calculator │
└──────┬─────┘ └──────┬─────┘
└───────┌─────────┘
▼
┌ model ──┐
│ Respond │
└─────────┘
Nodes support descriptions and nested subgraphs:
# Descriptions appear as extra lines inside the box
{"id": "a", "name": "LLM", "type": "model", "description": "gpt-4o"}
# Nested subgraphs render as boxes within boxes
{"id": "b", "name": "Pipeline", "type": "subgraph", "subgraph": {"nodes": [...], "edges": [...]}}
Apply a color theme:
from graphtty import render, RenderOptions, get_theme
print(render(graph, RenderOptions(theme=get_theme("monokai"))))
CLI
graphtty graph.json
graphtty graph.json --theme monokai
graphtty graph.json --ascii
graphtty graph.json --no-types
Themes
Ten built-in color themes:
default monokai ocean forest dracula solarized nord catppuccin gruvbox tokyo-night
graphtty --list-themes
JSON format
graphtty reads a simple JSON format:
{
"nodes": [
{ "id": "a", "name": "Start", "type": "entry" },
{ "id": "b", "name": "Process", "type": "tool", "description": "optional detail" },
{ "id": "c", "name": "End", "type": "exit" }
],
"edges": [
{ "source": "a", "target": "b", "label": "optional" },
{ "source": "b", "target": "c" }
]
}
Benchmarks
graphtty uses a custom Sugiyama-style layout engine and optimized canvas operations for fast rendering. Benchmarks across all 10 sample graphs (50 iterations each, Python 3.11):
| Sample | Avg (ms) | Ops/sec |
|---|---|---|
| react-agent (4 nodes) | 0.15 | 6,593 |
| book-writer-agent (6 nodes) | 0.25 | 4,083 |
| deep-agent (7 nodes) | 0.32 | 3,144 |
| function-agent (8 nodes) | 0.37 | 2,686 |
| workflow-agent (11 nodes) | 0.49 | 2,060 |
| world-map (15 nodes) | 0.61 | 1,651 |
| rag-pipeline (10 nodes) | 0.70 | 1,427 |
| supervisor-agent (7+subs) | 0.80 | 1,250 |
| etl-pipeline (12 nodes) | 0.82 | 1,225 |
| code-review (8+subs) | 1.21 | 829 |
Run python scripts/benchmark.py to reproduce on your machine.
Related Projects
- uipath-dev: Developer console for debugging and inspecting AI agents
- uipath-python: Python SDK and CLI to build, test, and deploy AI agents
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file graphtty-0.1.5.tar.gz.
File metadata
- Download URL: graphtty-0.1.5.tar.gz
- Upload date:
- Size: 507.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04aaf748b15ba82092724330433ddca3cdfc5bf0d2c7f3178a314a644ca86d81
|
|
| MD5 |
6c194263176708ec56822179f1b18bee
|
|
| BLAKE2b-256 |
807fc27de89576cfadce28a3e53b1a4eaa0958ddcb3e1a8ae6e2799b08f1956d
|
Provenance
The following attestation bundles were made for graphtty-0.1.5.tar.gz:
Publisher:
cd.yml on UiPath/graphtty
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphtty-0.1.5.tar.gz -
Subject digest:
04aaf748b15ba82092724330433ddca3cdfc5bf0d2c7f3178a314a644ca86d81 - Sigstore transparency entry: 930104941
- Sigstore integration time:
-
Permalink:
UiPath/graphtty@5486549893a02bc4909ce3cca62aa8cdad60ca90 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/UiPath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@5486549893a02bc4909ce3cca62aa8cdad60ca90 -
Trigger Event:
push
-
Statement type:
File details
Details for the file graphtty-0.1.5-py3-none-any.whl.
File metadata
- Download URL: graphtty-0.1.5-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe57fd35144fd17275ae16700e54910d9415d92d9318c84e843823a281c5d243
|
|
| MD5 |
fcda66170c48ffed777a07411022581f
|
|
| BLAKE2b-256 |
c19c2f76ae91861365c2afa289777bde82746ec6ae4369930c78ea96bbd06133
|
Provenance
The following attestation bundles were made for graphtty-0.1.5-py3-none-any.whl:
Publisher:
cd.yml on UiPath/graphtty
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
graphtty-0.1.5-py3-none-any.whl -
Subject digest:
fe57fd35144fd17275ae16700e54910d9415d92d9318c84e843823a281c5d243 - Sigstore transparency entry: 930104942
- Sigstore integration time:
-
Permalink:
UiPath/graphtty@5486549893a02bc4909ce3cca62aa8cdad60ca90 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/UiPath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@5486549893a02bc4909ce3cca62aa8cdad60ca90 -
Trigger Event:
push
-
Statement type: