A powerful reactive agent framework powered by Language Models (LLMs). ReActLM provides a flexible architecture for building AI agents that can reason, use tools, and maintain memory of their actions.
- 🧠 Advanced Reasoning - Chain of thought prompting with GPT-4 and other LLMs
- 🔍 Research Tools - Integrated Brave Search and Wikipedia research capabilities
- 💾 Persistent Memory - Redis-based memory system for maintaining context
- 📊 Structured Output - JSON-formatted responses for easy integration
- 🔄 Async First - Built with asyncio for high-performance operations
- 🛠️ Extensible - Plugin architecture for easy tool integration
- 📝 Detailed Tracing - Complete execution traces for debugging and analysis
Currently, this project is in development. To use it:
- Clone the repository
git clone https://github.com/Prashant18/ReActLM.git
cd ReActLM- Set up your environment and build the project locally
import asyncio
from reactlm import Agent, AgentConfig, OpenAILLM, BraveSearchTool
async def main():
# Initialize agent
agent = Agent(
llm=OpenAILLM(api_key="your_openai_key"),
config=AgentConfig(
max_iterations=5,
temperature=0.7
)
)
# Add research capabilities
await agent.add_tool(BraveSearchTool(api_key="your_brave_key"))
# Execute a task
result = await agent.execute(
"What are the latest developments in quantum computing?"
)
print(result.content)
if __name__ == "__main__":
asyncio.run(main())ReActLM requires API keys for various services. Create a .env file in your project root:
# Required
OPENAI_API_KEY=your_openai_api_key_here
BRAVE_API_KEY=your_brave_api_key_here
# Optional (for memory persistence)
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=your_redis_password # If using authentication.env file to version control. Add it to your .gitignore:
# .gitignore
.env
*.pyc
__pycache__/
-
OpenAI API Key:
- Sign up at OpenAI Platform
- Navigate to API Keys section
- Create a new secret key
-
Brave Search API Key:
- Visit Brave Search API
- Sign up for API access
- Get your API key (2,000 free searches/month)
-
Redis Setup (Optional):
- Local: Install Redis using package manager
- Cloud: Use services like Redis Labs
- Configure authentication if needed
- OpenAI GPT-4/3.5
- Support for custom LLM implementations
- Brave Search Integration
- Wikipedia Research
- Extensible tool system
- Redis-based persistence
- In-memory fallback
- Customizable storage backends
from reactlm import Agent, AgentConfig, ExecutionMode
# Initialize agent with research configuration
agent = Agent(
llm=OpenAILLM(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4"
),
config=AgentConfig(
max_iterations=5,
mode=ExecutionMode.STANDARD,
metadata={"purpose": "research"}
)
)
# Add research tools
await agent.add_tool(BraveSearchTool())
await agent.add_tool(WikipediaTool())
# Execute research with context
result = await agent.execute(
"Analyze quantum computing developments",
context={
"format": "structured",
"depth": "comprehensive",
"require_references": True
}
)from reactlm import RedisMemory
# Initialize memory system
memory = RedisMemory(
host="localhost",
port=6379,
prefix="myapp:",
ttl=3600 # 1 hour cache
)
# Use with agent
agent = Agent(
llm=OpenAILLM(),
config=AgentConfig(),
memory=memory
)This project is licensed under the MIT License - see the LICENSE file for details.