πŸš€ Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More β†’
Socket
Book a DemoInstallSign in
Socket

@cloudbase/agent-examples-langchain-ai-coding

Package Overview
Dependencies
Maintainers
13
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudbase/agent-examples-langchain-ai-coding

AI Coding Agent using LangChain with SQLite checkpoint - React project generation and management

latest
npmnpm
Version
0.0.7
Version published
Weekly downloads
133
-1.48%
Maintainers
13
Weekly downloads
Β 
Created
Source

AI Coding Agent - LangChain with SQLite Checkpoint

A LangChain-based AI coding assistant with SQLite persistent conversation history. This example demonstrates how to use LangChain agents with AG-Kit tools and SQLite checkpoint for conversation persistence.

Features

  • πŸ€– LangChain Integration - Built on LangChain with AG-Kit tool conversion
  • πŸ’Ύ SQLite Persistence - Conversation history stored in SQLite database
  • πŸ”§ AG-Kit Tools - Full access to AG-Kit's React coding tools
  • πŸ“ Interactive CLI - Simple command-line interface for testing
  • πŸ”„ Memory Management - Persistent conversation state across sessions

Prerequisites

  • Node.js 18+
  • OpenAI API key

Quick Start

  • Install and run:
    npm install
    npm run interactive
    

Environment Variables

Create a .env file with:

# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL=gpt-4o-mini
OPENAI_BASE_URL=https://api.openai.com/v1

Usage

Interactive Mode

Start the interactive CLI:

npm run interactive

Example conversation:

πŸ’¬ You: Create a React component for a todo list

πŸ€– Assistant:
I'll help you create a React todo list component. Let me create a new component file...

πŸ’¬ You: Add TypeScript support to this component

πŸ€– Assistant:
I'll convert the component to TypeScript with proper type definitions...

Programmatic Usage

import { createAgent } from '@cloudbase/agent-examples-langchain-ai-coding';

const agent = createAgent({
  baseProjectPath: '/path/to/projects',
  projectName: 'my-react-app',
  autoInstallDependencies: true,
});

const response = await agent.invoke({
  messages: [{ role: 'user', content: 'Create a React component' }]
});

console.log(response.content);

Architecture

This example demonstrates:

  • LangChain Agent Creation - Using the existing agent.ts implementation
  • AG-Kit Tool Integration - Converting AG-Kit tools to LangChain format
  • SQLite Checkpoint - Persistent conversation storage using LangChain's SQLite checkpoint
  • Interactive CLI - Simple readline-based interface for testing
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   User Input    │───▢│  LangChain Agent │───▢│   AG-Kit Tools  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚                        β”‚
                                β–Ό                        β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚ SQLite Checkpointβ”‚    β”‚ React Coding    β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Project Structure

src/
β”œβ”€β”€ agent.ts              # LangChain agent implementation
└── index.ts             # Main exports

examples/
└── full-workflow.ts     # Interactive CLI example

Available Commands

  • npm run build - Build the project
  • npm run interactive - Start interactive CLI

Troubleshooting

OpenAI API Issues

  • Verify your API key is correct
  • Check you have sufficient credits
  • Ensure the model name is supported

SQLite Database

The SQLite database (checkpoints.db) will be created automatically in the project directory when you first run the agent.

Contributing

This example is part of the AG-Kit project. Please refer to the main project's contributing guidelines.

License

MIT License - see the main AG-Kit project for details.

Keywords

react

FAQs

Package last updated on 29 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts