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.path — PYTHONPATH 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

Metadata

Release files for langgraph-gaussdb-fastapi 0.4.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 langgraph-gaussdb-fastapi 0.4.0
File Size Uploaded Provenance Actions
langgraph_gaussdb_fastapi-0.4.0.tar.gz 320.2 kB Without provenance Details for langgraph_gaussdb_fastapi-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langgraph-gaussdb-fastapi 0.4.0
File Interpreter ABI Platform Actions
langgraph_gaussdb_fastapi-0.4.0-py3-none-any.whl Python 3 none any Details for langgraph_gaussdb_fastapi-0.4.0-py3-none-any.whl

Total release size: 685.9 kB

Release files / langgraph_gaussdb_fastapi-0.4.0.tar.gz

Download URL langgraph_gaussdb_fastapi-0.4.0.tar.gz
Size 320.2 kB
Tags Source
SHA-256 checksum
How to use checksums
67fe0a431a95516044ffb7ce5ab5039cf0564927c83172f1d6e8d5f9da0de38e
BLAKE2b-256 checksum
How to use checksums
d994a9a5d6ce247c28f5dec2b46b8b067d2a6f60e7d83d92d426eadf98c17121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / langgraph_gaussdb_fastapi-0.4.0-py3-none-any.whl

Download URL langgraph_gaussdb_fastapi-0.4.0-py3-none-any.whl
Size 365.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
978d6a8875c1ca051f40e331fe5a3f722fe47119bdcc84b54fd83e76b0e8968d
BLAKE2b-256 checksum
How to use checksums
9bc265bf18b54bad4299d6d672c54065f263435a80e05fe6d736c4a032ae4e74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for langgraph-gaussdb-fastapi 0.4.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.

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