or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cli-commands.mdconfiguration.mddocker-integration.mdindex.mdtemplates.md

templates.mddocs/

0

# Templates

1

2

Project scaffolding system for LangGraph applications. Provides multiple pre-built templates covering common LangGraph patterns and use cases, enabling rapid project initialization with best practices.

3

4

## Capabilities

5

6

### Project Creation

7

8

Create new LangGraph projects from predefined templates with proper structure and configuration.

9

10

```python { .api }

11

def create_new(path: Optional[str], template: Optional[str]) -> None

12

```

13

14

**Purpose**: Create a new LangGraph project from a template

15

**Parameters**:

16

- `path` (Optional[str]): Directory path for the new project (current directory if None)

17

- `template` (Optional[str]): Template identifier (interactive selection if None)

18

**Returns**: None (creates files and directories)

19

**Raises**: TemplateError for invalid templates, FileExistsError for existing directories

20

21

**Usage Examples:**

22

23

```python

24

from langgraph_cli.templates import create_new

25

26

# Interactive template selection in current directory

27

create_new(None, None)

28

29

# Create project with specific template

30

create_new("my-agent-app", "react-agent-python")

31

32

# Create in custom directory with interactive selection

33

create_new("./projects/new-bot", None)

34

```

35

36

## Available Templates

37

38

### New LangGraph Project

39

40

**Template ID**: `new-langgraph-project`

41

**Description**: Minimal chatbot with memory

42

**Use Case**: Basic conversational AI applications with persistent memory

43

44

**Features**:

45

- Simple chat interface with conversation memory

46

- Basic message handling and response generation

47

- Configuration for common LLM providers

48

- Development server setup

49

- Basic testing structure

50

51

**Generated Structure**:

52

```

53

my-project/

54

├── langgraph.json # LangGraph configuration

55

├── pyproject.toml # Python project configuration

56

├── .env.example # Environment variables template

57

├── src/

58

│ ├── __init__.py

59

│ ├── graph.py # Main conversation graph

60

│ └── nodes/ # Graph node implementations

61

│ ├── __init__.py

62

│ └── chat.py

63

├── tests/

64

│ ├── __init__.py

65

│ └── test_graph.py

66

└── README.md

67

```

68

69

### ReAct Agent

70

71

**Template ID**: `react-agent-python`

72

**Description**: Extensible agent with tools

73

**Use Case**: Reasoning and acting agents that can use external tools

74

75

**Features**:

76

- ReAct (Reasoning + Acting) pattern implementation

77

- Tool integration framework

78

- Extensible tool registry

79

- Error handling and retry logic

80

- Comprehensive logging and observability

81

82

**Generated Structure**:

83

```

84

react-agent/

85

├── langgraph.json

86

├── pyproject.toml

87

├── .env.example

88

├── src/

89

│ ├── __init__.py

90

│ ├── agent.py # Main ReAct agent

91

│ ├── tools/ # Tool implementations

92

│ │ ├── __init__.py

93

│ │ ├── base.py # Base tool interface

94

│ │ ├── web_search.py # Web search tool

95

│ │ └── calculator.py # Math operations

96

│ └── prompts/

97

│ ├── __init__.py

98

│ └── react.py # ReAct prompting logic

99

├── tests/

100

│ ├── __init__.py

101

│ ├── test_agent.py

102

│ └── test_tools.py

103

└── README.md

104

```

105

106

### Memory Agent

107

108

**Template ID**: `memory-agent-python`

109

**Description**: ReAct agent with cross-conversation memory

110

**Use Case**: Agents that remember information across multiple conversations

111

112

**Features**:

113

- ReAct pattern with persistent memory

114

- Long-term memory storage and retrieval

115

- Context management across sessions

116

- Memory indexing and search

117

- Conversation history management

118

119

**Generated Structure**:

120

