Repository Structure
The monorepo is organized into two main directories:Applications (apps/
)
apps/open-swe
- LangGraph Agent Application
- Contains the core LangGraph agent implementation with TypeScript
- Includes three specialized graphs: manager, planner, and programmer
- Handles GitHub webhook integration and LLM interactions
apps/web
- Next.js Web Interface
- React frontend with Next.js framework
- Uses Shadcn UI components (Radix UI) with Tailwind CSS
- Provides the user interface for interacting with the LangGraph agent
- Includes authentication and proxy routes for secure communication
apps/docs
- Mintlify Documentation
- Contains this documentation site built with Mintlify
- Provides comprehensive setup and usage guides
- Includes API documentation and development resources
Packages (packages/
)
packages/shared
- Common Utilities Package
- Centralized location for shared types, constants, and utilities
- Used by both the agent and web applications
- Exports modules via
@openswe/shared
namespace - Contains crypto utilities, GraphState types, and Open SWE specific modules
The shared package must be built before other packages can import from it. Any
code used by both the agent and web app should be placed here to avoid
duplication.
Turbo Orchestration
The monorepo uses Turbo for efficient build orchestration and task management:Task Dependencies
^build
dependency ensures that shared packages are built before dependent packages, maintaining proper build order across the monorepo.
Available Scripts
Run these commands from the repository root:yarn build
- Build all packages in dependency orderyarn lint
- Run linting across all packagesyarn format
- Format code using Prettier
Dependency Management Best Practices
1
Install dependencies in specific packages
Always install dependencies in the specific package where they’re used, never in the root
package.json
unless adding a resolution.2
Use resolutions for shared dependencies
When multiple packages need the same dependency, add a resolution to the root
package.json
to ensure version consistency.3
Build shared packages after changes
Run
yarn build
from the root when making changes to packages/shared
to make them available to other packages.Postinstall Hook Requirements
Theapps/open-swe
package includes a critical postinstall
hook:
This postinstall hook is required for LangGraph Platform deployment. Since
Open SWE is a monorepo and the agent requires access to built files from the
shared package, we must run the build process before starting the LangGraph
server.
Why This Matters
- Deployment Compatibility: The LangGraph Platform needs all dependencies built and available
- Shared Package Access: The agent imports utilities from
@openswe/shared
which must be compiled - Build Order: Ensures the shared package is built before the agent attempts to use it
If you encounter import errors related to the shared package during
development, run
yarn build
from the root to ensure all packages are
properly built and linked.Workspace Configuration
The monorepo uses Yarn 3.5.1 with the following configuration:- Node Linker:
node-modules
for compatibility - Workspaces: Automatically discovers packages in
apps/*
andpackages/*
- Package Manager: Enforced via
packageManager
field inpackage.json