A template implementation of a conversational agent using LangGraph TypeScript and GPT-4. This agent demonstrates the power of LangGraph for building sophisticated workflow-based AI agents with tool integration, state management, and graph-based execution patterns with full TypeScript type safety.
- Features
- Quick Start
- Prerequisites
- Installation
- Usage
- Project Structure
- Troubleshooting
- Contributing
- Support
- License
- Interactive conversational interface with workflow orchestration
- Graph-based agent execution with state management
- Tool integration support with conditional logic
- Streaming responses for real-time interaction
- Built on LangGraph TypeScript for sophisticated agent workflows
- TypeScript support with full type safety and IDE integration
- Conditional routing and decision-making capabilities
- Easy deployment and integration with Blaxel platform
For those who want to get up and running quickly:
# Clone the repository
git clone https://github.com/blaxel-ai/template-langgraph-ts.git
# Navigate to the project directory
cd template-langgraph-ts
# Install dependencies
npm install
# Start the server
bl serve --hotreload
# In another terminal, test the agent
bl chat --local blaxel-agent- Node.js: 18.0 or later
- NPM: Node package manager
- Blaxel Platform Setup: Complete Blaxel setup by following the quickstart guide
- Blaxel CLI: Ensure you have the Blaxel CLI installed. If not, install it globally:
curl -fsSL https://raw.githubusercontent.com/blaxel-ai/toolkit/main/install.sh | BINDIR=/usr/local/bin sudo -E sh - Blaxel login: Login to Blaxel platform
bl login YOUR-WORKSPACE
- Blaxel CLI: Ensure you have the Blaxel CLI installed. If not, install it globally:
Clone the repository and install dependencies:
git clone https://github.com/blaxel-ai/template-langgraph-ts.git
cd template-langgraph-ts
npm installStart the development server with hot reloading:
bl serve --hotreloadNote: This command starts the server and enables hot reload so that changes to the source code are automatically reflected.
You can test your agent using the chat interface:
bl chat --local blaxel-agentOr run it directly with specific input:
bl run agent blaxel-agent --local --data '{"input": "Plan and execute a research task about renewable energy"}'When you are ready to deploy your application:
bl deployThis command uses your code and the configuration files under the .blaxel directory to deploy your application.
- src/index.ts - Application entry point
- src/agent.ts - Core agent implementation with LangGraph integration
- src/graph/ - Graph definition and workflow nodes
- nodes.ts - Individual graph node implementations
- edges.ts - Edge conditions and routing logic
- state.ts - State management and typing
- src/tools/ - Tool implementations and integrations
- src/types/ - TypeScript type definitions
- package.json - Node.js package configuration
- tsconfig.json - TypeScript configuration
- blaxel.toml - Blaxel deployment configuration
-
Blaxel Platform Issues:
- Ensure you're logged in to your workspace:
bl login MY-WORKSPACE - Verify models are available:
bl get models - Check that functions exist:
bl get functions
- Ensure you're logged in to your workspace:
-
Node.js Version Issues:
- Make sure you have Node.js 18+
- Try
node --versionto check your version - Update Node.js if needed
-
Graph Compilation Errors:
- Check node and edge definitions
- Verify state type consistency
- Review conditional edge logic
-
TypeScript Compilation Errors:
- Run
npx tsc --noEmitto check for type errors - Ensure all graph state types are properly defined
- Check node function signatures
- Run
-
Workflow Execution Issues:
- Monitor graph execution logs
- Check for infinite loops in conditional edges
- Verify tool permissions and access through Blaxel
For more help, please submit an issue on GitHub.
Contributions are welcome! Here's how you can contribute:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature
- Submit a Pull Request
Please make sure to update tests as appropriate and follow the TypeScript code style of the project.
If you need help with this template:
- Submit an issue for bug reports or feature requests
- Visit the Blaxel Documentation for platform guidance
- Check the LangGraph.js Documentation for framework-specific help
- Join our Discord Community for real-time assistance
This project is licensed under the MIT License. See the LICENSE file for more details.
