Skip to main content

Turn any directed graph into colored ASCII art for your terminal

Project description

graphtty

PyPI downloads PyPI - Version Python versions

Turn any directed graph into colored ASCII art for your terminal.

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" }
  ]
}

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

Acknowledgements

Built with :heart: on top of grandalf, a Python library for graph layout using the Sugiyama algorithm.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphtty-0.1.1.tar.gz (454.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphtty-0.1.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file graphtty-0.1.1.tar.gz.

File metadata

  • Download URL: graphtty-0.1.1.tar.gz
  • Upload date:
  • Size: 454.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for graphtty-0.1.1.tar.gz
Algorithm Hash digest
SHA256 41d55b3dfd255f95957149708b04e95287fe4cfc0d4fcc913cd649a145f37e20
MD5 264e11744ed5d0d4b56b11d948579f60
BLAKE2b-256 cabbaf14bc212bf15765f955a44ef70e6dd9b44473e8eea125dbbb84c2d08ac2

See more details on using hashes here.

Provenance

The following attestation bundles were made for graphtty-0.1.1.tar.gz:

Publisher: cd.yml on UiPath/graphtty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graphtty-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: graphtty-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for graphtty-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bbd11bd6a94e6a1f995a7e6c69d48e0ec56b246c5094fa0e82bf1f3c6abfc56e
MD5 71175c29c5b10a5d6fcf07fa5d50d97a
BLAKE2b-256 bf5223b85276393418b381f02d13b88485c455f58e14e167cfe2f494f14537e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for graphtty-0.1.1-py3-none-any.whl:

Publisher: cd.yml on UiPath/graphtty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page