Skip to main content

kglite-visual: see a knowledge graph, and let an agent drive it

PyPI version Python versions License: MIT Docs

kglite-visual is an interactive viewer, a headless renderer and an agent interface for .kgl knowledge-graph files produced by KGLite. One command opens a browser on a localhost server; the same binary draws an image without one; and while the server runs it speaks the Model Context Protocol, so an agent can drive the window you are looking at.

The Python wheel has no required runtime dependencies: the graph engine, the HTTP server and the WebGL frontend bundle are all inside one compiled extension. No Node, no separate server process, no database service.

Quick Start

The released package:

pip install kglite-visual==0.1.9
kglite-visual graph.kgl

Open the downloadable 17-node team sample from Getting started. The first exploration takes it through browse, inspect, query, filter, calculate, save and export.

The kglite-visual workspace showing the team sample

What you land on is a type-level meta-graph, rather than every instance in the source. .kgl files reach 100M+ nodes, so you inspect counts first and load a bounded slice only when it is useful.

Two more commands, no server and no browser in either:

kglite-visual render graph.kgl --meta -o schema.svg      # one image, one JSON line
kglite-visual export graph.kgl --format gexf -o out.gexf # one file for somebody else's tool

Then hand the running server to an agent. The MCP endpoint is on the same port, and its URL is printed on the same stdout line as everything else:

{"url":"http://127.0.0.1:54137/","port":54137,"pid":69850,"graph":"graph.kgl","mcp":"http://127.0.0.1:54137/mcp"}

→ Getting started · Agents and MCP.

What makes it different

Three things this does that a graph viewer normally does not.

An agent drives the window you are watching. The running server speaks MCP at /mcp — no second process to start, no discovery file, nothing to install: attaching an agent is pointing it at a URL. Twenty-seven tools act on one shared view, with ordered changes and optional revision checks: read what is on screen, put a Cypher result into it, expand or collapse, highlight, zoom, recolour, re-lay-out, export it, draw a picture of it, and run the queries you saved under the names you chose. Whoever changes the view — you, the agent, a curl — every connected window sees the change immediately. Watching an agent expand a type and zoom to what it found is the feature, not a side effect of it. → Agents and MCP.

The honesty model: truncation is drawn into the picture. A graph viewer is a machine for showing you less than there is, and the design position here is that the subset must name itself. The response bound lives in core, not in the UI — a guarantee the client implements is not a guarantee — so a curl, an agent and a second tab all hit the same ceiling. Every bounded answer carries {returned, total, truncated}; a slice carries two of those, because nodes and links share one byte budget and a complete node list can sit beside an incomplete link list. And because an image travels without its response, the banner is drawn into the image, beside three more counts for the other ways a picture can be less than its input: types_shown (a canvas too small for the schema draws the largest types and says top 24 of 98), names_shown (labels that lost their cell keep their circle and lose their name), and folded (a fan too big to read is one wedge saying how big it is). → The honesty model.

Layouts chosen from the graph's own structure — including a real map. A force layout is the right tool for a graph with no discoverable shape and the wrong one for a star, a bipartite result or a schema with disconnected families, which is most of what a real graph hands it. So a neighbourhood is drawn as hop rings, a community-structured graph as packed islands with a quiet boundary round each, and unattached nodes as one labelled grid. And where the nodes carry coordinates there is --layout geo: an equirectangular projection whose longitudes are corrected by the cosine of the data's mid-latitude — so a shelf at 68°N comes out its own shape rather than 2.7× too wide — over the world's real coastline at three scales chosen by how much of the world the frame covers, so a North Sea crop gets the fjords and a world map does not carry 400,000 points nothing can resolve. Nodes with no coordinate go in a labelled tray with a count, never dropped. → Layouts.

From Python, and from a notebook

import kglite_visual as kv

view = kv.show("graph.kgl")     # the same server, in-process
view.url                        # 'http://127.0.0.1:54137/'
view.launch_info                # {'url', 'port', 'pid', 'graph', 'mcp'}
view.close()                    # stops it, frees the port

# Or hand over an in-memory kglite graph — through to_bytes(), never the disk.
import kglite
view = kv.show(kglite.load("graph.kgl"))

In a notebook the returned object renders itself in the cell: a proxy-prefixed iframe where jupyter-server-proxy can reach the port, and no iframe at all — the URL plus an ssh -N -L hint — where the kernel looks remote, because a localhost iframe from a remote kernel is a silently blank frame.

show(path) is the large-graph answer: handing over an in-memory graph costs about 2× the graph's size at the moment of the call. → Python API.

Render and export

The browser’s Export dialog previews visible instances and exact retained relationships, the wider loaded-node induced graph, or a deterministic SVG/PNG. Downloads refuse stale previews after shared changes. The image uses a server layout, separate from the browser camera. Data tables also export scoped CSV.

# an image: --meta, --cypher "…" or --expand type=T rel=R dir=out
kglite-visual render graph.kgl --meta -o schema.svg
kglite-visual render graph.kgl --cypher "MATCH (f:Field) RETURN f" --layout geo --format png

# a file: graphml | gexf | csv | csv-edges | json
kglite-visual export graph.kgl --format gexf -o graph.gexf
kglite-visual export graph.kgl --format csv --cypher "MATCH (n:Field) RETURN n"

The render's layout is seeded and deterministic — the same request produces the same bytes, forever — so --seed is how you get a different arrangement of the same data, and an exact golden baseline is possible at all. Each command writes its file and prints one JSON line describing it; nothing else ever touches stdout. → Render · Export.

Requirements

CPython 3.12+ (one abi3 wheel serves every version from 3.12 up) on macOS, Linux and Windows, plus a .kgl file supported by the embedded KGLite reader — this version pins kglite 0.21.4, which reads compatible files written by older releases. Building from source additionally needs a Rust toolchain; the published wheels and the source distribution both carry a prebuilt frontend, so neither needs Node at install time.

