Skip to main content
TypeScript agent using LangChain.js with Bindu SDK.

Code

Skill Configuration

Create skills/typescript-langchain-skill/skill.yaml:

How It Works

TypeScript SDK Integration
  • @bindu/sdk: TypeScript Bindu SDK for agent development
  • Automatic microservice generation with DID and auth
  • gRPC communication with Bindu Python core
  • A2A protocol compliance handled by SDK
LangChain.js Integration
  • ChatOpenAI: LangChain’s OpenAI integration
  • Message format conversion between Bindu and LangChain
  • Async/await pattern for response handling
  • Flexible content type handling
Message Processing
  • ChatMessage[]: Bindu message format with role and content
  • Role mapping (user/assistant/system) for LangChain compatibility
  • Content extraction and type checking
  • Response formatting for Bindu protocol
Configuration
  • Environment-based API key management
  • Standard Bindu deployment configuration
  • Skills and capabilities declaration
  • CORS origins for frontend integration

Dependencies

Environment Setup

Create .env file:

Run

Examples:
  • “Research the latest developments in quantum computing and provide a summary”
  • “What are the main benefits of using LangChain with TypeScript?”
  • “How do I integrate LangChain with OpenAI in a TypeScript application?”

Example API Calls

Frontend Setup

Open http://localhost:5173 and try to chat with the TypeScript LangChain agent