Skip to main content

KAgent LangGraph Integration

This package provides LangGraph integration for KAgent with A2A (Agent-to-Agent) server support.

Features

  • A2A Server Integration: Compatible with KAgent's Agent-to-Agent protocol
  • Event Streaming: Real-time streaming of graph execution events
  • FastAPI Integration: Ready-to-deploy web server for agent execution

Quick Start

from kagent.core import AsyncControllerClient, AsyncFileTokenProvider, KAgentConfig
from kagent.langgraph import KAgentApp
import os
import sqlite3
from langgraph.checkpoint.sqlite import SqliteSaver
from langgraph.graph import StateGraph
from langchain_core.messages import BaseMessage
from typing import TypedDict, Annotated, Sequence


class State(TypedDict):
    messages: Annotated[Sequence[BaseMessage], "The conversation history"]


config = KAgentConfig.from_file()
controller_client = AsyncControllerClient(
    config.grpc_url,
    agent_name=config.app_name,
    token_provider=AsyncFileTokenProvider(),
)

# Define and compile your graph
builder = StateGraph(State)
# Add nodes and edges...
checkpointer = SqliteSaver(
    sqlite3.connect(
        os.getenv("KAGENT_CHECKPOINT_DB", "/tmp/langgraph-checkpoints.sqlite"),
        check_same_thread=False,
    )
)
graph = builder.compile(checkpointer=checkpointer)

# Create KAgent app
app = KAgentApp(
    graph=graph,
    agent_card={
        "name": "my-langgraph-agent",
        "description": "A LangGraph agent with KAgent integration",
        "version": "0.1.0",
        "capabilities": {"streaming": True},
        "defaultInputModes": ["text"],
        "defaultOutputModes": ["text"],
    },
    config=config,
    controller_client=controller_client,
)

# Build FastAPI application
fastapi_app = app.build()

Architecture

The package mirrors the structure of kagent-adk but uses LangGraph instead of Google's ADK:

  • LangGraphAgentExecutor: Executes LangGraph workflows within A2A protocol
  • KAgentApp: FastAPI application builder with A2A integration
  • Task Management: Automatic A2A task persistence through one shared authenticated gRPC channel

Configuration

Set runtime.control_plane_url and runtime.gateway_url in /config/config.json when running locally.

# Load process settings from /config/config.json (see Configuration).

Deployment

Use the same deployment pattern as kagent-adk samples with Docker and Kubernetes.

Runtime configuration file

Managed entry points call materialize_from_bootstrap("/config") from kagent.core to fetch and materialize the controller bundle before KAgentConfig.from_file(). The file loader does not bootstrap. For a standalone process, create the file and load it directly:

{"runtime":{"control_plane_url":"http://localhost:8083","gateway_url":"http://localhost:8083","name":"my-agent","namespace":"default","log_level":"info"}}

Provider credentials and standard OTEL_* overrides remain environment inputs.

Metadata

Release files for kagent-langgraph 1.0.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 kagent-langgraph 1.0.1
File Size Uploaded Provenance Actions
kagent_langgraph-1.0.1.tar.gz 13.0 kB Without provenance Details for kagent_langgraph-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kagent-langgraph 1.0.1
File Interpreter ABI Platform Actions
kagent_langgraph-1.0.1-py3-none-any.whl Python 3 none any Details for kagent_langgraph-1.0.1-py3-none-any.whl

Total release size: 24.8 kB

Release files / kagent_langgraph-1.0.1.tar.gz

Download URL kagent_langgraph-1.0.1.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ff5404cdc48f452ff8f9a93b1be03c2b4f3736d6f8de3b739c047f04e3556de9
BLAKE2b-256 checksum
How to use checksums
cc291aec82158693cdf9fc56ccff727a80ce63d15cbd25a367f8b8b38546ecb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / kagent_langgraph-1.0.1-py3-none-any.whl

Download URL kagent_langgraph-1.0.1-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63aaf07a50a41c9695e3806d288459df7153c9f10a142a1b5701f00bb6d8569d
BLAKE2b-256 checksum
How to use checksums
e6fde07e8628d19711d62ea4493bab42f746ef546fcde2f250518721c0d09140
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for kagent-langgraph 1.0.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

1.0.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