Skip to main content

Production-Ready Python Toolkit for AI Development - LLM wrappers, AI agents with reasoning capabilities, and conversation memory

Project description

Codemni

Codemni Logo

๐Ÿš€ The Complete AI Agent Framework for Python

Python 3.8+ License: Proprietary GitHub

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)

๐Ÿ“š Full Documentation โ†’

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

๐Ÿ“š Full Documentation โ†’

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

๐Ÿ“š Full Documentation โ†’

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:

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create a feature branch (git checkout -b feature/AmazingFeature)
  3. ๐Ÿ’พ Commit your changes (git commit -m 'Add some AmazingFeature')
  4. ๐Ÿ“ค Push to the branch (git push origin feature/AmazingFeature)
  5. ๐Ÿ”€ 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 support
    • anthropic>=0.18.0 - For Anthropic support
    • groq>=0.4.0 - For Groq support
    • google-generativeai>=0.3.0 - For Google Gemini support
    • ollama>=0.1.0 - For Ollama support

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ‘ค Author

CodexJitin


๐Ÿ”– Version

Current Version: 1.2.0

Changelog

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


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

codemni-1.2.0.tar.gz (72.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codemni-1.2.0-py3-none-any.whl (53.6 kB view details)

Uploaded Python 3

File details

Details for the file codemni-1.2.0.tar.gz.

File metadata

  • Download URL: codemni-1.2.0.tar.gz
  • Upload date:
  • Size: 72.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for codemni-1.2.0.tar.gz
Algorithm Hash digest
SHA256 9b410e6f2b994a860c6f558eb895a54a2f5cf97ef219c739c5141497dcfbf321
MD5 8a28183d066208d751c71c7649d06076
BLAKE2b-256 e0452aff150886b13f4e67a6d698634a0dc7b9df403500bc94d02f0300ead3c7

See more details on using hashes here.

File details

Details for the file codemni-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: codemni-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 53.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for codemni-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5035160efa9048f546a18363268aaec8ef03a6198a70fc6b1a6bebd3001a218d
MD5 14d8a72e99c82ef5c24501ab12668c0a
BLAKE2b-256 963e70c33974a5bee33139d0c8c15beda8f15cdbad14a15952c9f11b8b16b11e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page