Skip to main content

KaGraph

KaGraph is a LangGraph-compatible agent orchestration framework built on top of kaggle_benchmarks conversation primitives. It helps you build stateful, multi-node agent workflows with traceable execution, message-aware state updates, checkpointing, and a built-in web studio for inspecting graph behavior.

If you find this project helpful and would like to support its development, consider buying me a coffee!

Buy Me A Coffee

Features

  • Native kaggle_benchmarks Integration: Preserves message roles and objects directly without flattening context.
  • Stateful Workflows: Define your state schema and update it incrementally through independent graph nodes.
  • Advanced Control Flow: Supports conditional routing, fan-out/fan-in, timeouts, and retry policies.
  • Built-in Checkpointing: Pause, inspect, and resume graph execution for human-in-the-loop workflows.
  • KaTrace Studio: Visualize graph paths, inspect trace events, review LLM calls, compare messages, and replay past runs.

Prerequisites

KaGraph relies on the kaggle_benchmarks library. In Kaggle notebooks, it is already available. In a local environment, install and configure it before running KaGraph.

For local development, configure your model proxy credentials:

cp .env.example .env

Then fill in MODEL_PROXY_API_KEY and MODEL_PROXY_URL.

Installation

pip install kagraphx

For local development from source:

git clone https://github.com/anpc849/ka-graph.git
cd ka-graph
pip install -e ".[dev]"

Quick Start

Start KaTrace Studio first so traces from your graph run are captured and visible:

# Local machine
kagraph-studio --mode local

# Kaggle notebook or remote environment
!kagraph-studio --mode localtunnel

Open http://127.0.0.1:3000 in local mode, or use the printed LocalTunnel URL in tunnel mode.

Once Studio is running, execute a traced graph:

from kagraph import START, END, StateGraph, MessagesState
from kagraph.llms import load_llm
from kagraph.prompts import invoke_llm
from kagraph.messages import HumanMessage
from kagraph.tracing import trace

llm = load_llm("qwen/qwen3-235b-a22b-instruct-2507")

def agent(state: MessagesState):
    response = invoke_llm(llm, messages=state["messages"], prompt="Answer the user.")
    return {"messages": [response]}

graph = StateGraph(MessagesState)
graph.add_node("agent", agent)
graph.add_edge(START, "agent")
graph.add_edge("agent", END)
app = graph.compile()

with trace("MyFirstAgent"):
    result = app.invoke({"messages": [HumanMessage("Hello!")]})

print(result["messages"][-1].content)

Learn More

Use the docs for API details and the tutorial notebooks for runnable workflows:

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for kagraphx 0.1.1

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

Source distribution (sdist)

Source distribution for kagraphx 0.1.1
File Size Uploaded Provenance Actions
kagraphx-0.1.1.tar.gz 193.3 kB Without provenance Details for kagraphx-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kagraphx 0.1.1
File Interpreter ABI Platform Actions
kagraphx-0.1.1-py3-none-any.whl Python 3 none any Details for kagraphx-0.1.1-py3-none-any.whl

Total release size: 382.4 kB

Release files / kagraphx-0.1.1.tar.gz

Download URL kagraphx-0.1.1.tar.gz
Size 193.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8a2501b7dafb0e911db5f69ce4ea342799d46ce117da02dde60a04825b1fc5e6
BLAKE2b-256 checksum
How to use checksums
871fee35754418ad7aab53fb76a3a74fcf2ae5e4c0dfe61436db7057634ad43b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / kagraphx-0.1.1-py3-none-any.whl

Download URL kagraphx-0.1.1-py3-none-any.whl
Size 189.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc1f4b9170333527e9fd68d7a6e9ee8f80009d79d0695f1c0fffe0b86bdfe473
BLAKE2b-256 checksum
How to use checksums
28f54244971009c112aa9fcd1ed02dcd47de3610f78e5424f6a74f53ed78c7a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for kagraphx 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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