https://github.com/likhith-ts/simple-ai-agent
A lightweight AI agent implementation built with LangChain and LangGraph that provides an interactive conversational interface with tool capabilities.
https://github.com/likhith-ts/simple-ai-agent
ai-agents langchain langchain-python openai-api
Last synced: about 1 month ago
JSON representation
A lightweight AI agent implementation built with LangChain and LangGraph that provides an interactive conversational interface with tool capabilities.
- Host: GitHub
- URL: https://github.com/likhith-ts/simple-ai-agent
- Owner: likhith-ts
- Created: 2025-10-04T14:12:02.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-10-04T17:20:08.000Z (9 months ago)
- Last Synced: 2025-10-04T19:14:32.600Z (9 months ago)
- Topics: ai-agents, langchain, langchain-python, openai-api
- Language: Python
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple AI Agent
A lightweight AI agent implementation built with LangChain and LangGraph that provides an interactive conversational interface with tool capabilities.
## Features
- Interactive chat interface with OpenAI GPT-4o
- Built-in calculator tool for mathematical operations
- Extensible tool system for adding custom functionality
- Streaming responses for real-time interaction
- Environment-based configuration
## Installation
```bash
# Clone the repository
git clone https://github.com/yourusername/Simple-AI-Agent.git
cd Simple-AI-Agent
# Install dependencies using uv (recommended)
uv sync
# Or install with pip
pip install -r requirements.txt
```
## Prerequisites
- Python 3.13 or higher
- OpenAI API key
## Setup
1. Create a `.env` file in the root directory:
```env
OPENAI_API_KEY=your_openai_api_key_here
```
2. Replace `your_openai_api_key_here` with your actual OpenAI API key.
## Usage
Run the agent:
```bash
python main.py
```
The agent will start an interactive session where you can:
- Have conversations with the AI
- Use the built-in calculator by asking math questions
- Type 'exit' to quit
### Example interactions:
```
You: What is 25 + 37?
Agent: I'll help you calculate that. Let me use the calculator tool.
Calculating the sum of 25 and 37
The sum of 25 and 37 is 62
You: Tell me about Python programming
Agent: Python is a high-level, interpreted programming language...
```
## Configuration
The agent can be customized by modifying the following in `main.py`:
- **Model**: Change the OpenAI model (currently set to `gpt-4o`)
- **Temperature**: Adjust response creativity (currently set to `0` for deterministic responses)
- **Tools**: Add custom tools to extend functionality
### Adding Custom Tools
To add new tools, define them using the `@tool` decorator:
```python
@tool
def your_custom_tool(parameter: str) -> str:
"""Description of what your tool does."""
# Your tool logic here
return "result"
# Add to tools list
tools = [calculator, your_custom_tool]
```
## Dependencies
This project uses the following main dependencies:
- **LangChain** (>=0.3.27): Framework for building applications with LLMs
- **LangChain OpenAI** (>=0.3.33): OpenAI integration for LangChain
- **LangGraph** (>=0.6.7): Tool for building stateful, multi-actor applications
- **python-dotenv** (>=1.1.1): Environment variable management
## Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/your-feature`)
3. Make your changes
4. Add tests if applicable
5. Commit your changes (`git commit -am 'Add some feature'`)
6. Push to the branch (`git push origin feature/your-feature`)
7. Submit a pull request
## License
[Your license information]