metis-agent


Namemetis-agent JSON
Version 0.9.5 PyPI version JSON
download
home_pagehttps://github.com/metisos/metisos_agentV1
SummaryA comprehensive framework for building powerful AI agents with enhanced tools, Graph-Enhanced Knowledge Base system with relationship intelligence, local model support (HuggingFace/Ollama), autonomous capability expansion, blueprint opportunity detection, and advanced memory management with knowledge-first processing
upload_time2025-08-09 17:20:41
maintainerNone
docs_urlNone
authorMetis OS Team
requires_python>=3.8
licenseApache License 2.0
keywords ai agent llm openai groq anthropic huggingface ollama local-models transformers tools memory conversation context-management token-aware intelligent-summarization blueprint-detection autonomous-tools dynamic-generation capability-expansion text-analysis sentiment-analysis web-scraping python-execution advanced-math nlp readability-assessment e2b code-sandbox secure-execution cloud-sandbox privacy offline quantization knowledge-base knowledge-management sqlite search categorization tagging import-export cli-management knowledge-first-processing
VCS
bugtrack_url
requirements metis-agent flask flask-cors requests pandas numpy sqlite3 pytest pytest-cov e2b psutil python-dotenv markdown
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Metis Agent

[![PyPI version](https://badge.fury.io/py/metis-agent.svg)](https://badge.fury.io/py/metis-agent)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue)](https://opensource.org/licenses/Apache-2.0)
[![Downloads](https://pepy.tech/badge/metis-agent)](https://pepy.tech/project/metis-agent)

A powerful, modular framework for building AI agents with intelligent memory management and minimal boilerplate code. Metis Agent provides a comprehensive toolkit for creating intelligent agents that can understand user queries, plan and execute complex tasks, and maintain persistent conversations.

**Latest Release: v0.6.0** - Major expansion with secure code execution, advanced tools, and enterprise-grade capabilities.

### What's New in v0.6.0
- **🔒 E2B Code Sandbox** - Secure Python code execution in isolated cloud environments
- **🛠️ 36+ Advanced Tools** - Comprehensive toolkit for development, research, and analysis
- **🔧 Smart Orchestrator** - Intelligent tool selection with parameter extraction
- **📊 Enhanced Analytics** - Advanced memory management with Titans-inspired system
- **🌐 Enterprise Ready** - MCP integration, blueprint system, and production APIs
- **⚡ Performance Optimized** - Improved query analysis and execution strategies
- **🎯 Developer Focused** - Git integration, project management, and automated workflows

## Features

### 🏢 **Core Architecture**
- **Smart Orchestrator**: Intelligent tool selection with parameter extraction and execution strategies
- **Enhanced Memory System**: Titans-inspired adaptive memory with token-aware context management
- **Query Analyzer**: LLM-powered complexity analysis for optimal tool routing
- **Session Management**: Persistent conversations with automatic context preservation

### 🤖 **LLM Integration**
- **Multiple Providers**: OpenAI, Groq, Anthropic, HuggingFace with seamless switching
- **Model Flexibility**: Support for GPT-4, Claude, Llama, Mixtral, and custom models
- **Secure Authentication**: Encrypted API key management with environment fallback

### 🛠️ **Advanced Tool Suite (36+ Tools)**

#### **🔒 Security & Execution**
- **E2B Code Sandbox**: Secure Python execution in isolated cloud environments
- **Bash Tool**: Safe system command execution with output capture

#### **💻 Development Tools**
- **Git Integration**: Complete workflow management (clone, commit, push, merge, etc.)
- **Code Generation**: Multi-language code creation with best practices
- **Unit Test Generator**: Automated test creation with comprehensive coverage
- **Dependency Analyzer**: Project dependency analysis and optimization
- **Project Management**: Full lifecycle management with validation

#### **🔍 Research & Analysis**
- **Deep Research**: Multi-source research with citation management
- **Data Analysis**: Advanced analytics with pandas, numpy, visualization
- **Web Scraper**: Intelligent content extraction with Firecrawl integration
- **Google Search**: Real-time web search with result processing

#### **📝 Content & Communication**
- **Content Generation**: Multi-format content creation (blogs, docs, emails)
- **Text Analyzer**: Advanced NLP analysis with sentiment and entity recognition
- **Blueprint Execution**: Automated workflow and process execution

#### **📁 File & System Operations**
- **File Manager**: Complete file system operations with safety checks
- **Read/Write Tools**: Intelligent file handling with format detection
- **Grep Tool**: Advanced search with regex and pattern matching

### 🌐 **Enterprise Features**
- **MCP Integration**: Model Context Protocol server support
- **Blueprint System**: Workflow automation and process management
- **CLI Interface**: Comprehensive command-line tools for all operations
- **Web API**: RESTful endpoints for integration and automation
- **Memory Analytics**: Real-time performance monitoring and insights
- **Tool Registry**: Dynamic tool discovery and registration system

## Installation

```bash
pip install metis-agent
```

## Starter Templates

Get started quickly with our comprehensive collection of templates and examples:

**[Metis Agent Starter Templates](https://github.com/metis-analytics/metis-starter)** - A complete collection of templates for different use cases:

- **Basic Agent Template** - Simple agent for beginners and quick prototypes
- **Custom Agent Template** - Specialized agents with custom personalities
- **Web App Template** - Flask-based web chat interface
- **Advanced Integration Template** - Enterprise multi-agent systems
- **Custom Tools Template** - Examples for extending agent capabilities
- **Simple Custom Tool Example** - Step-by-step tool development guide

```bash
# Clone the starter templates
git clone https://github.com/metis-analytics/metis-starter.git
cd metis-starter

# Run your first agent
python templates/basic_agent_template.py
```

Each template includes:
- Complete working examples
- Detailed documentation
- Setup instructions
- Customization guides
- Best practices

## Quick Start

### Basic Usage

```python
from metis_agent import SingleAgent

# Create an agent
agent = SingleAgent()

# Process a query
response = agent.process_query("Write a Python function to calculate Fibonacci numbers")
print(response)
```

### Using Different LLM Providers

```python
from metis_agent import SingleAgent, configure_llm

# Configure LLM (OpenAI, Groq, Anthropic, or HuggingFace)
configure_llm("groq", "llama-3.1-8b-instant", "your-api-key")

# Create an agent
agent = SingleAgent()

# Process a query
response = agent.process_query("Explain quantum computing in simple terms")
print(response)
```

### Secure Code Execution with E2B

```python
from metis_agent import SingleAgent

# Create an agent (E2B tool auto-detected)
agent = SingleAgent()

# Execute Python code securely in cloud sandbox
response = agent.process_query("""
Execute this Python code:
```python
import pandas as pd
import matplotlib.pyplot as plt

# Create sample data
data = {'x': [1, 2, 3, 4, 5], 'y': [2, 4, 6, 8, 10]}
df = pd.DataFrame(data)

# Create visualization
plt.figure(figsize=(8, 6))
plt.plot(df['x'], df['y'], marker='o')
plt.title('Sample Data Visualization')
plt.xlabel('X values')
plt.ylabel('Y values')
plt.show()

print(f"Data shape: {df.shape}")
print(df.describe())
```
""")

print(response)
```

### Creating Custom Tools

```python
from metis_agent import SingleAgent, BaseTool, register_tool

class MyCustomTool(BaseTool):
    name = "custom_tool"
    description = "A custom tool for specialized tasks"
    
    def can_handle(self, task):
        return "custom task" in task.lower()
        
    def execute(self, task):
        return f"Executed custom tool on: {task}"

# Register the tool
register_tool("custom_tool", MyCustomTool)

# Create an agent
agent = SingleAgent()

# Process a query
response = agent.process_query("Perform a custom task")
print(response)
```

### Using Titans Memory

```python
from metis_agent import SingleAgent

# Create an agent with Titans memory
agent = SingleAgent(use_titans_memory=True)

# Process queries with memory
result1 = agent.process_query("What is machine learning?", session_id="user123")
result2 = agent.process_query("How does it relate to AI?", session_id="user123")
```

## Command Line Interface

Metis Agent provides a comprehensive command-line interface for all operations:

### Core Commands

```bash
# Interactive chat mode
metis chat

# Run a single query
metis run "Write a Python function to calculate Fibonacci numbers"

# Run with specific LLM provider
metis run "Explain quantum computing" --llm groq --model llama-3.1-8b-instant

# Run with memory enabled
metis run "What did we discuss earlier?" --memory --session-id user123
```

### Agent Management

```bash
# Create a new agent configuration
metis agent create --name "CodeExpert" --personality "Expert programming assistant"

# List all configured agents
metis agent list

# Use a specific agent
metis run "Help me debug this code" --agent CodeExpert

# Delete an agent
metis agent delete CodeExpert
```

### API Key Management

```bash
# Set API keys for different providers
metis auth set-key openai sk-your-openai-key
metis auth set-key groq gsk_your-groq-key
metis auth set-key anthropic your-anthropic-key
metis auth set-key e2b your-e2b-api-key

# List configured API keys (shows providers only, not keys)
metis auth list-keys

# Remove an API key
metis auth remove-key openai

# Test API key connectivity
metis auth test openai
```

### E2B Code Sandbox Setup

```bash
# Set E2B API key for secure code execution
metis auth set-key e2b your-e2b-api-key

# Test E2B connectivity
metis auth test e2b

# Execute code in sandbox via CLI
metis chat "Execute this Python code: print('Hello from E2B sandbox!')"
```

### Tool Management

```bash
# List all available tools
metis tools list

# Get detailed information about a tool
metis tools info CodeGenerationTool

# Test a specific tool
metis tools test CodeGenerationTool "Write a hello world function"

# Enable/disable tools
metis tools enable GoogleSearchTool
metis tools disable FirecrawlTool
```

### Memory Operations

```bash
# Show memory statistics
metis memory stats

# Clear memory for a session
metis memory clear --session-id user123

# Export memory to file
metis memory export --output memory_backup.json

# Import memory from file
metis memory import --input memory_backup.json

# Search memory contents
metis memory search "machine learning"
```

### Web Server

```bash
# Start web server with default settings
metis serve

# Start with custom port and memory enabled
metis serve --port 8080 --memory --cors

# Start with specific agent
metis serve --agent CodeExpert --port 5000

# Start with authentication
metis serve --auth --api-key your-server-api-key
```

### Configuration

```bash
# Configure default LLM provider
metis config set-llm --provider groq --model llama-3.1-8b-instant

# Set default memory settings
metis config set-memory --type titans --path ./memory

# View current configuration
metis config show

# Reset configuration to defaults
metis config reset
```


### Development Tools

```bash
# Run system diagnostics
metis dev diagnose

# Test all components
metis dev test

# Generate development templates
metis dev template --type custom-tool --name MyTool

# Profile agent performance
metis dev profile "Complex query for performance testing"
```

## Web Server

Metis Agent includes a web server for API access:

```bash
# Start the web server
metis serve
```

Then make requests to the API:

```bash
curl -X POST http://localhost:5000/api/query \
  -H "Content-Type: application/json" \
  -d '{"query": "Write a Python function to calculate Fibonacci numbers"}'
```

API Endpoints:

- `GET /` - Server status
- `POST /api/query` - Process a query
- `GET /api/agent-identity` - Get agent information
- `GET /api/memory-insights` - Get memory statistics
- `GET /api/tools` - List available tools

## Detailed Documentation

### Core Components

#### SingleAgent

The main agent class that orchestrates all components:

```python
from metis_agent import SingleAgent

agent = SingleAgent(
    use_titans_memory=False,  # Enable/disable Titans memory
    tools=None,               # Custom tools (uses all available if None)
    llm_provider="openai",    # LLM provider
    llm_model=None,           # LLM model (uses default if None)
    memory_path=None,         # Path to memory database
    task_file=None            # Path to task file
)
```

#### Intent Router

Determines whether a user query is a question or a task:

```python
from metis_agent.core.intent_router import IntentRouter

router = IntentRouter()
intent = router.classify("What is the capital of France?")  # Returns "question"
intent = router.classify("Create a Python script to sort a list")  # Returns "task"
```

#### Task Manager

Manages tasks and their status:

```python
from metis_agent.core.task_manager import TaskManager

task_manager = TaskManager()
task_manager.add_task("Write a function to calculate Fibonacci numbers")
task_manager.mark_complete("Write a function to calculate Fibonacci numbers")
tasks = task_manager.get_all_tasks()
```

#### Memory Systems

SQLite-based memory:

```python
from metis_agent.memory.sqlite_store import SQLiteMemory

memory = SQLiteMemory("memory.db")
memory.store_input("user123", "What is machine learning?")
memory.store_output("user123", "Machine learning is...")
context = memory.get_context("user123")
```

Titans-inspired adaptive memory:

```python
from metis_agent.memory.titans.titans_memory import TitansInspiredMemory

memory = TitansInspiredMemory("memory_dir")
memory.store_memory("Machine learning is...", "ai_concepts")
relevant_memories = memory.retrieve_relevant_memories("What is deep learning?")
```

### LLM Providers

Configure and use different LLM providers:

```python
from metis_agent.core.llm_interface import configure_llm, get_llm

# Configure LLM
configure_llm("openai", "gpt-4o")  # OpenAI
configure_llm("groq", "llama-3.1-8b-instant")  # Groq
configure_llm("anthropic", "claude-3-opus-20240229")  # Anthropic
configure_llm("huggingface", "mistralai/Mixtral-8x7B-Instruct-v0.1")  # HuggingFace

# Get configured LLM
llm = get_llm()
response = llm.chat([{"role": "user", "content": "Hello!"}])
```

### Tools

Available tools (36+ advanced tools):

#### **Security & Execution**
- `E2BCodeSandboxTool`: Secure Python code execution in isolated cloud environments
- `BashTool`: Safe system command execution with output capture

#### **Development & Code**
- `GitIntegrationTool`: Complete Git workflow management
- `CodeGenerationTool`: Multi-language code generation with best practices
- `PythonCodeTool`: Python-specific code analysis and execution
- `UnitTestGeneratorTool`: Automated test creation with comprehensive coverage
- `DependencyAnalyzerTool`: Project dependency analysis and optimization
- `EditTool`: Intelligent code editing with context awareness

#### **Research & Analysis**
- `DeepResearchTool`: Multi-source research with citation management
- `DataAnalysisTool`: Advanced analytics with pandas, numpy, visualization
- `GoogleSearchTool`: Real-time web search with result processing
- `WebScraperTool`: Intelligent content extraction
- `FirecrawlTool`: Advanced web scraping and content analysis
- `TextAnalyzerTool`: NLP analysis with sentiment and entity recognition

#### **Content & Communication**
- `ContentGenerationTool`: Multi-format content creation (blogs, docs, emails)
- `ConversationManagerTool`: Advanced dialogue management

#### **Project & Workflow Management**
- `ProjectManagementTool`: Full project lifecycle management
- `ProjectValidationTool`: Automated project validation and quality checks
- `BlueprintExecutionTool`: Workflow automation and process execution
- `RequirementsAnalysisTool`: Automated requirements gathering and analysis
- `ToolGeneratorTool`: Dynamic tool creation and customization

#### **File & System Operations**
- `FileManagerTool`: Complete file system operations with safety checks
- `FilesystemTool`: Advanced file system navigation and management
- `ReadTool`: Intelligent file reading with format detection
- `WriteTool`: Smart file writing with backup and validation
- `GrepTool`: Advanced search with regex and pattern matching

#### **Mathematical & Scientific**
- `AdvancedMathTool`: Complex mathematical computations and analysis
- `CalculatorTool`: Mathematical calculations with expression parsing

Creating custom tools:

```python
from metis_agent.tools.base import BaseTool
from metis_agent.tools.registry import register_tool

class MyTool(BaseTool):
    name = "my_tool"
    description = "Custom tool for specific tasks"
    
    def can_handle(self, task):
        # Determine if this tool can handle the task
        return "specific task" in task.lower()
        
    def execute(self, task):
        # Execute the task
        return f"Task executed: {task}"

# Register the tool
register_tool("my_tool", MyTool)
```

### API Key Management

Secure storage and retrieval of API keys:

```python
from metis_agent.auth.api_key_manager import APIKeyManager

key_manager = APIKeyManager()
key_manager.set_key("openai", "your-api-key")
api_key = key_manager.get_key("openai")
services = key_manager.list_services()
```

## Testing

Run the comprehensive test suite:

```bash
# Run system tests
python metis_agent/test_system.py

# Run CLI tests
python metis_agent/test_cli.py
```

## Advanced Usage

### Session Management

Maintain context across multiple interactions:

```python
agent = SingleAgent()

# First query
response1 = agent.process_query(
    "What are the main types of machine learning?",
    session_id="user123"
)

# Follow-up query (uses context from first query)
response2 = agent.process_query(
    "Can you explain supervised learning in more detail?",
    session_id="user123"
)
```

### Tool Selection

Specify which tool to use for a query:

```python
agent = SingleAgent()

# Use a specific tool
response = agent.process_query(
    "Generate a Python function to sort a list",
    tool_name="CodeGenerationTool"
)
```

### Memory Insights

Get insights about the agent's memory:

```python
agent = SingleAgent(use_titans_memory=True)

# Process some queries
agent.process_query("What is machine learning?", session_id="user123")
agent.process_query("Explain neural networks", session_id="user123")

# Get memory insights
insights = agent.get_memory_insights()
print(insights)
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

## Contact & Links

- **PyPI Package**: [https://pypi.org/project/metis-agent/](https://pypi.org/project/metis-agent/)
- **Starter Templates**: [https://github.com/metis-analytics/metis-starter](https://github.com/metis-analytics/metis-starter)
- **Documentation**: [https://github.com/metis-analytics/metis-agent/wiki](https://github.com/metis-analytics/metis-agent/wiki)
- **Issues & Support**: [https://github.com/metis-analytics/metis-agent/issues](https://github.com/metis-analytics/metis-agent/issues)
- **Discussions**: [https://github.com/metis-analytics/metis-agent/discussions](https://github.com/metis-analytics/metis-agent/discussions)

---

<p align="center">
  <strong>Metis Agent - Building Intelligent AI Systems</strong>
</p>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/metisos/metisos_agentV1",
    "name": "metis-agent",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ai, agent, llm, openai, groq, anthropic, huggingface, ollama, local-models, transformers, tools, memory, conversation, context-management, token-aware, intelligent-summarization, blueprint-detection, autonomous-tools, dynamic-generation, capability-expansion, text-analysis, sentiment-analysis, web-scraping, python-execution, advanced-math, nlp, readability-assessment, e2b, code-sandbox, secure-execution, cloud-sandbox, privacy, offline, quantization, knowledge-base, knowledge-management, sqlite, search, categorization, tagging, import-export, cli-management, knowledge-first-processing",
    "author": "Metis OS Team",
    "author_email": "cjohnson@metisos.com",
    "download_url": "https://files.pythonhosted.org/packages/e4/f0/1453ebaf73c8fc06feb25ce318badd100a5d26a39f08f61476bdfbfe84d7/metis_agent-0.9.5.tar.gz",
    "platform": null,
    "description": "# Metis Agent\r\n\r\n[![PyPI version](https://badge.fury.io/py/metis-agent.svg)](https://badge.fury.io/py/metis-agent)\r\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\r\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue)](https://opensource.org/licenses/Apache-2.0)\r\n[![Downloads](https://pepy.tech/badge/metis-agent)](https://pepy.tech/project/metis-agent)\r\n\r\nA powerful, modular framework for building AI agents with intelligent memory management and minimal boilerplate code. Metis Agent provides a comprehensive toolkit for creating intelligent agents that can understand user queries, plan and execute complex tasks, and maintain persistent conversations.\r\n\r\n**Latest Release: v0.6.0** - Major expansion with secure code execution, advanced tools, and enterprise-grade capabilities.\r\n\r\n### What's New in v0.6.0\r\n- **\ud83d\udd12 E2B Code Sandbox** - Secure Python code execution in isolated cloud environments\r\n- **\ud83d\udee0\ufe0f 36+ Advanced Tools** - Comprehensive toolkit for development, research, and analysis\r\n- **\ud83d\udd27 Smart Orchestrator** - Intelligent tool selection with parameter extraction\r\n- **\ud83d\udcca Enhanced Analytics** - Advanced memory management with Titans-inspired system\r\n- **\ud83c\udf10 Enterprise Ready** - MCP integration, blueprint system, and production APIs\r\n- **\u26a1 Performance Optimized** - Improved query analysis and execution strategies\r\n- **\ud83c\udfaf Developer Focused** - Git integration, project management, and automated workflows\r\n\r\n## Features\r\n\r\n### \ud83c\udfe2 **Core Architecture**\r\n- **Smart Orchestrator**: Intelligent tool selection with parameter extraction and execution strategies\r\n- **Enhanced Memory System**: Titans-inspired adaptive memory with token-aware context management\r\n- **Query Analyzer**: LLM-powered complexity analysis for optimal tool routing\r\n- **Session Management**: Persistent conversations with automatic context preservation\r\n\r\n### \ud83e\udd16 **LLM Integration**\r\n- **Multiple Providers**: OpenAI, Groq, Anthropic, HuggingFace with seamless switching\r\n- **Model Flexibility**: Support for GPT-4, Claude, Llama, Mixtral, and custom models\r\n- **Secure Authentication**: Encrypted API key management with environment fallback\r\n\r\n### \ud83d\udee0\ufe0f **Advanced Tool Suite (36+ Tools)**\r\n\r\n#### **\ud83d\udd12 Security & Execution**\r\n- **E2B Code Sandbox**: Secure Python execution in isolated cloud environments\r\n- **Bash Tool**: Safe system command execution with output capture\r\n\r\n#### **\ud83d\udcbb Development Tools**\r\n- **Git Integration**: Complete workflow management (clone, commit, push, merge, etc.)\r\n- **Code Generation**: Multi-language code creation with best practices\r\n- **Unit Test Generator**: Automated test creation with comprehensive coverage\r\n- **Dependency Analyzer**: Project dependency analysis and optimization\r\n- **Project Management**: Full lifecycle management with validation\r\n\r\n#### **\ud83d\udd0d Research & Analysis**\r\n- **Deep Research**: Multi-source research with citation management\r\n- **Data Analysis**: Advanced analytics with pandas, numpy, visualization\r\n- **Web Scraper**: Intelligent content extraction with Firecrawl integration\r\n- **Google Search**: Real-time web search with result processing\r\n\r\n#### **\ud83d\udcdd Content & Communication**\r\n- **Content Generation**: Multi-format content creation (blogs, docs, emails)\r\n- **Text Analyzer**: Advanced NLP analysis with sentiment and entity recognition\r\n- **Blueprint Execution**: Automated workflow and process execution\r\n\r\n#### **\ud83d\udcc1 File & System Operations**\r\n- **File Manager**: Complete file system operations with safety checks\r\n- **Read/Write Tools**: Intelligent file handling with format detection\r\n- **Grep Tool**: Advanced search with regex and pattern matching\r\n\r\n### \ud83c\udf10 **Enterprise Features**\r\n- **MCP Integration**: Model Context Protocol server support\r\n- **Blueprint System**: Workflow automation and process management\r\n- **CLI Interface**: Comprehensive command-line tools for all operations\r\n- **Web API**: RESTful endpoints for integration and automation\r\n- **Memory Analytics**: Real-time performance monitoring and insights\r\n- **Tool Registry**: Dynamic tool discovery and registration system\r\n\r\n## Installation\r\n\r\n```bash\r\npip install metis-agent\r\n```\r\n\r\n## Starter Templates\r\n\r\nGet started quickly with our comprehensive collection of templates and examples:\r\n\r\n**[Metis Agent Starter Templates](https://github.com/metis-analytics/metis-starter)** - A complete collection of templates for different use cases:\r\n\r\n- **Basic Agent Template** - Simple agent for beginners and quick prototypes\r\n- **Custom Agent Template** - Specialized agents with custom personalities\r\n- **Web App Template** - Flask-based web chat interface\r\n- **Advanced Integration Template** - Enterprise multi-agent systems\r\n- **Custom Tools Template** - Examples for extending agent capabilities\r\n- **Simple Custom Tool Example** - Step-by-step tool development guide\r\n\r\n```bash\r\n# Clone the starter templates\r\ngit clone https://github.com/metis-analytics/metis-starter.git\r\ncd metis-starter\r\n\r\n# Run your first agent\r\npython templates/basic_agent_template.py\r\n```\r\n\r\nEach template includes:\r\n- Complete working examples\r\n- Detailed documentation\r\n- Setup instructions\r\n- Customization guides\r\n- Best practices\r\n\r\n## Quick Start\r\n\r\n### Basic Usage\r\n\r\n```python\r\nfrom metis_agent import SingleAgent\r\n\r\n# Create an agent\r\nagent = SingleAgent()\r\n\r\n# Process a query\r\nresponse = agent.process_query(\"Write a Python function to calculate Fibonacci numbers\")\r\nprint(response)\r\n```\r\n\r\n### Using Different LLM Providers\r\n\r\n```python\r\nfrom metis_agent import SingleAgent, configure_llm\r\n\r\n# Configure LLM (OpenAI, Groq, Anthropic, or HuggingFace)\r\nconfigure_llm(\"groq\", \"llama-3.1-8b-instant\", \"your-api-key\")\r\n\r\n# Create an agent\r\nagent = SingleAgent()\r\n\r\n# Process a query\r\nresponse = agent.process_query(\"Explain quantum computing in simple terms\")\r\nprint(response)\r\n```\r\n\r\n### Secure Code Execution with E2B\r\n\r\n```python\r\nfrom metis_agent import SingleAgent\r\n\r\n# Create an agent (E2B tool auto-detected)\r\nagent = SingleAgent()\r\n\r\n# Execute Python code securely in cloud sandbox\r\nresponse = agent.process_query(\"\"\"\r\nExecute this Python code:\r\n```python\r\nimport pandas as pd\r\nimport matplotlib.pyplot as plt\r\n\r\n# Create sample data\r\ndata = {'x': [1, 2, 3, 4, 5], 'y': [2, 4, 6, 8, 10]}\r\ndf = pd.DataFrame(data)\r\n\r\n# Create visualization\r\nplt.figure(figsize=(8, 6))\r\nplt.plot(df['x'], df['y'], marker='o')\r\nplt.title('Sample Data Visualization')\r\nplt.xlabel('X values')\r\nplt.ylabel('Y values')\r\nplt.show()\r\n\r\nprint(f\"Data shape: {df.shape}\")\r\nprint(df.describe())\r\n```\r\n\"\"\")\r\n\r\nprint(response)\r\n```\r\n\r\n### Creating Custom Tools\r\n\r\n```python\r\nfrom metis_agent import SingleAgent, BaseTool, register_tool\r\n\r\nclass MyCustomTool(BaseTool):\r\n    name = \"custom_tool\"\r\n    description = \"A custom tool for specialized tasks\"\r\n    \r\n    def can_handle(self, task):\r\n        return \"custom task\" in task.lower()\r\n        \r\n    def execute(self, task):\r\n        return f\"Executed custom tool on: {task}\"\r\n\r\n# Register the tool\r\nregister_tool(\"custom_tool\", MyCustomTool)\r\n\r\n# Create an agent\r\nagent = SingleAgent()\r\n\r\n# Process a query\r\nresponse = agent.process_query(\"Perform a custom task\")\r\nprint(response)\r\n```\r\n\r\n### Using Titans Memory\r\n\r\n```python\r\nfrom metis_agent import SingleAgent\r\n\r\n# Create an agent with Titans memory\r\nagent = SingleAgent(use_titans_memory=True)\r\n\r\n# Process queries with memory\r\nresult1 = agent.process_query(\"What is machine learning?\", session_id=\"user123\")\r\nresult2 = agent.process_query(\"How does it relate to AI?\", session_id=\"user123\")\r\n```\r\n\r\n## Command Line Interface\r\n\r\nMetis Agent provides a comprehensive command-line interface for all operations:\r\n\r\n### Core Commands\r\n\r\n```bash\r\n# Interactive chat mode\r\nmetis chat\r\n\r\n# Run a single query\r\nmetis run \"Write a Python function to calculate Fibonacci numbers\"\r\n\r\n# Run with specific LLM provider\r\nmetis run \"Explain quantum computing\" --llm groq --model llama-3.1-8b-instant\r\n\r\n# Run with memory enabled\r\nmetis run \"What did we discuss earlier?\" --memory --session-id user123\r\n```\r\n\r\n### Agent Management\r\n\r\n```bash\r\n# Create a new agent configuration\r\nmetis agent create --name \"CodeExpert\" --personality \"Expert programming assistant\"\r\n\r\n# List all configured agents\r\nmetis agent list\r\n\r\n# Use a specific agent\r\nmetis run \"Help me debug this code\" --agent CodeExpert\r\n\r\n# Delete an agent\r\nmetis agent delete CodeExpert\r\n```\r\n\r\n### API Key Management\r\n\r\n```bash\r\n# Set API keys for different providers\r\nmetis auth set-key openai sk-your-openai-key\r\nmetis auth set-key groq gsk_your-groq-key\r\nmetis auth set-key anthropic your-anthropic-key\r\nmetis auth set-key e2b your-e2b-api-key\r\n\r\n# List configured API keys (shows providers only, not keys)\r\nmetis auth list-keys\r\n\r\n# Remove an API key\r\nmetis auth remove-key openai\r\n\r\n# Test API key connectivity\r\nmetis auth test openai\r\n```\r\n\r\n### E2B Code Sandbox Setup\r\n\r\n```bash\r\n# Set E2B API key for secure code execution\r\nmetis auth set-key e2b your-e2b-api-key\r\n\r\n# Test E2B connectivity\r\nmetis auth test e2b\r\n\r\n# Execute code in sandbox via CLI\r\nmetis chat \"Execute this Python code: print('Hello from E2B sandbox!')\"\r\n```\r\n\r\n### Tool Management\r\n\r\n```bash\r\n# List all available tools\r\nmetis tools list\r\n\r\n# Get detailed information about a tool\r\nmetis tools info CodeGenerationTool\r\n\r\n# Test a specific tool\r\nmetis tools test CodeGenerationTool \"Write a hello world function\"\r\n\r\n# Enable/disable tools\r\nmetis tools enable GoogleSearchTool\r\nmetis tools disable FirecrawlTool\r\n```\r\n\r\n### Memory Operations\r\n\r\n```bash\r\n# Show memory statistics\r\nmetis memory stats\r\n\r\n# Clear memory for a session\r\nmetis memory clear --session-id user123\r\n\r\n# Export memory to file\r\nmetis memory export --output memory_backup.json\r\n\r\n# Import memory from file\r\nmetis memory import --input memory_backup.json\r\n\r\n# Search memory contents\r\nmetis memory search \"machine learning\"\r\n```\r\n\r\n### Web Server\r\n\r\n```bash\r\n# Start web server with default settings\r\nmetis serve\r\n\r\n# Start with custom port and memory enabled\r\nmetis serve --port 8080 --memory --cors\r\n\r\n# Start with specific agent\r\nmetis serve --agent CodeExpert --port 5000\r\n\r\n# Start with authentication\r\nmetis serve --auth --api-key your-server-api-key\r\n```\r\n\r\n### Configuration\r\n\r\n```bash\r\n# Configure default LLM provider\r\nmetis config set-llm --provider groq --model llama-3.1-8b-instant\r\n\r\n# Set default memory settings\r\nmetis config set-memory --type titans --path ./memory\r\n\r\n# View current configuration\r\nmetis config show\r\n\r\n# Reset configuration to defaults\r\nmetis config reset\r\n```\r\n\r\n\r\n### Development Tools\r\n\r\n```bash\r\n# Run system diagnostics\r\nmetis dev diagnose\r\n\r\n# Test all components\r\nmetis dev test\r\n\r\n# Generate development templates\r\nmetis dev template --type custom-tool --name MyTool\r\n\r\n# Profile agent performance\r\nmetis dev profile \"Complex query for performance testing\"\r\n```\r\n\r\n## Web Server\r\n\r\nMetis Agent includes a web server for API access:\r\n\r\n```bash\r\n# Start the web server\r\nmetis serve\r\n```\r\n\r\nThen make requests to the API:\r\n\r\n```bash\r\ncurl -X POST http://localhost:5000/api/query \\\r\n  -H \"Content-Type: application/json\" \\\r\n  -d '{\"query\": \"Write a Python function to calculate Fibonacci numbers\"}'\r\n```\r\n\r\nAPI Endpoints:\r\n\r\n- `GET /` - Server status\r\n- `POST /api/query` - Process a query\r\n- `GET /api/agent-identity` - Get agent information\r\n- `GET /api/memory-insights` - Get memory statistics\r\n- `GET /api/tools` - List available tools\r\n\r\n## Detailed Documentation\r\n\r\n### Core Components\r\n\r\n#### SingleAgent\r\n\r\nThe main agent class that orchestrates all components:\r\n\r\n```python\r\nfrom metis_agent import SingleAgent\r\n\r\nagent = SingleAgent(\r\n    use_titans_memory=False,  # Enable/disable Titans memory\r\n    tools=None,               # Custom tools (uses all available if None)\r\n    llm_provider=\"openai\",    # LLM provider\r\n    llm_model=None,           # LLM model (uses default if None)\r\n    memory_path=None,         # Path to memory database\r\n    task_file=None            # Path to task file\r\n)\r\n```\r\n\r\n#### Intent Router\r\n\r\nDetermines whether a user query is a question or a task:\r\n\r\n```python\r\nfrom metis_agent.core.intent_router import IntentRouter\r\n\r\nrouter = IntentRouter()\r\nintent = router.classify(\"What is the capital of France?\")  # Returns \"question\"\r\nintent = router.classify(\"Create a Python script to sort a list\")  # Returns \"task\"\r\n```\r\n\r\n#### Task Manager\r\n\r\nManages tasks and their status:\r\n\r\n```python\r\nfrom metis_agent.core.task_manager import TaskManager\r\n\r\ntask_manager = TaskManager()\r\ntask_manager.add_task(\"Write a function to calculate Fibonacci numbers\")\r\ntask_manager.mark_complete(\"Write a function to calculate Fibonacci numbers\")\r\ntasks = task_manager.get_all_tasks()\r\n```\r\n\r\n#### Memory Systems\r\n\r\nSQLite-based memory:\r\n\r\n```python\r\nfrom metis_agent.memory.sqlite_store import SQLiteMemory\r\n\r\nmemory = SQLiteMemory(\"memory.db\")\r\nmemory.store_input(\"user123\", \"What is machine learning?\")\r\nmemory.store_output(\"user123\", \"Machine learning is...\")\r\ncontext = memory.get_context(\"user123\")\r\n```\r\n\r\nTitans-inspired adaptive memory:\r\n\r\n```python\r\nfrom metis_agent.memory.titans.titans_memory import TitansInspiredMemory\r\n\r\nmemory = TitansInspiredMemory(\"memory_dir\")\r\nmemory.store_memory(\"Machine learning is...\", \"ai_concepts\")\r\nrelevant_memories = memory.retrieve_relevant_memories(\"What is deep learning?\")\r\n```\r\n\r\n### LLM Providers\r\n\r\nConfigure and use different LLM providers:\r\n\r\n```python\r\nfrom metis_agent.core.llm_interface import configure_llm, get_llm\r\n\r\n# Configure LLM\r\nconfigure_llm(\"openai\", \"gpt-4o\")  # OpenAI\r\nconfigure_llm(\"groq\", \"llama-3.1-8b-instant\")  # Groq\r\nconfigure_llm(\"anthropic\", \"claude-3-opus-20240229\")  # Anthropic\r\nconfigure_llm(\"huggingface\", \"mistralai/Mixtral-8x7B-Instruct-v0.1\")  # HuggingFace\r\n\r\n# Get configured LLM\r\nllm = get_llm()\r\nresponse = llm.chat([{\"role\": \"user\", \"content\": \"Hello!\"}])\r\n```\r\n\r\n### Tools\r\n\r\nAvailable tools (36+ advanced tools):\r\n\r\n#### **Security & Execution**\r\n- `E2BCodeSandboxTool`: Secure Python code execution in isolated cloud environments\r\n- `BashTool`: Safe system command execution with output capture\r\n\r\n#### **Development & Code**\r\n- `GitIntegrationTool`: Complete Git workflow management\r\n- `CodeGenerationTool`: Multi-language code generation with best practices\r\n- `PythonCodeTool`: Python-specific code analysis and execution\r\n- `UnitTestGeneratorTool`: Automated test creation with comprehensive coverage\r\n- `DependencyAnalyzerTool`: Project dependency analysis and optimization\r\n- `EditTool`: Intelligent code editing with context awareness\r\n\r\n#### **Research & Analysis**\r\n- `DeepResearchTool`: Multi-source research with citation management\r\n- `DataAnalysisTool`: Advanced analytics with pandas, numpy, visualization\r\n- `GoogleSearchTool`: Real-time web search with result processing\r\n- `WebScraperTool`: Intelligent content extraction\r\n- `FirecrawlTool`: Advanced web scraping and content analysis\r\n- `TextAnalyzerTool`: NLP analysis with sentiment and entity recognition\r\n\r\n#### **Content & Communication**\r\n- `ContentGenerationTool`: Multi-format content creation (blogs, docs, emails)\r\n- `ConversationManagerTool`: Advanced dialogue management\r\n\r\n#### **Project & Workflow Management**\r\n- `ProjectManagementTool`: Full project lifecycle management\r\n- `ProjectValidationTool`: Automated project validation and quality checks\r\n- `BlueprintExecutionTool`: Workflow automation and process execution\r\n- `RequirementsAnalysisTool`: Automated requirements gathering and analysis\r\n- `ToolGeneratorTool`: Dynamic tool creation and customization\r\n\r\n#### **File & System Operations**\r\n- `FileManagerTool`: Complete file system operations with safety checks\r\n- `FilesystemTool`: Advanced file system navigation and management\r\n- `ReadTool`: Intelligent file reading with format detection\r\n- `WriteTool`: Smart file writing with backup and validation\r\n- `GrepTool`: Advanced search with regex and pattern matching\r\n\r\n#### **Mathematical & Scientific**\r\n- `AdvancedMathTool`: Complex mathematical computations and analysis\r\n- `CalculatorTool`: Mathematical calculations with expression parsing\r\n\r\nCreating custom tools:\r\n\r\n```python\r\nfrom metis_agent.tools.base import BaseTool\r\nfrom metis_agent.tools.registry import register_tool\r\n\r\nclass MyTool(BaseTool):\r\n    name = \"my_tool\"\r\n    description = \"Custom tool for specific tasks\"\r\n    \r\n    def can_handle(self, task):\r\n        # Determine if this tool can handle the task\r\n        return \"specific task\" in task.lower()\r\n        \r\n    def execute(self, task):\r\n        # Execute the task\r\n        return f\"Task executed: {task}\"\r\n\r\n# Register the tool\r\nregister_tool(\"my_tool\", MyTool)\r\n```\r\n\r\n### API Key Management\r\n\r\nSecure storage and retrieval of API keys:\r\n\r\n```python\r\nfrom metis_agent.auth.api_key_manager import APIKeyManager\r\n\r\nkey_manager = APIKeyManager()\r\nkey_manager.set_key(\"openai\", \"your-api-key\")\r\napi_key = key_manager.get_key(\"openai\")\r\nservices = key_manager.list_services()\r\n```\r\n\r\n## Testing\r\n\r\nRun the comprehensive test suite:\r\n\r\n```bash\r\n# Run system tests\r\npython metis_agent/test_system.py\r\n\r\n# Run CLI tests\r\npython metis_agent/test_cli.py\r\n```\r\n\r\n## Advanced Usage\r\n\r\n### Session Management\r\n\r\nMaintain context across multiple interactions:\r\n\r\n```python\r\nagent = SingleAgent()\r\n\r\n# First query\r\nresponse1 = agent.process_query(\r\n    \"What are the main types of machine learning?\",\r\n    session_id=\"user123\"\r\n)\r\n\r\n# Follow-up query (uses context from first query)\r\nresponse2 = agent.process_query(\r\n    \"Can you explain supervised learning in more detail?\",\r\n    session_id=\"user123\"\r\n)\r\n```\r\n\r\n### Tool Selection\r\n\r\nSpecify which tool to use for a query:\r\n\r\n```python\r\nagent = SingleAgent()\r\n\r\n# Use a specific tool\r\nresponse = agent.process_query(\r\n    \"Generate a Python function to sort a list\",\r\n    tool_name=\"CodeGenerationTool\"\r\n)\r\n```\r\n\r\n### Memory Insights\r\n\r\nGet insights about the agent's memory:\r\n\r\n```python\r\nagent = SingleAgent(use_titans_memory=True)\r\n\r\n# Process some queries\r\nagent.process_query(\"What is machine learning?\", session_id=\"user123\")\r\nagent.process_query(\"Explain neural networks\", session_id=\"user123\")\r\n\r\n# Get memory insights\r\ninsights = agent.get_memory_insights()\r\nprint(insights)\r\n```\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request.\r\n\r\n1. Fork the repository\r\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\r\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\r\n4. Push to the branch (`git push origin feature/amazing-feature`)\r\n5. Open a Pull Request\r\n\r\n## License\r\n\r\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Contact & Links\r\n\r\n- **PyPI Package**: [https://pypi.org/project/metis-agent/](https://pypi.org/project/metis-agent/)\r\n- **Starter Templates**: [https://github.com/metis-analytics/metis-starter](https://github.com/metis-analytics/metis-starter)\r\n- **Documentation**: [https://github.com/metis-analytics/metis-agent/wiki](https://github.com/metis-analytics/metis-agent/wiki)\r\n- **Issues & Support**: [https://github.com/metis-analytics/metis-agent/issues](https://github.com/metis-analytics/metis-agent/issues)\r\n- **Discussions**: [https://github.com/metis-analytics/metis-agent/discussions](https://github.com/metis-analytics/metis-agent/discussions)\r\n\r\n---\r\n\r\n<p align=\"center\">\r\n  <strong>Metis Agent - Building Intelligent AI Systems</strong>\r\n</p>\r\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "A comprehensive framework for building powerful AI agents with enhanced tools, Graph-Enhanced Knowledge Base system with relationship intelligence, local model support (HuggingFace/Ollama), autonomous capability expansion, blueprint opportunity detection, and advanced memory management with knowledge-first processing",
    "version": "0.9.5",
    "project_urls": {
        "Bug Tracker": "https://github.com/metisos/metisos_agentV1/issues",
        "Documentation": "https://github.com/metisos/metisos_agentV1/blob/main/DOCUMENTATION.md",
        "Homepage": "https://github.com/metisos/metisos_agentV1",
        "Source Code": "https://github.com/metisos/metisos_agentV1"
    },
    "split_keywords": [
        "ai",
        " agent",
        " llm",
        " openai",
        " groq",
        " anthropic",
        " huggingface",
        " ollama",
        " local-models",
        " transformers",
        " tools",
        " memory",
        " conversation",
        " context-management",
        " token-aware",
        " intelligent-summarization",
        " blueprint-detection",
        " autonomous-tools",
        " dynamic-generation",
        " capability-expansion",
        " text-analysis",
        " sentiment-analysis",
        " web-scraping",
        " python-execution",
        " advanced-math",
        " nlp",
        " readability-assessment",
        " e2b",
        " code-sandbox",
        " secure-execution",
        " cloud-sandbox",
        " privacy",
        " offline",
        " quantization",
        " knowledge-base",
        " knowledge-management",
        " sqlite",
        " search",
        " categorization",
        " tagging",
        " import-export",
        " cli-management",
        " knowledge-first-processing"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "19264c66e3595b9ffe3bfeb51d0d178d52df447dace07a28b2ab4a9b6d8f0143",
                "md5": "0fcd55074234594b54ae3ae13cc77723",
                "sha256": "2c14e398910ebeb848b07e3634c90771b87eb172026b98e9a0bc3c995a128eca"
            },
            "downloads": -1,
            "filename": "metis_agent-0.9.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0fcd55074234594b54ae3ae13cc77723",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 517115,
            "upload_time": "2025-08-09T17:20:38",
            "upload_time_iso_8601": "2025-08-09T17:20:38.995455Z",
            "url": "https://files.pythonhosted.org/packages/19/26/4c66e3595b9ffe3bfeb51d0d178d52df447dace07a28b2ab4a9b6d8f0143/metis_agent-0.9.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e4f01453ebaf73c8fc06feb25ce318badd100a5d26a39f08f61476bdfbfe84d7",
                "md5": "06a72d05489223a027cace9a54f00f90",
                "sha256": "795e20d1fd4842b73be65ff32b1590bb62d5a2d9707921dd35d6a5104432a60d"
            },
            "downloads": -1,
            "filename": "metis_agent-0.9.5.tar.gz",
            "has_sig": false,
            "md5_digest": "06a72d05489223a027cace9a54f00f90",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 454624,
            "upload_time": "2025-08-09T17:20:41",
            "upload_time_iso_8601": "2025-08-09T17:20:41.464873Z",
            "url": "https://files.pythonhosted.org/packages/e4/f0/1453ebaf73c8fc06feb25ce318badd100a5d26a39f08f61476bdfbfe84d7/metis_agent-0.9.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-09 17:20:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "metisos",
    "github_project": "metisos_agentV1",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "metis-agent",
            "specs": []
        },
        {
            "name": "flask",
            "specs": []
        },
        {
            "name": "flask-cors",
            "specs": []
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.31.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.24.0"
                ]
            ]
        },
        {
            "name": "sqlite3",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "7.4.0"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    ">=",
                    "4.1.0"
                ]
            ]
        },
        {
            "name": "e2b",
            "specs": [
                [
                    ">=",
                    "0.1.0"
                ]
            ]
        },
        {
            "name": "psutil",
            "specs": [
                [
                    ">=",
                    "5.9.0"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "markdown",
            "specs": [
                [
                    ">=",
                    "3.4.0"
                ]
            ]
        }
    ],
    "lcname": "metis-agent"
}
        
Elapsed time: 1.21022s