Local Development
Run agents locally, tunnel webhooks, and debug stuck jobs.
Run and debug AI features on your machine, including webhook delivery and stuck async jobs.
Setup steps
- Copy env from
.env.example; setLANG_GRAPH_URLto the Alpha deployment. - Start the API (
bun run devor project equivalent). - Expose webhooks:
ngrok http <port>and setWEBHOOK_PUBLIC_BASE_URLto the tunnel URL. - Trigger a run; confirm webhook logs and DB rows update.
- If the UI stays on
processing: hit the read endpoint to trigger reconciliation, or inspect thread state via the LangGraph SDK.
Environment variables: Environment variables.
Common local pitfalls
| Symptom | Likely cause | Fix |
|---|---|---|
Job forever processing | Webhook URL not reachable | Use ngrok; set WEBHOOK_PUBLIC_BASE_URL |
| Empty assistant text after run | values shape changed | Update webhook parser; log valueKeys |
LANG_GRAPH_URL is not set | Missing env in load path | Check .env and env.ts |
| Thread 404 on reuse | Thread from a different deployment | Recreate thread or use ensureSpecificThread |
Stale-run reconciliation
If a webhook never arrives, the read path should recover:
const run = await client.runs.get(threadId, runId);
if (runIsTerminal(run.status)) {
const state = await client.threads.getState(threadId);
const output = state.values?.expected_output_key;
// persist output and update status
}Full pattern: Webhooks & reconciliation.
Debugging checklist
-
WEBHOOK_PUBLIC_BASE_URLmatches the ngrok or staging URL LangGraph can POST to - Webhook route is mounted at the path passed to
runs.create -
thread_idandrun_idin logs match MongoDB rows - LangGraph run status in Platform UI or via
client.runs.get - Trace visible in LangSmith when
LANGSMITH_PROJECTis set