{"id":30133788,"url":"https://github.com/devdezzies/minigen","last_synced_at":"2025-09-01T21:42:22.445Z","repository":{"id":308074542,"uuid":"1030117622","full_name":"devdezzies/minigen","owner":"devdezzies","description":"A light-weight framework for building AI agents with Native OpenAI API compatibility","archived":false,"fork":false,"pushed_at":"2025-08-06T13:09:41.000Z","size":3361,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-11T19:55:51.035Z","etag":null,"topics":["agent-framework","function-calling","lightweight","openai-compatible"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/minigen/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devdezzies.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-01T05:48:14.000Z","updated_at":"2025-08-07T06:52:54.000Z","dependencies_parsed_at":"2025-08-04T02:36:20.979Z","dependency_job_id":"a22aadd2-db4a-41d3-98b6-73d2fb1c738a","html_url":"https://github.com/devdezzies/minigen","commit_stats":null,"previous_names":["devdezzies/minigen"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devdezzies/minigen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdezzies%2Fminigen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdezzies%2Fminigen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdezzies%2Fminigen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdezzies%2Fminigen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devdezzies","download_url":"https://codeload.github.com/devdezzies/minigen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdezzies%2Fminigen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273197067,"owners_count":25062230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-framework","function-calling","lightweight","openai-compatible"],"created_at":"2025-08-10T20:12:03.777Z","updated_at":"2025-09-01T21:42:22.390Z","avatar_url":"https://github.com/devdezzies.png","language":"Python","readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"/docs/logo_tiny_light.svg\"\u003e\n  \u003cimg alt=\"tiny corp logo\" src=\"assets/minigen-logo.svg\" width=\"50%\" height=\"50%\"\u003e\n\u003c/picture\u003e\n\n# MiniGen\n\n**A lightweight, intuitive Python framework for building AI agents and multi-agent systems**\n\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Documentation](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://d-ev.space/)\n\n\u003ch3\u003e\n\n[🏠 Homepage](https://github.com/devdezzies/minigen) | [📖 Documentation](https://d-ev.space/) | [🚀 Quick Start](#quick-start) | [💡 Examples](#examples)\n\n\u003c/h3\u003e\n\n\u003c/div\u003e\n\n## Overview\n\nMiniGen is a lightweight, Python-native framework designed to help you learn and build AI agents without getting lost in boilerplate code. It's built for simplicity, experimentation, and understanding the core concepts that make AI agents work.\n\n### Key Features\n\n- 🎯 **Simple \u0026 Intuitive**: Minimal boilerplate, maximum functionality\n- 🔧 **Tool Integration**: Easily extend agents with custom capabilities\n- 🔗 **Workflow Orchestration**: Chain prompts and coordinate multiple agents\n- ⚡ **Parallel Execution**: Run agents concurrently for better performance\n- 🎭 **Multi-Agent Networks**: Build complex systems with intelligent routing\n- 🔌 **Provider Agnostic**: Works with OpenAI, Anthropic, and other LLM providers\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Core Concepts](#core-concepts)\n- [Examples](#examples)\n- [Advanced Usage](#advanced-usage)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Installation\n\n```bash\npip install minigen\n```\n\nOr install from source:\n\n```bash\ngit clone https://github.com/devdezzies/minigen.git\ncd minigen\npip install -e .\n```\n\n## Quick Start\n\n### 1. Environment Setup\n\nCreate a `.env` file in your project root:\n\n```env\n# Required: Your API key\nOPENAI_API_KEY=\"your-api-key-here\"\n\n# Optional: Specify your preferred model\nDEFAULT_MODEL=\"gpt-4\"\n\n# Optional: For non-OpenAI providers\nBASE_URL=\"https://api.anthropic.com\"  # Example for Claude\n```\n\n### 2. Create Your First Agent\n\n```python\nfrom minigen import Agent\n\n# Create a specialized agent\npirate_agent = Agent(\n    name=\"Captain Sarcasm\",\n    system_prompt=\"You are a sarcastic pirate captain. Answer all questions with sarcasm and pirate slang.\"\n)\n\n# Start chatting\nresponse = pirate_agent.chat(\"How does a computer work?\")\nprint(f\"[{pirate_agent.name}]: {response}\")\n```\n\n## Core Concepts\n\n### Agents\n\nThink of an **Agent** as a specialized AI personality with a specific role. Each agent has:\n- A **name** for identification\n- A **system prompt** that defines its behavior and expertise\n- Optional **tools** for extended capabilities\n- **Memory** of the conversation context\n\n### Tools\n\n**Tools** are Python functions that agents can call to interact with the external world:\n\n```python\nfrom minigen import Agent, tool\n\n@tool(description=\"Convert temperature from Celsius to Fahrenheit\")\ndef celsius_to_fahrenheit(celsius: float) -\u003e float:\n    return (celsius * 9/5) + 32\n\n@tool(description=\"Get current weather for a city\")\ndef get_weather(city: str) -\u003e str:\n    return f\"The weather in {city} is sunny and 25°C\"\n\n# Create agent with tools\nweather_agent = Agent(\n    name=\"Weather Assistant\",\n    system_prompt=\"You help users with weather information and temperature conversions.\",\n    tools=[celsius_to_fahrenheit, get_weather]\n)\n\nresponse = weather_agent.chat(\"What's the weather in London and convert 25°C to Fahrenheit?\")\n```\n\n### Chains\n\n**Chains** execute a sequence of prompts, where each step builds on the previous output:\n\n```python\nfrom minigen import Agent, Chain\n\nagent = Agent()\nresearch_chain = Chain(agent=agent, verbose=True)\n\nresearch_chain \\\n    .add_step(\"Generate a comprehensive technical explanation of {input}\") \\\n    .add_step(\"Simplify the following explanation for a beginner: {input}\") \\\n    .add_step(\"Create a practical example to illustrate: {input}\")\n\nresult = research_chain.run(\"machine learning\")\nprint(result)\n```\n\n### Agent Networks\n\n**Agent Networks** coordinate multiple specialized agents to solve complex problems:\n\n```python\nfrom minigen import Agent, AgentNetwork\n\n# Create specialized agents\nplanner = Agent(\n    name=\"Planner\", \n    system_prompt=\"You excel at breaking down complex tasks into actionable steps.\"\n)\n\nresearcher = Agent(\n    name=\"Researcher\",\n    system_prompt=\"You find accurate information and cite sources.\"\n)\n\nwriter = Agent(\n    name=\"Writer\",\n    system_prompt=\"You create well-structured, engaging content.\"\n)\n\n# Build the network\nnetwork = AgentNetwork()\nnetwork.add_node(planner)\nnetwork.add_node(researcher)\nnetwork.add_node(writer)\n\n# Set up intelligent routing\nfrom minigen import create_llm_router\nrouter = create_llm_router(network.nodes)\nnetwork.set_router(router)\nnetwork.set_entry_point(\"Planner\")\n\n# Execute the workflow\nresult = network.run(\n    \"Write a blog post about the benefits of renewable energy\",\n    max_rounds=8\n)\n```\n\n## Examples\n\n### Example 1: Code Review Agent\n\n```python\nfrom minigen import Agent, tool\nimport ast\n\n@tool(description=\"Analyze Python code for potential issues\")\ndef analyze_code(code: str) -\u003e str:\n    try:\n        ast.parse(code)\n        return \"Code syntax is valid. Ready for detailed review.\"\n    except SyntaxError as e:\n        return f\"Syntax error found: {e}\"\n\ncode_reviewer = Agent(\n    name=\"Code Reviewer\",\n    system_prompt=\"\"\"You are an expert Python developer who reviews code for:\n    - Best practices and conventions (PEP 8)\n    - Performance optimizations\n    - Security vulnerabilities\n    - Code maintainability\n    Provide specific, actionable feedback.\"\"\",\n    tools=[analyze_code]\n)\n\n# Review some code\ncode_to_review = '''\ndef fibonacci(n):\n    if n \u003c= 1:\n        return n\n    return fibonacci(n-1) + fibonacci(n-2)\n'''\n\nreview = code_reviewer.chat(f\"Please review this code:\\n{code_to_review}\")\nprint(review)\n```\n\n### Example 2: Research and Writing Pipeline\n\n```python\nfrom minigen import Agent, AgentNetwork, create_llm_router\n\n# Define specialized agents\nfact_checker = Agent(\n    name=\"FactChecker\",\n    system_prompt=\"You verify information accuracy and find reliable sources.\"\n)\n\ncontent_creator = Agent(\n    name=\"ContentCreator\", \n    system_prompt=\"You create engaging, well-structured content based on verified facts.\"\n)\n\neditor = Agent(\n    name=\"Editor\",\n    system_prompt=\"You polish content for clarity, flow, and professionalism.\"\n)\n\n# Create the pipeline\npipeline = AgentNetwork()\npipeline.add_node(fact_checker)\npipeline.add_node(content_creator)\npipeline.add_node(editor)\n\nrouter = create_llm_router(pipeline.nodes)\npipeline.set_router(router)\npipeline.set_entry_point(\"FactChecker\")\n\n# Generate content\nfinal_content = pipeline.run(\n    \"Create an article about the environmental impact of electric vehicles\",\n    max_rounds=6\n)\n```\n\n### Example 3: Parallel Processing\n\n```python\nfrom minigen import Agent, AgentNetwork, Parallel, create_llm_router\n\n# Create domain experts\ntech_expert = Agent(\n    name=\"TechExpert\",\n    system_prompt=\"You analyze technology trends and innovations.\"\n)\n\nmarket_expert = Agent(\n    name=\"MarketExpert\", \n    system_prompt=\"You analyze market conditions and business implications.\"\n)\n\nsynthesizer = Agent(\n    name=\"Synthesizer\",\n    system_prompt=\"You combine different perspectives into comprehensive insights.\"\n)\n\n# Set up parallel processing\nparallel_analysis = Parallel(\n    name=\"ParallelAnalysis\",\n    agent_names=[\"TechExpert\", \"MarketExpert\"]\n)\n\nnetwork = AgentNetwork()\nnetwork.add_node(tech_expert)\nnetwork.add_node(market_expert)\nnetwork.add_node(synthesizer)\nnetwork.add_node(parallel_analysis)\n\nrouter = create_llm_router(network.nodes)\nnetwork.set_router(router)\nnetwork.set_entry_point(\"ParallelAnalysis\")\n\n# Analyze from multiple perspectives\nanalysis = network.run(\n    \"Analyze the potential impact of quantum computing on the cryptocurrency market\",\n    max_rounds=5\n)\n```\n\n## Advanced Usage\n\n### Custom Routing Logic\n\n```python\nfrom minigen import AgentNetwork, NetworkState\nfrom typing import Optional\n\ndef custom_router(state: NetworkState) -\u003e Optional[str]:\n    last_message = state.messages[-1]\n    \n    # Route based on content keywords\n    content = last_message.get('content', '').lower()\n    \n    if 'research' in content:\n        return \"Researcher\"\n    elif 'write' in content or 'draft' in content:\n        return \"Writer\"\n    elif 'review' in content or 'edit' in content:\n        return \"Editor\"\n    elif 'done' in content or 'complete' in content:\n        return None  # End the workflow\n    \n    return \"Planner\"  # Default fallback\n\nnetwork.set_router(custom_router)\n```\n\n**Parameters:**\n- `name`: Agent identifier\n- `system_prompt`: Instructions that define agent behavior\n- `tools`: List of functions the agent can call\n- `model`: LLM model to use (defaults to environment setting)\n- `max_retries`: Maximum retry attempts for failed requests\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\n- 📚 [Documentation](https://d-ev.space/)\n- 🐛 [Issue Tracker](https://github.com/devdezzies/minigen/issues)\n- 💬 [Discussions](https://github.com/devdezzies/minigen/discussions)\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Built with ❤️ by the MiniGen community**\n\n\u003c/div\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevdezzies%2Fminigen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevdezzies%2Fminigen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevdezzies%2Fminigen/lists"}