Skip to main content

reflex-langgraph

Build LangGraph multi-agent apps with a FastAPI backend and a ChatGPT-style Reflex UI, with human approval of tool calls and long-running jobs that survive restarts.

browser ──▶ Reflex server ──HTTP + SSE──▶ your API (create_server) ──▶ LangGraph agents
            (reflex-langgraph ui,          conversations, approvals,          │
             no frontend code)             access policy, jobs                ▼
                                                                    detached job processes

Status: alpha (0.1). The API may change before 1.0.

The UI holds only screen state and never sees API keys; the agents, approvals and jobs live in your API, which works without the UI too. A run belongs to the API: closing the browser or restarting the UI never stops it. There is no login: anyone who can open the UI can ask, approve and cancel, so keep it private (an SSH tunnel, or a firewall open to known addresses).

Features

  • Agents from one YAML file. An agent with workers is a supervisor that delegates to them; nesting gives hierarchies of any depth. Any LangChain chat model (google_genai:…, openai:…, anthropic:…).
  • A chat page like ChatGPT's. Streaming replies with "Thinking", tool calls, the conversation list (search, rename, delete), Try again. Each reply is labelled with the agent that wrote it.
  • Human-in-the-loop. List a tool under approve: and every call to it waits for approve / edit / reject, even inside a worker.
  • Long-running jobs. Describe a job once (JobSpec) and agents get preflight / submit / status / cancel tools. Jobs run detached, with a concurrency limit, step-by-step progress, and a record of who approved them and the hashes of their inputs.
  • Blocked replies. When a provider refuses a prompt or withholds a reply, the chat says so, and the blocked turn is left out of later model calls.
  • Attached files (opt-in: create_server(files=LocalFileStore(...)), or S3FileStore("bucket") with the s3 extra, or your own FileStore subclass). Images, PDFs and text files go with a message: paperclip or drag and drop, up to 100 MB and 30 files. An app adds its own formats (e.g. YAML or compressed CSV) with LocalFileStore(root, formats=[*FORMATS, FileFormat(...)]), and the paperclip follows. The model reads what it can (binary data is described to it); agents hand files to workers and tools read them by id (attached_file).
  • Optional: durable conversations (SQLite), and an access policy with reviewers when an auth= hook identifies callers.

Install

pip install "reflex-langgraph[google]"   # or [openai] / [anthropic]; add s3 for S3 file storage

Quick start

agents.yaml:

model: google_genai:gemini-2.5-flash
entry: supervisor
agents:
  - name: supervisor
    prompt: You coordinate the team.
    workers: [operator]
  - name: operator
    description: Starts jobs. Every start needs approval.
    tools: [train_preflight, train_submit, job_status]
    approve:
      train_submit: [approve, edit, reject]

backend.py:

from pathlib import Path
from pydantic import BaseModel
from reflex_langgraph import (JobRunner, JobSpec, ToolRegistry, build_graph, create_server,
                              job_tools, jobs_router, load_config)

HERE = Path(__file__).parent

class TrainParams(BaseModel):
    dataset: str

class Train(JobSpec):
    name = "train"
    description = "Train a model on a dataset directory."
    params_model = TrainParams

    def command(self, p, job_dir):
        # Jobs run inside their own new folder: give the script's full path.
        return ["python", str(HERE / "train.py"), "--data", p.dataset, "--out", str(job_dir)]

runner = JobRunner(HERE / "jobs", [Train()])
graph = build_graph(load_config(HERE / "agents.yaml"), ToolRegistry(job_tools(runner)))
app = create_server(graph, routers=[jobs_router(runner)])

Run the API (as one process: active runs live in its memory):

uvicorn backend:app --port 8100

Then the UI, in one of two modes (both open at http://localhost:3000):

# Production: to try it or show it. Fast (about 0.2 s, 14 files); one port (3000).
reflex-langgraph ui --prod --port 3000 --backend-port 3000

# Development: while changing UI code. Reloads on save, but the page takes seconds
# (about 250 files); uses two ports, 3000 and 8000.
reflex-langgraph ui

In production the two port flags must be the same number. In development the browser must reach both ports: forward both through a tunnel, or pass --public-url http://<host>:8000. reflex-langgraph ui -h lists the other options (title, greeting, accent, ...).

API keys and settings go in a git-ignored .env (reflex-langgraph init-env creates it from .env.example). The backend loads it with load_env_file. The UI reads only RLG_API_URL and RLG_UI_* from it, so the keys never reach the UI.

For your own page layout, build a Reflex app from the components (from reflex_langgraph.ui import add_agent_page, agent_page, chat_panel, ...).

Examples

Five runnable apps, simplest first, in examples/ (how to run them is there): basic chat, a supervisor team, a three-level hierarchy, human in the loop, and jobs with approval.

Documentation

The API reference, the command line and the changelog are built from the code:

pip install -e ".[docs,google]"
make -C docs html          # -> docs/_build/html/index.html

Development

pip install -e ".[dev,google]"
pytest -q                  # tests/test_docs.py also checks the docstring style

License

MIT

Metadata

Release files for reflex-langgraph 0.1.0

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

Source distribution (sdist)

Source distribution for reflex-langgraph 0.1.0
File Size Uploaded Provenance Actions
reflex_langgraph-0.1.0.tar.gz 107.3 kB Without provenance Details for reflex_langgraph-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for reflex-langgraph 0.1.0
File Interpreter ABI Platform Actions
reflex_langgraph-0.1.0-py3-none-any.whl Python 3 none any Details for reflex_langgraph-0.1.0-py3-none-any.whl

Total release size: 227.1 kB

Release files / reflex_langgraph-0.1.0.tar.gz

Download URL reflex_langgraph-0.1.0.tar.gz
Size 107.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fdc2f842c93d693c9c2b141d57be84e2c7c1025baf5264394e50d6ec44a431ea
BLAKE2b-256 checksum
How to use checksums
3ce72c1f2b049a07f8e16c9f94ee135f0cef94d508dfe4171f0aed0cfe5b8892
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / reflex_langgraph-0.1.0-py3-none-any.whl

Download URL reflex_langgraph-0.1.0-py3-none-any.whl
Size 119.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc0d8c62901f6dc900b33b81316f54e571ebaf6bab88b225948d37a0de814a3f
BLAKE2b-256 checksum
How to use checksums
749bb2b94ff7e36d358b0d0e69a45b80d7e11a10fdc082770c5e88bd00b7b3fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for reflex-langgraph 0.1.0

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