Production-Ready Python Toolkit for AI Development - LLM wrappers, AI agents with reasoning capabilities, and conversation memory
Project description
Codemni
๐ The Complete AI Agent Framework for Python
The most powerful framework for building autonomous AI agents - featuring intelligent tool execution, multi-LLM orchestration, and advanced conversational memory
Features โข Installation โข Modules โข Quick Start โข Documentation
๐ About
Codemni is a powerful Python framework for building production-ready AI agents and LLM applications. Unlike simple wrappers, Codemni provides a complete ecosystem with intelligent tool-calling agents, multi-provider LLM integrations, and sophisticated memory systems. Whether you're building chatbots, automation systems, or complex AI workflows, Codemni gives you the foundation to create robust, scalable solutions.
Why Choose Codemni?
- ๐ค Complete Agent Framework: Not just an LLM wrapper - build agents that can think, decide, and execute tools
- โจ Production-Ready: Battle-tested with built-in error handling, retries, and intelligent fallbacks
- ๐ฏ Multi-Provider Support: Seamlessly switch between OpenAI, Google, Anthropic, Groq, and Ollama
- ๐ง Advanced Memory: 4 memory strategies to maintain context and conversation history
- ๐ง Developer-Friendly: Intuitive APIs, comprehensive documentation, and consistent interfaces
- ๐ Performance-Optimized: Designed for speed, efficiency, and reliability at scale
- ๐ก๏ธ Enterprise-Grade: Robust error handling, logging, and production-ready code
๐งฉ Modules
๐ค Agent Framework - Intelligent Tool-Calling Agents
Build powerful AI agents with varying levels of reasoning capabilities - from fast production agents to deep reasoning systems.
TOOL_CALLING_AGENT - Basic Tool Execution Agent
Simple and efficient AI agent for standard tool-calling tasks.
Key Features:
- ๐ง Dynamic tool execution based on LLM decisions
- ๐พ Optional conversation memory (4 different strategies)
- ๐จ Custom agent personality/role support
- ๐ Verbose mode for debugging
- ๐ Multi-LLM support (OpenAI, Google Gemini, Anthropic, Groq, Ollama)
- โ ๏ธ Designed for standard models (reasoning models like o1, o3 not supported)
REASONING_TOOL_CALLING_AGENT - Fast Reasoning Agent โก
Class: Create_ToolCalling_Agent
Production-ready agent with basic reasoning capabilities - perfect for speed and cost efficiency.
Key Features:
- โก Fast: 2.4x faster than deep reasoning (4.63s avg)
- ๐ฐ Cost-Efficient: 50-70% lower token usage
- ๐ง Thinking Display: Shows reasoning process
- ๐ง Tool Execution: Intelligent tool selection
- ๐พ Memory Support: Full conversation history
- ๐ฏ Production-Ready: Optimized for high-volume APIs
Best For: Production APIs, real-time systems, cost-sensitive applications
DEEP_REASONING_TOOL_CALLING_AGENT - Advanced Reasoning Agent ๐ง
Class: Create_Deep_Reasoning_Tool_Calling_Agent
Sophisticated agent with deep chain-of-thought reasoning, problem analysis, and self-reflection.
Key Features:
- ๐ง Deep Reasoning: Comprehensive problem understanding
- ๐ Situation Awareness: Tracks progress dynamically
- ๐ญ Chain-of-Thought: Multi-layered reasoning process
- ๐ฏ Self-Reflection: Confidence scoring (0.0-1.0)
- ๐ก๏ธ Error Recovery: Strategic alternative approaches
- ๐ Full Transparency: See exactly how AI thinks
Best For: Complex problems, research, debugging, educational tools
Comparison:
| Feature | TOOL_CALLING | REASONING โก | DEEP_REASONING ๐ง |
|---|---|---|---|
| Speed | Fast | Fastest (4.63s) | Slower (11.11s) |
| Thinking | None | Basic | Deep |
| Cost | Low | Low | High |
| Use Case | Basic tools | Production | Research |
๐พ Memory Module - Conversation History Management
Flexible conversation memory system for maintaining context in multi-turn interactions.
Available Memory Types:
- ๐ ConversationalBufferMemory - Store all messages
- ๐ช ConversationalWindowMemory - Keep last N exchanges
- ๐ซ ConversationalTokenBufferMemory - Limit by token count
- ๐ ConversationalSummaryMemory - Summarize old conversations
Key Features:
- Common API across all memory types
- Easy serialization (save/load)
- Lightweight and efficient
- Integrates seamlessly with ToolCalling Agent
๐ Full Memory Documentation โ
๐ก LLM Module - Large Language Model Wrappers
Production-ready wrappers for popular LLM providers with unified interface.
Supported Providers:
- ๐ท Google Gemini (
gemini-pro,gemini-2.0-flash-exp) - ๐ข OpenAI (
gpt-4,gpt-3.5-turbo,gpt-4-turbo) - ๐ฃ Anthropic Claude (
claude-3-opus,claude-3-sonnet,claude-3-haiku) - โก Groq (
llama3-70b,mixtral-8x7b) - ๐ฆ Ollama (Local models:
llama2,mistral,codellama)
Key Features:
- Automatic retries with exponential backoff
- Configurable timeouts
- Consistent API across all providers
- Both function and class-based interfaces
- Silent operation (no logging)
- Minimal dependencies
๐ Full LLM Documentation โ
๐ฆ Installation
Install from PyPI (Recommended)
# Install the base package
pip install Codemni
# Install with specific LLM providers
pip install Codemni[openai] # OpenAI support
pip install Codemni[anthropic] # Anthropic Claude support
pip install Codemni[groq] # Groq support
pip install Codemni[google] # Google Gemini support
pip install Codemni[ollama] # Ollama (local) support
# Install with all LLM providers
pip install Codemni[all]
Install from Source
# Clone the repository
git clone https://github.com/CodexJitin/Codemni.git
cd Codemni
# Install in development mode
pip install -e .
# Or install with all dependencies
pip install -e .[all]
๐ Quick Start
Installation
pip install Codemni[all] # Install with all LLM providers
REASONING Agent - Fast Production Agent (Recommended)
from Codemni.REASONING_TOOL_CALLING_AGENT.agent import Create_ToolCalling_Agent
from Codemni.llm.Google_llm import GoogleLLM
# Initialize LLM
llm = GoogleLLM(
model="gemini-2.0-flash-exp",
api_key="YOUR_API_KEY" # or set GOOGLE_API_KEY env var
)
# Create reasoning agent (fast & cost-efficient)
agent = Create_ToolCalling_Agent(llm=llm, verbose=True)
# Define a tool
def calculator(expression):
return str(eval(expression))
# Add tool to agent
agent.add_tool("calculator", "Evaluate mathematical expressions", calculator)
# Use the agent
response = agent.invoke("What is 125 * 48?")
print(response) # Agent shows reasoning and uses calculator
DEEP REASONING Agent - Advanced Problem Solving
from Codemni.DEEP_REASONING_TOOL_CALLING_AGENT.agent import Create_Deep_Reasoning_Tool_Calling_Agent
from Codemni.llm.Google_llm import GoogleLLM
# Initialize LLM
llm = GoogleLLM(
model="gemini-2.0-flash-thinking-exp-1219",
api_key="YOUR_API_KEY"
)
# Create deep reasoning agent (for complex problems)
agent = Create_Deep_Reasoning_Tool_Calling_Agent(
llm=llm,
verbose=True,
show_reasoning=True, # See full reasoning process
min_confidence=0.7 # Confidence threshold
)
# Add tools
agent.add_tool("calculator", "Evaluate math expressions", calculator)
# Use for complex reasoning
response = agent.invoke(
"If I have 100 apples and give away 30%, then buy 25 more, how many do I have?"
)
# Shows: Problem Understanding โ Current Situation โ Deep Reasoning โ Tool Decision โ Self-Reflection
Basic ToolCalling Agent
from Codemni.TOOL_CALLING_AGENT.agent import Create_ToolCalling_Agent
from Codemni.llm.Google_llm import GoogleLLM
# Initialize LLM
llm = GoogleLLM(
model="gemini-2.0-flash-exp",
api_key="YOUR_API_KEY"
)
# Create basic agent (no reasoning display)
agent = Create_ToolCalling_Agent(llm=llm, verbose=True)
# Define a tool
def calculator(expression):
return str(eval(expression))
# Add tool to agent
agent.add_tool("calculator", "Evaluate mathematical expressions", calculator)
# Use the agent
response = agent.invoke("What is 125 * 48?")
print(response) # Agent uses the calculator tool
Agent with Memory
from Codemni.REASONING_TOOL_CALLING_AGENT.agent import Create_ToolCalling_Agent
from Codemni.llm.Google_llm import GoogleLLM
from Codemni.memory.conversational_buffer_memory import ConversationalBufferMemory
# Initialize LLM and memory
llm = GoogleLLM(model="gemini-2.0-flash-exp", api_key="YOUR_API_KEY")
memory = ConversationalBufferMemory()
# Create agent with memory
agent = Create_ToolCalling_Agent(llm=llm, memory=memory, verbose=True)
agent.add_tool("calculator", "Evaluate math", calculator)
# Multi-turn conversation with context
response1 = agent.invoke("Calculate 50 + 25") # Returns: 75
response2 = agent.invoke("Now multiply that by 2") # Returns: 150 (remembers 75!)
LLM Module - Basic Usage
from Codemni.llm import google_llm, openai_llm, anthropic_llm
# Google Gemini
response = google_llm(
prompt="Explain quantum computing in simple terms",
model="gemini-pro",
api_key="your-api-key" # or set GOOGLE_API_KEY env var
)
print(response)
# OpenAI GPT
response = openai_llm(
prompt="Write a Python function to calculate fibonacci",
model="gpt-4",
temperature=0.7,
max_tokens=500
)
print(response)
# Anthropic Claude
response = anthropic_llm(
prompt="Explain the concept of recursion",
model="claude-3-sonnet-20240229",
max_tokens=300
)
print(response)
Error Handling
from Codemni.llm import google_llm, GoogleLLMError, GoogleLLMAPIError
try:
response = google_llm(
prompt="Hello, world!",
model="gemini-pro"
)
print(response)
except GoogleLLMAPIError as e:
print(f"API Error: {e}")
except GoogleLLMError as e:
print(f"General Error: {e}")
๐ Configuration
Environment Variables
Set these to avoid hardcoding API keys:
# Linux/Mac
export GOOGLE_API_KEY="your-google-key"
export OPENAI_API_KEY="your-openai-key"
export ANTHROPIC_API_KEY="your-anthropic-key"
export GROQ_API_KEY="your-groq-key"
export OLLAMA_BASE_URL="http://localhost:11434" # Optional
# Windows PowerShell
$env:GOOGLE_API_KEY="your-google-key"
$env:OPENAI_API_KEY="your-openai-key"
Using .env File
# Install python-dotenv
pip install python-dotenv
from dotenv import load_dotenv
load_dotenv()
# Now your environment variables are loaded
from Codemni.llm import google_llm
response = google_llm(prompt="Hello", model="gemini-pro")
๐๏ธ Project Structure
Codemni/
โโโ ๐ README.md # This file - Main documentation
โโโ ๐ LICENSE # License information
โโโ ๐ requirements.txt # Base dependencies
โโโ ๐ __init__.py # Package initialization
โ
โโโ ๐ค TOOL_CALLING_AGENT/ # Basic Tool Calling Agent
โ โโโ __init__.py
โ โโโ README.md # Agent documentation
โ โโโ agent.py # Main agent implementation
โ โโโ prompt.py # Prompt templates
โ
โโโ โก REASONING_TOOL_CALLING_AGENT/ # Fast Reasoning Agent
โ โโโ __init__.py
โ โโโ README.md # Reasoning agent documentation
โ โโโ agent.py # Reasoning agent with thinking
โ โโโ prompt.py # Reasoning prompt templates
โ
โโโ ๐ง DEEP_REASONING_TOOL_CALLING_AGENT/ # Deep Reasoning Agent
โ โโโ __init__.py
โ โโโ README.md # Deep reasoning documentation
โ โโโ agent.py # Advanced reasoning implementation
โ โโโ prompt.py # Deep reasoning prompts
โ
โโโ ๐พ memory/ # Memory Module
โ โโโ __init__.py
โ โโโ README.md # Memory documentation
โ โโโ conversational_buffer_memory.py
โ โโโ conversational_window_memory.py
โ โโโ conversational_token_buffer_memory.py
โ โโโ conversational_summary_memory.py
โ
โโโ ๐ llm/ # LLM Module
โ โโโ __init__.py
โ โโโ README.md # LLM module documentation
โ โโโ Google_llm.py # Google Gemini wrapper
โ โโโ OpenAI_llm.py # OpenAI wrapper
โ โโโ Anthropic_llm.py # Anthropic wrapper
โ โโโ Groq_llm.py # Groq wrapper
โ โโโ Ollama_llm.py # Ollama wrapper
โ
โโโ ๐ core/ # Core utilities
โ โโโ adapter.py # Tool execution adapter
โ
โโโ ๐ assets/ # Assets and media
โโโ codemni-logo.jpg
๐ Documentation
Module Documentation
-
TOOL_CALLING_AGENT - Basic tool calling agent
- Simple tool execution without reasoning display
- Memory integration guide
- Tool definition best practices
-
REASONING_TOOL_CALLING_AGENT - Fast reasoning agent โก
- Complete API reference
- Basic reasoning with thinking display
- Production-ready performance
- Memory integration
- Troubleshooting and examples
-
DEEP_REASONING_TOOL_CALLING_AGENT - Advanced reasoning agent ๐ง
- Deep chain-of-thought reasoning
- Problem understanding and situation awareness
- Self-reflection and confidence scoring
- Error recovery strategies
- Complex problem-solving examples
-
Memory Module - Conversation memory guide
- Memory type comparison
- Usage examples for each type
- Serialization and persistence
- Integration with agents
-
LLM Module - Comprehensive guide to LLM wrappers
- API reference for all providers
- Advanced usage examples
- Exception handling guide
- Provider-specific notes
โจ Features by Module
Agent Framework
| Feature | TOOL_CALLING | REASONING โก | DEEP_REASONING ๐ง |
|---|---|---|---|
| ๐ค Multi-LLM Support | โ | โ | โ |
| ๐ง Tool Execution | โ | โ | โ |
| ๐พ Memory Integration | โ | โ | โ |
| ๐ง Thinking Display | โ | โ Basic | โ Deep |
| ๐ Problem Analysis | โ | โ | โ Comprehensive |
| ๐ฏ Situation Awareness | โ | โ | โ Dynamic |
| ๐ญ Chain-of-Thought | โ | โ ๏ธ Surface | โ Multi-layer |
| ๐ Self-Reflection | โ | โ | โ With confidence |
| ๐ก๏ธ Error Recovery | โ ๏ธ Basic | โ ๏ธ Basic | โ Strategic |
| โก Speed | Fast | Fastest | Slower |
| ๐ฐ Cost | Low | Low | High |
| ๐ฏ Best For | Simple tools | Production | Research |
ToolCalling Agent Features
| Feature | Description |
|---|---|
| ๐ค Multi-LLM Support | Works with OpenAI, Google Gemini, Anthropic, Groq, Ollama |
| ๐ง Dynamic Tools | Automatically selects and executes appropriate tools |
| ๐พ Optional Memory | 4 memory strategies for conversation context |
| ๐จ Custom Prompts | Customize agent personality and role |
| ๐ Verbose Mode | Detailed logging for debugging |
| โ ๏ธ Standard Models | Optimized for instruction-following models (not reasoning models) |
Memory Module
| Feature | Description |
|---|---|
| ๐ Buffer Memory | Store all conversation messages |
| ๐ช Window Memory | Keep only recent N exchanges |
| ๐ซ Token Buffer | Limit memory by token count |
| ๐ Summary Memory | Summarize old conversations |
| ๐พ Serialization | Save/load conversation history |
| ๐ Easy Integration | Works seamlessly with agents |
LLM Module
| Feature | Description |
|---|---|
| ๐ Auto Retry | Exponential backoff for transient failures |
| โฑ๏ธ Timeouts | Configurable request timeouts (30-60s) |
| ๐ก๏ธ Error Handling | Clear exception hierarchy per provider |
| ๐ Silent Mode | No logging - clean operation |
| ๐ฆ Minimal Deps | Install only what you need |
| ๐ฏ Unified API | Same interface across all providers |
| โ Validation | Input validation and defensive coding |
| ๐ง Dual Interface | Both function and class-based APIs |
๐ค Contributing
Contributions are welcome! Here's how you can help:
- ๐ด Fork the repository
- ๐ฟ Create a feature branch (
git checkout -b feature/AmazingFeature) - ๐พ Commit your changes (
git commit -m 'Add some AmazingFeature') - ๐ค Push to the branch (
git push origin feature/AmazingFeature) - ๐ Open a Pull Request
Development Guidelines
- Follow existing code style and patterns
- Add tests for new features
- Update documentation
- Keep dependencies minimal
- Maintain backward compatibility
๐ Requirements
- Python 3.8 or higher
- Optional dependencies (install as needed):
openai>=1.0.0- For OpenAI supportanthropic>=0.18.0- For Anthropic supportgroq>=0.4.0- For Groq supportgoogle-generativeai>=0.3.0- For Google Gemini supportollama>=0.1.0- For Ollama support
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Author
CodexJitin
- GitHub: @CodexJitin
- Repository: Codemni
๐ Version
Current Version: 1.2.1
Changelog
v1.2.1 (2025-10-25)
- ๐ Fixed: All documentation links now use absolute GitHub URLs for PyPI compatibility
- ๐ฆ Added: PyPI version badge in README
- โ Verified: All links work correctly on PyPI, GitHub, and locally
v1.2.0 (2025-10-25)
- ๐ NEW: Added REASONING_TOOL_CALLING_AGENT - Fast reasoning agent with thinking display
- ๐ง NEW: Added DEEP_REASONING_TOOL_CALLING_AGENT - Advanced reasoning with deep chain-of-thought
- ๐ Performance: Comprehensive agent comparison (Basic vs Reasoning vs Deep Reasoning)
- ๐ Features: Problem understanding, situation awareness, self-reflection, confidence scoring
- ๐ก๏ธ Error Recovery: Strategic error recovery in deep reasoning agent
- ๐ Documentation: Complete README files for all agent types
- โก Optimization: gRPC warning suppression in all LLM wrappers
v1.1.0 (2025-10-24)
- ๐ Added ToolCalling Agent module
- ๐พ Added Memory module with 4 memory strategies
- ๐ง LLM module now supports both function and class-based interfaces
- ๐ Comprehensive documentation for all modules
- โ ๏ธ Added warnings about reasoning model compatibility
v1.0.0 (2025-10-23)
- ๐ Initial release
- โ LLM module with 5 provider support
- โ Production-ready error handling
- โ Comprehensive documentation
๐ Show Your Support
If you find Codemni useful, please consider:
- โญ Starring the repository
- ๐ Reporting bugs
- ๐ก Suggesting new features
- ๐ Contributing code
๐ Support
- ๐ง Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
Made with โค๏ธ by CodexJitin
Empowering developers to build better AI applications
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codemni-1.2.1.tar.gz.
File metadata
- Download URL: codemni-1.2.1.tar.gz
- Upload date:
- Size: 72.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a5c2ed2953f85751fcb34df0d7801ede29a732e89d3e4769f456c80ee3742b2
|
|
| MD5 |
259fb2001513274b3e8dcf54d2b9b14e
|
|
| BLAKE2b-256 |
c87a395d85efbe826e76b2a158c7ebc6111c4d025a941481e594bb261e882643
|
File details
Details for the file codemni-1.2.1-py3-none-any.whl.
File metadata
- Download URL: codemni-1.2.1-py3-none-any.whl
- Upload date:
- Size: 53.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b66368d17c82a61d8442906e2f495cd8bda098e7ca3988fc9716f659f342650b
|
|
| MD5 |
e630f7a02f5d6792cf61b25f28de5bc9
|
|
| BLAKE2b-256 |
85a1c97879b10349ebfefab70b7d448e294aac97d933fde19311884f24bf6457
|