Key characteristics
- Complete control over graph structure
- Mix deterministic logic with agentic behavior
- Support for sequential steps, conditional branches, loops, and parallel execution
- Embed other patterns as nodes in your workflow
When to use
Use custom workflows when standard patterns (subagents, skills, etc.) don’t fit your requirements, you need to mix deterministic logic with agentic behavior, or your use case requires complex routing or multi-stage processing. Each node in your workflow can be a simple function, an LLM call, or an entire agent with tools. You can also compose other architectures within a custom workflow—for example, embedding a multi-agent system as a single node. For a complete example of a custom workflow, see the tutorial below.Tutorial: Build a multi-source knowledge base with routing
The router pattern is an example of a custom workflow. This tutorial walks through building a router that queries GitHub, Notion, and Slack in parallel, then synthesizes results.
Basic implementation
The core insight is that you can call a LangChain agent directly inside any LangGraph node, combining the flexibility of custom workflows with the convenience of pre-built agents:Example: RAG pipeline
A common use case is combining retrieval with an agent. This example builds a WNBA stats assistant that retrieves from a knowledge base and can fetch live news.Custom RAG workflow
Custom RAG workflow
The workflow demonstrates three types of nodes:
- Model node (Rewrite): Rewrites the user query for better retrieval using structured output.
- Deterministic node (Retrieve): Performs vector similarity search — no LLM involved.
- Agent node (Agent): Reasons over retrieved context and can fetch additional information via tools.