A flexible AI research assistant built from scratch using Python and LangChain.
This project implements an AI agent with memory capabilities, structured reasoning, and various tools for research tasks. The agent can:
- Answer queries with structured responses
- Maintain conversation memory
- Search the web using DuckDuckGo
- Query Wikipedia for information
- Read PDF documents
- Execute shell commands
- Save research outputs to text files
- Clone the repository
- Install dependencies using Make:
This will create a virtual environment and install all required packages.
make install - Create a
.envfile based onsample.envwith your API keys
Run the assistant using Make:
make run
help: Show help messageexit,quit,bye: End the conversationmemory: Show memory summaryclear memory: Clear agent's memory (with backup)friendly mode: Toggle character-by-character output
The project includes a REST API server that allows you to interact with the AI agent programmatically or through a web interface.
make run-apiThis will start the FastAPI server on http://localhost:8000. The API includes automatic interactive documentation accessible at http://localhost:8000/docs.
POST /session: Create a new session with the agentPOST /query: Send a query to the agentPOST /command: Execute a command on the agentGET /health: Check the health of the API server
A simple command-line client is provided for testing the API:
make run-clientRun the automated tests with pytest:
make test-apiThis runs a suite of unit tests that verify the API's functionality, including session creation, query processing, and command execution.
src/agent/: Agent implementationsrc/memory/: Memory managementsrc/reasoning/: Structured reasoning componentssrc/tools/: Tool implementations (search, Wikipedia, shell, etc.)main.py: Entry point for the CLI applicationapi.py: FastAPI server for the agentclient.py: Command-line client for interacting with the APItest_api.py: Test suite for the API server
- LangChain
- Wikipedia API
- DuckDuckGo Search
- OpenAI/Anthropic integration
- Python-dotenv
- Pydantic
- FastAPI
[MIT License]