agents.ai

Agents Manager

An intelligent multi-agent system that automatically selects the best agent and tool sequence to handle user queries. The system uses semantic similarity to match user requests with specialized agents, each equipped with specific tools for different tasks.

Features

Quick Start

Prerequisites

Installation

  1. Install dependencies:
    uv sync
    
  2. Environment setup: Create a .env file with your OpenAI configuration:
     OPENAI_API_KEY=your_api_key_here
     BASE_URL_OPENAI= "https://api.openai.com/v1"
     MODEL_NAME= "gpt-4o"
     EMBEDDING_MODEL_NAME ="text-embedding-3-large"
    

    See apicall.py for configuration details.

  3. Run the application:
    # Using UV
    uv run final_version.py
       
    # Or activate the environment and run directly
    source .venv/bin/activate  # or .venv\Scripts\activate on Windows
    python final_version.py
    

How It Works

Flow

Core Workflow

  1. User Query Processing: The system receives and processes user input
  2. Agent Selection: Uses semantic similarity to find the most relevant agent
  3. Tool Sequence Planning: Determines the optimal sequence of tools to use
  4. Tool Execution: Executes tools in sequence, passing context between them
  5. Result Generation: Provides comprehensive results to the user

List of Agents and Tools

Agents and Tools

Available Agents

1. CSVDataAgent

Purpose: CSV data loading, processing, and analysis

2. EmojiWriter

Purpose: Emoji content creation and translation

3. TextSummarizer

Purpose: Text analysis and content expansion

4. PDFContentWriter

Purpose: PDF processing and content reformatting

5. TranslatorAgent

Purpose: Multilingual translation with style preservation

Architecture Overview

Query Processing Flow

Query to Seq

Tool Execution

Tools Calling

Flow Diagram

flowchart TD
    subgraph UserInteraction
        A[User] -->|"Enter Query"| B[process_user_query]
    end
    
    subgraph AgentSelection
        B -->|"Store in"| C[ConversationHistory]
        B -->|"Find relevant"| D[find_relevant_agents]
        D -->|"Uses"| E[CosineSimilarityCalculator]
        D -->|"Returns"| F[Top Agent]
    end
    
    subgraph ToolSelection
        F -->|"Input to"| G[determine_tool_sequence]
        G -->|"Tool sequence"| H[Tool Execution Loop]
    end
    
    subgraph ToolExecution
        H -->|"For each tool"| I[gather_tool_inputs]
        I -->|"Inputs for"| J[execute_tool]
        J -->|"Store results"| K[Results Dictionary]
        K -->|"Generate"| L[create_results_summary]
    end

    subgraph DataFlow
        C -.->|"Context for"| I
        C -.->|"Store outputs"| J
        J -.->|"Provide context"| I
    end
    
    subgraph ToolImplementations
        J -->|"Uses"| T1[DataframeLoader]
        J -->|"Uses"| T2[ContentExtractor]
        J -->|"Uses"| T3[EmojiTranslator]
        J -->|"Uses"| T4[EmojiMixer]
        J -->|"Uses"| T5[KeypointExtractor]
        J -->|"Uses"| T6[ContentExpander]
        J -->|"Uses"| T7[TextExtractor]
        J -->|"Uses"| T8[ContentReformatter]
        J -->|"Uses"| T9[MultilingualTranslator]
        J -->|"Uses"| T10[StylePreserver]
    end
    
    subgraph Embedding
        B -.->|"Prepare agents"| Z[generate_agent_embeddings]
        Z -.->|"Creates"| Y[agents_with_embeddings]
        D -.->|"Uses"| Y
    end
    
    L -->|"Display"| A

    style A fill:#f9f,stroke:#333,stroke-width:2px
    style F fill:#bbf,stroke:#333,stroke-width:2px
    style J fill:#bfb,stroke:#333,stroke-width:2px
    style L fill:#ffb,stroke:#333,stroke-width:2px

Key Components

Core Files

Configuration

The system is configured through agents_behaviour.yaml, which defines:

Conversation Management

Example Usage

# Example queries the system can handle:

# CSV Data Analysis
"Load the earthquake.csv file and show me the top 10 earthquakes by magnitude"

# Content Translation
"Translate this text to Spanish: 'Hello, how are you today?'"

# PDF Processing
"Extract text from my resume.pdf and reformat it as a LinkedIn summary"

# Emoji Content
"Convert this sentence to emojis: 'I love sunny days at the beach'"

# Text Summarization
"Extract key points from this article and expand them into a full summary"

Technical Details

Dependencies

Similarity Threshold

Extensibility

Development

Project Structure

agents_manager/
├── final_version.py          # Main application
├── tools.py                  # Tool implementations
├── agents_behaviour.yaml     # Agent configuration
├── apicall.py               # OpenAI integration
├── prompts.py               # Prompt templates
├── pyproject.toml           # Project dependencies
├── docs/                    # Documentation
├── images/                  # Flow diagrams
└── tool/                    # Additional tool scripts

Adding New Agents

  1. Define agent in agents_behaviour.yaml
  2. Implement tools in tools.py
  3. Update tool mapping in final_version.py
  4. Test with relevant queries

Troubleshooting

Common Issues

Debug Mode

Set conversation history to see detailed execution flow in conversation_history.json

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add your agent/tool implementation
  4. Update documentation
  5. Submit a pull request

License

This project is available under the MIT License.