Documentation

Full docs at kglite-visual.readthedocs.io.

Rendering is cosmos.gl (MIT, OpenJS Foundation): a WebGL GPU force layout, fed over a binary protocol — typed-array buffers for topology and positions, JSON for metadata.

Stability

Alpha, pre-1.0. The launch contract (one JSON line: url, port, pid, graph, mcp), the render and export summary lines, and the MCP tool names are the surfaces to depend on; everything else may move. CHANGELOG.md records what a user can see change.

License

MIT — see LICENSE.

Metadata

Release files for kglite-visual 0.1.23

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

Source distribution (sdist)

Source distribution for kglite-visual 0.1.23
File Size Uploaded Provenance Actions
kglite_visual-0.1.23.tar.gz 3.2 MB With provenance Details for kglite_visual-0.1.23.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for kglite-visual 0.1.23
File Actions
kglite_visual-0.1.23-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for kglite_visual-0.1.23-cp312-abi3-win_amd64.whl
kglite_visual-0.1.23-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details for kglite_visual-0.1.23-cp312-abi3-musllinux_1_2_x86_64.whl
kglite_visual-0.1.23-cp312-abi3-musllinux_1_2_aarch64.whl CPython 3.12 abi3 Linux musl 1.2+ ARM64 Details for kglite_visual-0.1.23-cp312-abi3-musllinux_1_2_aarch64.whl
kglite_visual-0.1.23-cp312-abi3-manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.28+ ARM64 Details for kglite_visual-0.1.23-cp312-abi3-manylinux_2_28_aarch64.whl
kglite_visual-0.1.23-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for kglite_visual-0.1.23-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
kglite_visual-0.1.23-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for kglite_visual-0.1.23-cp312-abi3-macosx_11_0_arm64.whl
kglite_visual-0.1.23-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for kglite_visual-0.1.23-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 91.3 MB

Release files / kglite_visual-0.1.23.tar.gz

Download URL kglite_visual-0.1.23.tar.gz
Size 3.2 MB
Tags Source
SHA-256 checksum
How to use checksums
dc9e3c77a59960c1071ad87a064b935a0eed21c4330a67b82f63547a220067e8
BLAKE2b-256 checksum
How to use checksums
7ea4c280ecc3e9b82c2bd71662bcd84182912a89694a8be73f17cf6b2265f206
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / kglite_visual-0.1.23-cp312-abi3-win_amd64.whl

Download URL kglite_visual-0.1.23-cp312-abi3-win_amd64.whl
Size 13.2 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c4fc0801e0eaf854a6857e9a0aae2d394704b5ad155eb078ddbd87770d7d4909
BLAKE2b-256 checksum
How to use checksums
356affdd5ff8c76933c7b43c265d04bbfea4bf4a9a3caf93dde6f41ca7ea91a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / kglite_visual-0.1.23-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL kglite_visual-0.1.23-cp312-abi3-musllinux_1_2_x86_64.whl
Size 13.2 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
f6e0c0a163105d6c12671a38f34466a3d6d38f2b1c942f54734552db59c786ff
BLAKE2b-256 checksum
How to use checksums
a2b7d177724b818d7ee22e41e0979f444f2f36b9af91196d2e1e46f1536818f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / kglite_visual-0.1.23-cp312-abi3-musllinux_1_2_aarch64.whl

Download URL kglite_visual-0.1.23-cp312-abi3-musllinux_1_2_aarch64.whl
Size 12.4 MB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
cdf478a1fb28bd7475463b53534b8ccbf72bfea54e36940a17935ec3063359c7
BLAKE2b-256 checksum
How to use checksums
b9171b46a801de6c8938315ae0be240f96e588cc09254f07ec0465e95e16b36b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / kglite_visual-0.1.23-cp312-abi3-manylinux_2_28_aarch64.whl

Download URL kglite_visual-0.1.23-cp312-abi3-manylinux_2_28_aarch64.whl
Size 12.2 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
a0a75dfc269725816d01d95450896b80b83c2d9dcc80f6bc48c9c4febe7e277e
BLAKE2b-256 checksum
How to use checksums
0d1e21ff4a887fdb5c5cd565d58e9b10c509917368e8e6adc03a38c23ec6a9d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / kglite_visual-0.1.23-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL kglite_visual-0.1.23-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 12.9 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
50e13c798f185bdf7552ba0beb08c5bb0fc814049aab8b52e13bc10133b50b44
BLAKE2b-256 checksum
How to use checksums
97c2ae6142ac75751accced13802434b77988974e6789b2940020727ea19982a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / kglite_visual-0.1.23-cp312-abi3-macosx_11_0_arm64.whl

Download URL kglite_visual-0.1.23-cp312-abi3-macosx_11_0_arm64.whl
Size 11.8 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4951a99b00468d39d0b9e0b7ea3ed883c1ada9810aa5500af0ad2777c70df394
BLAKE2b-256 checksum
How to use checksums
bed1edc9862b1e622eae963da7fe2b321520a42bec8ace0f6fa04ad5a29c98ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / kglite_visual-0.1.23-cp312-abi3-macosx_10_12_x86_64.whl

Download URL kglite_visual-0.1.23-cp312-abi3-macosx_10_12_x86_64.whl
Size 12.4 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d16cf8680c3fdd5b8539acf2e884a4a3a05913eb8655449e56e024b330693043
BLAKE2b-256 checksum
How to use checksums
ba283b23f1f4b941c1f735844fe773814fc4c807ba7aadf5b4b8e0bd444887f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Security for kglite-visual 0.1.23

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.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for kglite_visual-0.1.23.tar.gz

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 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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