Skip to main content

An enhanced version of minion-agent with extended capabilities

Project description

Documentation Status Install Discord Twitter Follow

Minion Agent

A simple agent framework that's capable of browser use + mcp + auto instrument + plan + deep research + more

🎬 Demo Videos

Installation

pip install minion-agent-x

Or from source

git clone git@github.com:femto/minion-agent.git
cd minion-agent
pip install -e .

Usage

Here's a simple example of how to use Minion Agent:

from minion_agent import MinionAgent, AgentConfig, AgentFramework
from dotenv import load_dotenv
import os

load_dotenv()
async def main():
    # Configure the agent
    agent_config = AgentConfig(
        model_id=os.environ.get("AZURE_DEPLOYMENT_NAME"),
        name="research_assistant",
        description="A helpful research assistant",
        model_args={"azure_endpoint": os.environ.get("AZURE_OPENAI_ENDPOINT"),
                    "api_key": os.environ.get("AZURE_OPENAI_API_KEY"),
                    "api_version": os.environ.get("OPENAI_API_VERSION"),
                    },
        model_type="AzureOpenAIServerModel",  # use "AzureOpenAIServerModel" for auzre, use "OpenAIServerModel" for openai, use "LiteLLMModel" for litellm
    )

    agent = await MinionAgent.create(AgentFramework.SMOLAGENTS, agent_config)

    # Run the agent with a question
    result = agent.run("What are the latest developments in AI?")
    print("Agent's response:", result)
import asyncio
asyncio.run(main())

see example.py see example_browser_use.py see example_with_managed_agents.py see example_deep_research.py see example_reason.py

Configuration

The AgentConfig class accepts the following parameters:

  • model_id: The ID of the model to use (e.g., "gpt-4")
  • name: Name of the agent (default: "Minion")
  • description: Optional description of the agent
  • instructions: Optional system instructions for the agent
  • tools: List of tools the agent can use
  • model_args: Optional dictionary of model-specific arguments
  • agent_args: Optional dictionary of agent-specific arguments

MCP Tool Support

Minion Agent supports Model Context Protocol (MCP) tools. Here's how to use them:

Standard MCP Tool

from minion_agent.config import MCPTool

agent_config = AgentConfig(
    # ... other config options ...
    tools=[
        "minion_agent.tools.browser_tool.browser",  # Regular tools
        MCPTool(
            command="npx",
            args=["-y", "@modelcontextprotocol/server-filesystem", "/path/to/workspace"]
        )  # MCP tool
    ]
)

SSE-based MCP Tool

You can also use MCP tools over Server-Sent Events (SSE). This is useful for connecting to remote MCP servers:

from minion_agent.config import MCPTool

agent_config = AgentConfig(
    # ... other config options ...
    tools=[
        MCPTool({"url": "http://localhost:8000/sse"}),  # SSE-based tool
    ]
)

⚠️ Security Warning: When using MCP servers over SSE, be extremely cautious and only connect to trusted and verified servers. Always verify the source and security of any MCP server before connecting.

You can also use multiple MCP tools together:

tools=[
    MCPTool(command="npx", args=["..."]),  # Standard MCP tool
    MCPTool({"url": "http://localhost:8000/sse"}),  # SSE-based tool
    MCPTool({"url": "http://localhost:8001/sse"})   # Another SSE-based tool
]

Planning Support

You can enable automatic planning by setting the planning_interval in agent_args:

agent_config = AgentConfig(
    # ... other config options ...
    agent_args={
        "planning_interval": 3,  # Agent will create a plan every 3 steps
        "additional_authorized_imports": "*"
    }
)

The planning_interval parameter determines how often the agent should create a new plan. When set to 3, the agent will:

  1. Create an initial plan for the task
  2. Execute 3 steps according to the plan
  3. Re-evaluate and create a new plan based on progress
  4. Repeat until the task is complete

Environment Variables

Make sure to set up your environment variables in a .env file:

OPENAI_API_KEY=your_api_key_here

Development

To set up for development:

# Clone the repository
git clone https://github.com/yourusername/minion-agent.git
cd minion-agent

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

Deep Research

See Deep Research Documentation for usage instructions.

Community

Join our WeChat discussion group to connect with other users and get help:

WeChat Discussion Group

群聊: minion-agent讨论群

License

MIT License

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

minion_agent_x-0.1.4.tar.gz (715.0 kB view details)

Uploaded Source

Built Distribution

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

minion_agent_x-0.1.4-py3-none-any.whl (89.2 kB view details)

Uploaded Python 3

File details

Details for the file minion_agent_x-0.1.4.tar.gz.

File metadata

  • Download URL: minion_agent_x-0.1.4.tar.gz
  • Upload date:
  • Size: 715.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for minion_agent_x-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d0e3a391596e712b434e6cd66b2ec5fc44bd79619d71a91f73f38b13906b6c36
MD5 6d6f356ccc1d4344ad27e06d41c77bd8
BLAKE2b-256 81be5d8b6ab05ea50196543bab9719ad4456c689d1012d46cd2cc4acf32a48a6

See more details on using hashes here.

File details

Details for the file minion_agent_x-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: minion_agent_x-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 89.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for minion_agent_x-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a270d9dafbc0614cf5ebbd27593a474e054a281d35f034bcb8e3a16cad29eb3f
MD5 776d6b73b85a57470b283c321826eae0
BLAKE2b-256 39f5ec5522abd8579f9ece5e0be96def9124fffa896c5684b0276ee9310b9188

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