```

121

memory-agent/

122

├── langgraph.json

123

├── pyproject.toml

124

├── .env.example

125

├── src/

126

│ ├── __init__.py

127

│ ├── agent.py # Memory-enabled ReAct agent

128

│ ├── memory/ # Memory management

129

│ │ ├── __init__.py

130

│ │ ├── store.py # Memory storage interface

131

│ │ └── retrieval.py # Memory retrieval logic

132

│ ├── tools/ # Agent tools

133

│ │ ├── __init__.py

134

│ │ └── base.py

135

│ └── prompts/

136

│ ├── __init__.py

137

│ └── memory.py # Memory-aware prompts

138

├── tests/

139

│ ├── __init__.py

140

│ ├── test_agent.py

141

│ └── test_memory.py

142

└── README.md

143

```

144

145

### Retrieval Agent

146

147

**Template ID**: `retrieval-agent-python`

148

**Description**: Agent with RAG (Retrieval-Augmented Generation) capabilities

149

**Use Case**: Agents that can search and reference external knowledge bases

150

151

**Features**:

152

- RAG implementation with vector search

153

- Document ingestion and indexing

154

- Semantic search and retrieval

155

- Context-aware response generation

156

- Support for multiple document formats

157

158

**Generated Structure**:

159

```

160

retrieval-agent/

161

├── langgraph.json

162

├── pyproject.toml

163

├── .env.example

164

├── src/

165

│ ├── __init__.py

166

│ ├── agent.py # RAG-enabled agent

167

│ ├── retrieval/ # RAG implementation

168

│ │ ├── __init__.py

169

│ │ ├── embeddings.py # Embedding generation

170

│ │ ├── vectorstore.py # Vector storage

171

│ │ └── retriever.py # Search and retrieval

172

│ ├── ingestion/ # Document processing

173

│ │ ├── __init__.py

174

│ │ ├── loader.py # Document loaders

175

│ │ └── processor.py # Text processing

176

│ └── prompts/

177

│ ├── __init__.py

178

│ └── rag.py # RAG-specific prompts

179

├── data/ # Sample documents

180

│ └── sample.txt

181

├── tests/

182

│ ├── __init__.py

183

│ ├── test_agent.py

184

│ ├── test_retrieval.py

185

│ └── test_ingestion.py

186

└── README.md

187

```

188

189

### Data-Enrichment Agent

190

191

**Template ID**: `data-enrichment-python`

192

**Description**: Web search and data organization agent

193

**Use Case**: Agents that gather, process, and organize information from web sources

194

195

**Features**:

196

- Web search integration

197

- Data extraction and cleaning

198

- Information organization and categorization

199

- Multi-source data aggregation

200

- Structured output generation

201

202

**Generated Structure**:

203

```

204

data-enrichment/

205

├── langgraph.json

206

├── pyproject.toml

207

├── .env.example

208

├── src/

209

│ ├── __init__.py

210

│ ├── agent.py # Data enrichment agent

211

│ ├── search/ # Web search capabilities

212

│ │ ├── __init__.py

213

│ │ ├── web_search.py # Search implementation

214

│ │ └── extractors.py # Data extraction

215

│ ├── processing/ # Data processing

216

│ │ ├── __init__.py

217

│ │ ├── cleaner.py # Data cleaning

218

│ │ └── organizer.py # Information organization

219

│ ├── output/ # Output formatting

220

│ │ ├── __init__.py

221

│ │ └── formatters.py # Structured output

222

│ └── prompts/

223

│ ├── __init__.py

224

│ └── enrichment.py # Data enrichment prompts

225

├── tests/

226

│ ├── __init__.py

227

│ ├── test_agent.py

228

│ ├── test_search.py

229

│ └── test_processing.py

230

└── README.md

231

```

232

233

## Template Selection

234

235

### Interactive Selection

236

237

When no template is specified, the CLI provides an interactive selection interface:

238

239

```bash

240

$ langgraph new my-project

241

242

? Select a template:

243

❯ New LangGraph Project - Minimal chatbot with memory

244

ReAct Agent - Extensible agent with tools

245

Memory Agent - ReAct agent with cross-conversation memory

246

Retrieval Agent - Agent with RAG capabilities

247

Data-enrichment Agent - Web search and data organization

248

```

249

250

### Direct Template Usage

251

252

Templates can be specified directly:

253

254

```bash

255

# Create ReAct agent

256

langgraph new react-bot --template react-agent-python

257

258

# Create retrieval agent in specific directory

259

langgraph new ./agents/rag-bot --template retrieval-agent-python

260

```

261

