Skip to main content

LangGraph-compatible agent orchestration with message-native state, checkpointing, and KaTrace Studio.

Project description

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

# Optional: stream backend logs in the notebook output
!kagraph-studio --mode localtunnel --verbose

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.

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

kagraphx-0.1.0.tar.gz (193.9 kB view details)

Uploaded Source

Built Distribution

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

kagraphx-0.1.0-py3-none-any.whl (189.6 kB view details)

Uploaded Python 3

File details

Details for the file kagraphx-0.1.0.tar.gz.

File metadata

  • Download URL: kagraphx-0.1.0.tar.gz
  • Upload date:
  • Size: 193.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for kagraphx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a72a3421a57b04c810319e35d34322998cfd94c8ff51c853541ad50a0d56dfd2
MD5 73970a8150c1dc506461995bf2beaf5b
BLAKE2b-256 1817a2aac0a7957b5098bc23d4aa9031048eed4a615aa8bf59fd6a3ce9408e8e

See more details on using hashes here.

File details

Details for the file kagraphx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kagraphx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 189.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for kagraphx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5e6fd0a7425f32ba62d6060ae7f0ca0487ae601f2195f1dec7da95fc1254521
MD5 0bb29e5fe3997ca083ced57d80917eaf
BLAKE2b-256 97d7698fe6c74c34fd45e8170097e6e2b5955d4e1b5503f585bab3d7d1d35ebe

See more details on using hashes here.

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