A simple but powerful agent framework that utilizes LLMs for task planning and execution using the ReACT (Reasoning, Acting, and Observing) framework.
- Intelligent Planning: Breaks down complex tasks into smaller, manageable pieces
- ReACT Framework: Implements Reasoning → Acting → Observing cycle for iterative problem solving
- Tool Integration: Built-in tools for web search, browser automation, and more
- LLM Integration: Uses OpenAI's GPT models for reasoning and planning
- Extensible: Easy to add new tools and capabilities
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
cp env_example.txt .env # Edit .env with your OpenAI API key
# Install the package
pip install -e .
# Set up environment
cp env_example.txt .env
# Edit .env with your OpenAI API keyfrom miniagent import Agent
# Initialize the agent
agent = Agent()
# Give the agent a task
result = agent.run("Research the latest developments in AI and summarize the key findings")
print(result)# Run a simple task
python -m miniagent.cli "Search for the current weather in New York"
# Run demos
python -m miniagent.cli --demo
# List available tools
python -m miniagent.cli --list-tools- Planner: Breaks down tasks into subtasks
- ReACT Engine: Manages the reasoning, acting, and observing cycle
- Tool Manager: Handles tool execution and results
- LLM Interface: Communicates with language models
- Web Search: Search the internet for information
- Browser Automation: Navigate and interact with web pages
- File Operations: Read and write files
- Text Processing: Analyze and summarize text
agent = Agent()
result = agent.run("Find the current weather in New York")agent = Agent()
result = agent.run("""
Research the top 5 AI companies in 2024,
analyze their business models, and create a summary report
""")agent = Agent()
result = agent.run("""
Create a file with information about Python programming,
then read and analyze the content
""")agent = Agent()
result = agent.run("""
Navigate to https://example.com,
extract the main content, and summarize it
""")The framework can be configured through environment variables:
OPENAI_API_KEY: Your OpenAI API key (required)OPENAI_MODEL: Model to use (default: gpt-4)MAX_ITERATIONS: Maximum ReACT iterations (default: 10)TEMPERATURE: LLM temperature for creativity (default: 0.1)ENABLE_WEB_SEARCH: Enable web search tool (default: true)ENABLE_BROWSER: Enable browser automation (default: true)ENABLE_FILE_OPS: Enable file operations (default: true)BROWSER_HEADLESS: Run browser in headless mode (default: true)BROWSER_TIMEOUT: Browser timeout in seconds (default: 30)
from miniagent.tools import BaseTool
class MyCustomTool(BaseTool):
name = "my_custom_tool"
description = "Description of what this tool does"
def execute(self, **kwargs):
# Your tool logic here
return {"result": "tool output"}from miniagent.planner import BasePlanner
class MyCustomPlanner(BasePlanner):
def plan(self, task: str) -> List[str]:
# Your planning logic here
return ["step1", "step2", "step3"]Run the test suite to verify everything works:
python test_agent.pyTo set up the development environment:
# Install in development mode
pip install -e .
# Run tests
python test_agent.py
# Run demos
python demo.pyMIT License