Skip to main content

LangGraph GaussDB FastAPI

A FastAPI server that implements key LangGraph Platform-compatible endpoints with async GaussDB persistence.

Install

The bundled y_agent graph requires the internal, workspace-confinement build of y-agent and the system bwrap executable. The y-agent SDK is carried in-tree as plain source at agent/y_agent/ — nothing to install, and edits to it take effect on the next server restart.

python -m pip install -e .    # server + y-agent's runtime deps
bwrap --version               # required; startup fails closed without it

import y_agent resolves because agent/ is placed on sys.pathPYTHONPATH in run-server.sh for the server, pythonpath = ["agent"] for pytest. y-agent's own runtime requirements are declared in this project's pyproject.toml (the y-agent's runtime closure block), since no package metadata does it any more. See AGENTS.md for how to run y-agent's test suite against this source, and run ~/claude/y-agent/scripts/preflight_bubblewrap.py on the target host before deploying — bwrap --version alone does not prove confinement will work.

run-server.sh refuses to boot unless the imported y_agent is the in-tree source at the expected version, so a stale y-agent package in site-packages cannot silently shadow it. If it ever does: pip uninstall -y y-agent.

The y-agent graph uses /usr/bin/bwrap (or /usr/local/bin/bwrap) by default. Set Y_AGENT_BWRAP only when Bubblewrap is installed at another trusted absolute system path. If Bubblewrap is unavailable, startup fails closed.

To run the packaged Chainlit prototype too:

python -m pip install "langgraph-gaussdb-fastapi[chainlit]"

Run

Set the database connection in a mode settings file or with environment variables, then start the server:

LG_MODE=dev \
LG_SETTINGS_FILE=settings/secrets.env \
langgraph-gaussdb-fastapi

Configuration is loaded from settings/base.env, then settings/{LG_MODE}.env; LG_MODE defaults to dev. If LG_SETTINGS_FILE is set, that file is loaded after the mode file. Real process environment variables always win, so existing deployment env vars continue to work. When no working-directory settings/ directory exists, packaged defaults are used.

The default graph config now comes from the packaged server_config.json. You can still override it with LG_GRAPH_CONFIG.

{
  "dependencies": [],
  "graphs": {
    "echo": "graph.example_graph:graph",
    "qwen_tools": "graph.qwen_tools_graph:graph",
    "orchestrator_worker": "graph.workflow_graphs:orchestrator_worker_graph",
    "router_specialist": "graph.workflow_graphs:router_specialist_graph",
    "evaluator_optimizer": "graph.workflow_graphs:evaluator_optimizer_graph"
  }
}

Additional packaged workflow graphs:

  • orchestrator_worker: planner -> worker fan-out -> synthesis
  • router_specialist: request classification into research, implementation, review, or general specialist
  • evaluator_optimizer: draft -> critique -> revise loop with a bounded retry budget

Health checks are available at / and /ok.

Chainlit

The distribution includes a packaged Chainlit UI that can be mounted onto the same FastAPI app as a sub-application. This is the recommended way to run the UI: a single process, no extra ports, no cross-origin hops.

Install the optional extra:

python -m pip install "langgraph-gaussdb-fastapi[chainlit]"

Start the server with LG_ENABLE_CHAINLIT=1 in the selected settings file or in the process environment:

LG_ENABLE_CHAINLIT=1 \
CHAINLIT_AUTH_SECRET=change-me \
langgraph-gaussdb-fastapi

The Chainlit UI is served at /chainlit (override with LG_CHAINLIT_PATH). In mounted mode the Chainlit backend talks to the LangGraph API in-process via httpx.ASGITransport, so LANGGRAPH_SERVER_URL does not need to be set. Chainlit's FastAPI integration docs recommend header auth for this setup: https://docs.chainlit.io/integrations/fastapi

If LG_ENABLE_CHAINLIT is unset or the chainlit extra is not installed, the helper is a silent no-op and the API server continues normally. If LG_ENABLE_CHAINLIT=1 but CHAINLIT_AUTH_SECRET is missing, the API server still starts but the UI is not mounted.

Settings files and environment variables

The repository includes these mode files:

File Purpose
settings/base.env Shared defaults
settings/dev.env Development overrides
settings/test.env Test overrides
settings/prod.env Production overrides

Use LG_SETTINGS_DIR=/path/to/settings to read mode files from another directory. Use LG_SETTINGS_FILE=/path/to/secrets.env for a local override file; settings/*.local.env and settings/secrets.env are ignored by git.

Supported settings-file syntax is KEY=value, optional export KEY=value, shell-style quoting, blank lines, and comments.

Variable Default Purpose
LG_MODE dev Selects settings/{mode}.env
LG_SETTINGS_DIR settings Directory containing base.env and mode files
LG_SETTINGS_FILE (unset) Optional local override file loaded after the mode file
LG_ENABLE_CHAINLIT false Opt-in switch for the mounted UI
LG_CHAINLIT_PATH /chainlit Mount path under the FastAPI app
CHAINLIT_AUTH_SECRET required when mounted Signing key for Chainlit sessions
LANGGRAPH_ASSISTANT_ID echo Default assistant/graph selected in the UI
LANGGRAPH_SERVER_URL (unset) Only used by the legacy standalone launcher or to point at a remote server

Legacy standalone launcher (deprecated)

The previous langgraph-gaussdb-chainlit launcher is still shipped for backwards compatibility but is deprecated in favor of the mounted flow:

LANGGRAPH_SERVER_URL=http://127.0.0.1:2026 \
langgraph-gaussdb-chainlit --headless --host 0.0.0.0 --port 8010

Integration tests

Run the opt-in integration suite against a live GaussDB-backed environment. The fixtures now boot a single FastAPI process with Chainlit mounted:

RUN_LANGGRAPH_CHAINLIT_INTEGRATION=1 pytest -m integration

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langgraph_gaussdb_fastapi-0.4.0.tar.gz (320.2 kB view details)

Uploaded Source

Built Distribution

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

langgraph_gaussdb_fastapi-0.4.0-py3-none-any.whl (365.7 kB view details)

Uploaded Python 3

File details

Details for the file langgraph_gaussdb_fastapi-0.4.0.tar.gz.

File metadata

File hashes

Hashes for langgraph_gaussdb_fastapi-0.4.0.tar.gz
Algorithm Hash digest
SHA256 67fe0a431a95516044ffb7ce5ab5039cf0564927c83172f1d6e8d5f9da0de38e
MD5 14c4f238ab2040ca56fa7ad10b1d990f
BLAKE2b-256 d994a9a5d6ce247c28f5dec2b46b8b067d2a6f60e7d83d92d426eadf98c17121

See more details on using hashes here.

File details

Details for the file langgraph_gaussdb_fastapi-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langgraph_gaussdb_fastapi-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 978d6a8875c1ca051f40e331fe5a3f722fe47119bdcc84b54fd83e76b0e8968d
MD5 3b5f9ac00d8aad6a31d3a6a84e759515
BLAKE2b-256 9bc265bf18b54bad4299d6d672c54065f263435a80e05fe6d736c4a032ae4e74

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

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