A FastAPI LangGraph-compatible server backed by GaussDB.
Project description
LangGraph GaussDB FastAPI
A FastAPI server that implements key LangGraph Platform-compatible endpoints with async GaussDB persistence.
Install
python -m pip install langgraph-gaussdb-fastapi
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 -> synthesisrouter_specialist: request classification into research, implementation, review, or general specialistevaluator_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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langgraph_gaussdb_fastapi-0.3.0.tar.gz.
File metadata
- Download URL: langgraph_gaussdb_fastapi-0.3.0.tar.gz
- Upload date:
- Size: 118.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20aed0e946c1ece65a4a3d4323fabfd6933fa862fe7b045a189a1d91c11a1670
|
|
| MD5 |
f54a88cc77ac7aa6d57f12aff7e610fe
|
|
| BLAKE2b-256 |
6c9a855c7afb330baf7b928b28e87284580268e20625ac67084f0cad6f88d7ce
|
File details
Details for the file langgraph_gaussdb_fastapi-0.3.0-py3-none-any.whl.
File metadata
- Download URL: langgraph_gaussdb_fastapi-0.3.0-py3-none-any.whl
- Upload date:
- Size: 148.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a10bba5909802f84029a1696208c0519f50a4e49f0275061eab542ba9fef8262
|
|
| MD5 |
890f201d69726e465c0faa8ba8b92b42
|
|
| BLAKE2b-256 |
43bdc61bb05ed5843d588ed3843ecdd1a645988b8523fc7080737cfb9332257f
|