AI Overview
The two integration patterns, when to use each, and the documentation flow.
UXDL AI features use one of two integration patterns: hosted LangGraph graphs (deployed on LangGraph Platform) or in-process LangGraph.js agents (graphs colocated with the API). Product backends do not call LLM providers from route handlers. They go through services, persist durable state in the database, and emit traces and logs through the shared observability stack.
Two patterns in the UXDL stack
| Pattern | Where logic lives | How the API invokes it | Best for |
|---|---|---|---|
| Hosted LangGraph | LangGraph Platform deployment (Python or TS graph repo) | @langchain/langgraph-sdk: threads.create, runs.create, webhooks | Multi-route agents, long runs, RAG, tool orchestration, shared across products |
| In-process LangGraph.js | src/agents/<name>/ inside the API repo | graph.invoke() or agent.stream() in a service | Focused pipelines, fast iteration, no separate deploy |
Both patterns share the same product API contract: thin controllers, fat services, durable persistence (typically MongoDB), structured logging plus OpenTelemetry spans, and Bruno tests for HTTP surfaces.
How the hosted pattern works
- The client calls the product API (e.g.
POSTto start a chat or async job). - The API creates a LangGraph thread and run via the SDK, saves a
processingrow in the database, and returns (or the client polls). - LangGraph Platform runs the deployed graph. When the run finishes, it POSTs to your webhook.
- The webhook handler parses the result, writes output to the database, updates status, and may emit a socket event or record usage.
- The client gets the result via poll, socket, or a later
GET. SSE can stream in-process agents; hosted jobs usually complete via webhook + poll/socket.
Details: Integration flow and Webhooks & reconciliation.
When to use which
| Use hosted LangGraph when… | Use in-process LangGraph.js when… |
|---|---|
| The agent has multiple routes or tools | The graph is small and owned by one service |
| Runs are long (generation, research, batch) | You need sub-second invoke with no webhook |
| Multiple products share one agent deployment | You are prototyping or the graph rarely changes |
| You want LangSmith tracing on the graph host | The team does not want a separate graph deploy |
Documentation flow
Path 1 — New async feature (hosted graph)
- AI Overview (this page).
- Integration flow.
- Webhooks & reconciliation.
- Environment variables.
- Delivery standards.
- Local development.
Path 2 — Small in-repo agent (Node)
- AI Overview (this page).
- Folder layout & setup.
- Agents & pipelines.
- Streaming & realtime if user-facing chat.
- Delivery standards.
Path 3 — Search / recommendations (embeddings only)
- AI Overview (this page).
- Embedding models.
- Vector search.
- Persist vectors in Backend → MongoDB.
See also
- Backend Overview
- Observability Overview
- Integrations Overview (OpenAI, Azure, LangSmith setup)