LangGraph apps
Stillbox runs your LangGraph graph inside your own small web app. It doesn’t run LangChain’s own server (the “Agent
Server” behind langgraph dev and langgraph up); a project with only langgraph.json needs the few lines below.
Your graph’s state between runs (its checkpoints) goes in a Postgres database you own, through LangGraph’s MIT-licensed Postgres checkpointer. The sandbox can sleep between requests without losing a conversation.
The app
Section titled “The app”requirements.txt:
fastapiuvicorn[standard]langgraphlanggraph-checkpoint-postgrespsycopg[binary,pool]main.py:
import osfrom contextlib import asynccontextmanager
from fastapi import FastAPIfrom langgraph.checkpoint.postgres.aio import AsyncPostgresSaver
from agent import builder # your StateGraph, not yet compiled
@asynccontextmanagerasync def lifespan(app: FastAPI): async with AsyncPostgresSaver.from_conn_string(os.environ["DATABASE_URL"]) as saver: await saver.setup() # creates the checkpoint tables the first time app.state.graph = builder.compile(checkpointer=saver) yield
app = FastAPI(lifespan=lifespan)
@app.get("/health")async def health(): return {"ok": True}
@app.post("/threads/{thread_id}/runs")async def run(thread_id: str, payload: dict): config = {"configurable": {"thread_id": thread_id}} return await app.state.graph.ainvoke(payload, config)Deploy it
Section titled “Deploy it”Put DATABASE_URL in an environment as a secret delivered inside the sandbox (your
organization must allow secrets inside sandboxes), with the repository, then:
stillbox deploy --environment <environment id> --health /healthStillbox sees FastAPI and starts uvicorn main:app. Each POST /threads/<id>/runs continues that thread.
Model calls go through your sandbox’s model settings, as agents’ do: the base address and placeholder key are in
the app’s environment variables. Add an approval step with harnessd approval "what you're about to do" from a tool, and the run waits for a person’s yes.