UXDL Docs

Folder Layout & Setup

In-process agent structure, barrels, and key dependencies.

In-process LangGraph.js agents live inside the API repo. Use when the pipeline is small, owned by one service, and does not need a separate LangGraph Platform deploy.

Folder layout

plaintext
src/agents/
├── index.ts          ← barrel: newThreadId(), threadConfig()
├── chat/             ← ReAct agent (createReactAgent)
│   ├── index.ts
│   ├── prompt.ts
│   └── tools.ts
└── pipeline/         ← StateGraph (batch or structured generation)
    ├── graph.ts
    ├── nodes.ts
    ├── prompts.ts
    ├── state.ts
    └── types.ts

Each agent folder exposes a public barrel (index.ts). External code imports from the barrel only.

Adding a new agent:

  1. Create src/agents/<name>/ with index.ts, prompt.ts, tools.ts (and graph.ts / state.ts for StateGraph).
  2. Export from src/agents/index.ts.
  3. Wire src/services/<name>.service.ts, controller, and routes.
  4. Follow Delivery standards.

Key dependencies

json
{
  "@langchain/core": "LangChain abstractions",
  "@langchain/openai": "ChatOpenAI, OpenAI bindings",
  "@langchain/langgraph": "StateGraph, prebuilt ReAct agent",
  "@langchain/community": "Optional tools (Tavily, etc.)"
}

For hosted graphs, use @langchain/langgraph-sdk instead. See Integration flow.

See also

Official documentation