262

## Template Configuration

263

264

The template system uses several constants for management:

265

266

```python { .api }

267

# Template definitions with URLs for Python and JavaScript versions

268

TEMPLATES: dict[str, dict[str, str]] = {

269

"New LangGraph Project": {

270

"description": "A simple, minimal chatbot with memory.",

271

"python": "https://github.com/langchain-ai/new-langgraph-project/archive/refs/heads/main.zip",

272

"js": "https://github.com/langchain-ai/new-langgraphjs-project/archive/refs/heads/main.zip",

273

},

274

"ReAct Agent": {

275

"description": "A simple agent that can be flexibly extended to many tools.",

276

"python": "https://github.com/langchain-ai/react-agent/archive/refs/heads/main.zip",

277

"js": "https://github.com/langchain-ai/react-agent-js/archive/refs/heads/main.zip",

278

},

279

# Additional templates...

280

}

281

282

# Template identifier mapping for CLI usage

283

TEMPLATE_ID_TO_CONFIG: dict[str, tuple[str, str, str]]

284

TEMPLATE_IDS: list[str]

285

286

# Help string for CLI template selection

287

TEMPLATE_HELP_STRING: str

288

```

289

290

## Template Help

291

292

The CLI provides detailed template information:

293

294

```python

295

# Template help string with descriptions

296

TEMPLATE_HELP_STRING = """

297

Available templates:

298

299

new-langgraph-project Minimal chatbot with memory

300

react-agent-python Extensible agent with tools

301

memory-agent-python ReAct agent with cross-conversation memory

302

retrieval-agent-python Agent with RAG capabilities

303

data-enrichment-python Web search and data organization

304

305

Use 'langgraph new --template TEMPLATE_NAME' to create a project.

306

"""

307

```

308

309

## Template Components

310

311

Each template includes:

312

313

### Core Files

314

315

- **langgraph.json**: LangGraph configuration with appropriate dependencies

316

- **pyproject.toml**: Python project configuration with required packages

317

- **.env.example**: Environment variables template with provider APIs

318

- **README.md**: Template-specific setup and usage instructions

319

320

### Source Code Structure

321

322

- **Main agent/graph file**: Core application logic

323

- **Node implementations**: Modular graph node functions

324

- **Tool implementations**: External tool integrations

325

- **Prompt templates**: LLM prompt engineering

326

- **Configuration modules**: Settings and configuration management

327

328

### Testing Framework

329

330

- **Unit tests**: Component-level testing

331

- **Integration tests**: End-to-end workflow testing

332

- **Test fixtures**: Sample data and mock objects

333

- **Test configuration**: Testing-specific settings

334

335

### Documentation

336

337

- **README**: Quick start and overview

338

- **Code comments**: Inline documentation

339

- **Configuration examples**: Sample configurations

340

- **Deployment guides**: Production deployment instructions

341

342

## Customization

343

344

Templates serve as starting points and can be customized:

345

346

### Configuration Customization

347

348

Modify `langgraph.json` for:

349

- Different Python versions

350

- Additional dependencies

351

- Custom environment variables

352

- Production deployment settings

353

354

### Code Customization

355

356

Templates provide extensible architectures:

357

- Add new tools to ReAct agents

358

- Implement custom memory backends

359

- Add document loaders to retrieval agents

360

- Extend data processing pipelines

361

362

### Deployment Customization

363

364

Each template includes deployment options:

365

- Docker configuration

366

- Environment-specific settings

367

- CI/CD pipeline examples

368

- Monitoring and logging setup

369

370

## Best Practices

371

372

Templates follow LangGraph best practices:

373

374

### Code Organization

375

376

- Clear separation of concerns

377

- Modular node implementations

378

- Reusable components

379

- Consistent naming conventions

380

381

### Configuration Management

382

383

- Environment-based configuration

384

- Secure secret handling

385

- Flexible deployment options

386

- Development/production separation

387

388

### Testing Strategy

389

390

- Comprehensive test coverage

391

- Mock external dependencies

392

- Integration test patterns

393

- Performance testing examples

394

395

### Error Handling

396

397

- Graceful failure handling

398

- Informative error messages

399

- Recovery mechanisms

400

- Logging and observability