create-langgraph
v1.1.5
Published
Create a new LangGraph project
Readme
create-langgraph
The official scaffolding tool for LangGraph.js projects. Quickly bootstrap new LangGraph applications from curated templates or generate configuration files for existing projects.
Quick Start
Create a new LangGraph project with a single command:
# Using npm
npm init langgraph@latest
# Using yarn
yarn create langgraph
# Using pnpm
pnpm create langgraph
# Using pnpm
pnpm create langgraph
# Using bun
bunx create-langgraphFollow the interactive prompts to select a template and configure your project.
Templates
Choose from a variety of production-ready templates:
| Template | Description | | ------------------------------------------------------------------------------------ | --------------------------------------------------------------- | | New LangGraph Project | A simple, minimal chatbot with memory | | ReAct Agent | A flexible agent that can be extended with many tools | | Memory Agent | A ReAct-style agent with persistent memory across conversations | | Retrieval Agent | An agent with retrieval-based question-answering | | Data-enrichment Agent | An agent that performs web searches and organizes findings |
Using a Specific Template
Skip the interactive prompt by specifying a template directly:
npx create-langgraph@latest my-project --template react-agent-jsAvailable template IDs:
new-langgraph-project-jsreact-agent-jsmemory-agent-jsretrieval-agent-jsdata-enrichment-js
Commands
create-langgraph [path]
Creates a new LangGraph project at the specified path.
npx create-langgraph@latest my-awesome-agentOptions:
-t, --template <template>— Use a specific template (skips interactive selection)
What it does:
- Downloads the selected template from GitHub
- Extracts it to your target directory
- Optionally initializes a Git repository
- Provides next steps for getting started
create-langgraph config [path]
Scans your project for LangGraph agents and generates a langgraph.json configuration file.
# In your project directory
npx create-langgraph@latest config
# Or specify a path
npx create-langgraph@latest config ./my-projectThis command is useful when:
- You have an existing project and want to add LangGraph Platform support
- You've added new agents and need to update your configuration
- You want to automatically detect all agents in your codebase
Agent Detection
The config command automatically detects LangGraph agents defined using these patterns:
ESM (ES Modules)
// Using createAgent
export const agent = createAgent({ model, tools });
// Using StateGraph
export const graph = new StateGraph(annotation).compile();
// Using workflow builder pattern
export const app = workflow.compile();CommonJS
// Using module.exports
module.exports.agent = createAgent({ model, tools });
module.exports.graph = workflow.compile();
// Using exports shorthand
exports.myAgent = createAgent({ model, tools });What Gets Detected
The scanner looks for:
createAgent()function callsnew StateGraph(...).compile()patternsworkflow.compile()orbuilder.compile()patterns
Important: Only exported agents are included in the generated configuration. Unexported agents will be listed as warnings so you can add the export keyword if needed.
Generated Configuration
The config command generates a langgraph.json file like this:
{
"node_version": "20",
"graphs": {
"agent": "./src/agent.ts:agent",
"searchAgent": "./src/search.ts:searchAgent"
},
"env": ".env"
}The configuration includes:
- node_version — Detected from your current Node.js version
- graphs — Map of agent names to their file paths and export names
- env — Path to
.envfile (if one exists)
Project Structure
After scaffolding, your project will have this structure:
my-project/
├── src/
│ └── agent.ts # Your LangGraph agent
├── langgraph.json # LangGraph configuration
├── package.json
├── tsconfig.json
└── .env.example # Environment variables templateNext Steps After Creating a Project
# Navigate to your project
cd my-project
# Install dependencies
npm install # or yarn, pnpm, bun
# Start the LangGraph development server
npx @langchain/langgraph-cli@latest devThe development server provides:
- A local API server for your agents
- Hot reloading during development
- Built-in debugging tools
Analytics
This CLI collects anonymous usage analytics to help improve the tool. The following information is collected:
- Operating system and version
- Node.js version
- CLI version
- Command executed
No personal information, project details, or code is ever collected.
To opt out of analytics, set the environment variable:
export LANGGRAPH_CLI_NO_ANALYTICS=1Requirements
- Node.js 18 or later
- npm, yarn, pnpm, or bun
Related Packages
- @langchain/langgraph — The core LangGraph library
- @langchain/langgraph-cli — CLI tools for running LangGraph projects
License
MIT © LangChain
