A lightweight, modular framework for building composable AI agents.
MicroGPT is a Python framework designed for creating small, focused AI agents that can work independently or together. It provides the building blocks for creating sophisticated AI applications through simple, composable components.
Key features:
- 🧩 Modular Design: Build specialized agents for specific tasks
- 🔄 Composability: Chain agents together in pipelines and networks
- 💾 Memory Management: Flexible memory options for storing state and context
- 🌐 Web Integration: Built-in web capabilities for fetching and processing content
- 📊 Token Tracking: Monitor and manage LLM token usage
- 🛠️ Utility Decorators: Enhance agent functionality with logging, caching, and retry mechanisms
pip install microgptOr install directly from the repository:
git clone https://github.com/username/microgpt.git
cd microgpt
pip install -e .from microgpt import LLMAgent, OpenAIProvider
from dotenv import load_dotenv
import os
# Load environment variables from .env file
load_dotenv()
# Create an LLM provider using your API key
provider = OpenAIProvider(api_key=os.getenv("OPENAI_API_KEY"))
# Create a simple agent
agent = LLMAgent(
name="Helpdesk",
description="I provide helpful responses to user questions",
llm_provider=provider
)
# Ask a question
response = agent.run("What are some ways to improve productivity?")
print(response)Check out the /examples directory for complete working examples:
- Summarization Agent: Summarize text with customizable formats
- Conversational Chatbot: Build a chatbot with memory
- News Research Assistant: Analyze articles with multiple agents in a pipeline
- Research Assistant Network: Complex agent network for research tasks
Copy the .env.example file to .env and add your API keys:
cp .env.example .env
# Edit .env to add your API keysThis project is licensed under the MIT License - see the LICENSE file for details.