Skip to content

langchain-ai/js-langgraph-monorepo-example

LangGraph.js Monorepo Example

This repository provides a sample of deploying LangGraph agents inside a monorepo structure, demonstrating how agents can access and utilize shared workspace packages. This approach enables code reuse and consistent dependencies across multiple agents while maintaining a clean monorepo architecture.

Structure

isaac-js-graph/
├── libs/
│   └── shared/                 # Shared package with utilities
│       ├── package.json
│       ├── tsconfig.json
│       └── src/
│           ├── index.ts        # Exported utilities
│           └── index.js
├── apps/
│   ├── agent1/
│   │   ├── langgraph.json      # LangGraph configuration
│   │   ├── package.json
│   │   ├── tsconfig.json
│   │   └── src/
│   │       ├── graph.ts        # LangGraph implementation
│   │       └── state.ts        # State definitions
│   └── agent2/
│       ├── langgraph.json      # LangGraph configuration
│       ├── package.json
│       ├── tsconfig.json
│       └── src/
│           ├── graph.ts        # LangGraph implementation
│           └── state.ts        # State definitions
├── package.json                # Root workspace configuration
├── turbo.json                  # Turborepo configuration
├── tsconfig.json               # Root TypeScript config
└── yarn.lock

Features

  • Multiple agents deployed within a single monorepo
  • Shared workspace packages accessible by all agents
  • Consistent dependency management across agents

Usage

Each agent can be run independently using the LangGraph CLI, and both will have access to the shared utility functions via the dependency configuration. For monorepo support, you can run your build command from the root, getting the benefits of the shared dependencies.

Agent 1

langgraph build -t js-monorepo-agent-1 --build-command "yarn run turbo build" -c apps/agent1/langgraph.json

Agent 2

langgraph build -t js-monorepo-agent-2 --build-command "yarn run turbo build" -c apps/agent2/langgraph.json

About

Example JS monorepo for deploying to LangGraph Platform

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors