Skip to main content

LangViz-Studio

LangViz-Studio is an observability toolkit for LangGraph workflows.

logo

It enables you to track the execution states, node transitions, and conditional edges of your state-based flows or agent pipelines in real-time, sending all data asynchronously to a customizable endpoint (e.g., a Next.js server) for visualization.

Key Features

  • GraphObservability

    • Automatically records and sends node start/end events, edge transitions, and conditional branch usage.
    • Maintains a unique graphId (UUID by default) and an optional friendly graph_name.
    • Sends data to a configured endpoint (http://localhost:3000 by default).
  • ObservabilityStateGraph

    • A subclass of langgraph.graph.StateGraph that automatically wraps node functions and edge definitions so all observability data is captured with no extra code.
    • Just use add_node(...), add_edge(...), add_conditional_edges(...) as normal, and your graph’s runtime states will be sent in real-time for visualization.
  • Asynchronous and Non-blocking

    • Uses an internal background thread running an asyncio event loop to POST updates via httpx.AsyncClient, ensuring minimal impact on your main workflow thread.

Installation

pip install langviz-studio

(Also ensure you have installed langgraph and other dependencies like langchain_core, if applicable.)

Usage

Below is a minimal example showing how to use LangViz-Studio with LangGraph. In this example, we define two simple asynchronous node functions (run_start and run_end) and connect them in a StateGraph. Observability logs are sent automatically.

import asyncio
from langviz_studio.observability import GraphObservability, ObservabilityStateGraph

async def run_start(state, config=None):
    print("=== [start] node invoked ===")
    state["msg"] = "Hello from start!"
    return state

async def run_end(state, config=None):
    print("=== [end] node invoked ===")
    state["result"] = "Done"
    return state

async def main():
    # 1. Set your Observability
    obs = GraphObservability(
        graph_name="MyExampleGraph"
    )

    # 2. Using ObservabilityStateGraph instead of StateGraph
    workflow = ObservabilityStateGraph(obs, state_type=dict)

    # 3. Nodes are added in the same manner as StateGraph
    workflow.add_node("start", run_start)
    workflow.add_node("end", run_end)
    # Edges / Conditional edges are also added in the same manner as StateGraph
    workflow.add_edge("start", "end")

    workflow.set_entry_point("start")

    # 4) Compile the graph
    compiled = workflow.compile()

    initial_state = {}
    # 5) Run the workflow
    result = await compiled.ainvoke(initial_state)
    print("=== Workflow finished ===")
    print("Final State:", result)

if __name__ == "__main__":
    asyncio.run(main())

Server-Side Visualization

By default, GraphObservability calls two endpoints on your server:

  • POST /api/graph/start — triggered once when the first node starts, to initialize a new graph record.
  • POST /api/graph/ingest — triggered after every node start/end or edge creation, sending updates.

How it Works Internally

  1. A background thread holds an asyncio event loop (via _AsyncLoopThread), so we can await httpx.AsyncClient.post(...) without blocking the main process or requiring the user to manage async.

  2. Each node start/end or edge creation calls a short, synchronous method (_post_to_nextjs) which enqueues a coroutine in the background event loop to do an HTTP POST.

  3. This ensures minimal overhead and “fire-and-forget” updates to your server.

License

MIT License. See LICENSE for details.

Contributing

Pull requests and issues are welcome! If you have suggestions or find bugs, please open an issue or submit a PR on the GitHub repository.

Metadata

Release files for langviz-studio 0.1.2

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

Source distribution (sdist)

Source distribution for langviz-studio 0.1.2
File Size Uploaded Provenance Actions
langviz_studio-0.1.2.tar.gz 6.4 kB Without provenance Details for langviz_studio-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langviz-studio 0.1.2
File Interpreter ABI Platform Actions
langviz_studio-0.1.2-py3-none-any.whl Python 3 none any Details for langviz_studio-0.1.2-py3-none-any.whl

Total release size: 13.7 kB

Release files / langviz_studio-0.1.2.tar.gz

Download URL langviz_studio-0.1.2.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f907e8e3e8be112cca2603264e1faea36b41418d6d98f0c20f1c49201f2f4d74
BLAKE2b-256 checksum
How to use checksums
7d1f35848c3d15bedf3294791ccc470c1f78bebe574fa0b065fabe33095adc16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.5 Darwin/23.2.0

Release files / langviz_studio-0.1.2-py3-none-any.whl

Download URL langviz_studio-0.1.2-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6718825f8bac65fcdf399a113c0cdc711f6f818f5f8375821480b4b91a83052
BLAKE2b-256 checksum
How to use checksums
aa38223df5f9957f54aa44f635bc7982f3047b0e668502859c09ce2a21226ece
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.5 Darwin/23.2.0

Security for langviz-studio 0.1.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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