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.
uv sync
.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.
# 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
Purpose: CSV data loading, processing, and analysis
Purpose: Emoji content creation and translation
Purpose: Text analysis and content expansion
Purpose: PDF processing and content reformatting
Purpose: Multilingual translation with style preservation
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
final_version.py
: Main application entry point with agent selection logictools.py
: Implementation of all tools used by agentsagents_behaviour.yaml
: Configuration file defining agents and their capabilitiesapicall.py
: OpenAI API integration and embedding generationprompts.py
: Prompt templates for various system interactionsThe system is configured through agents_behaviour.yaml
, which defines:
conversation_history.json
# 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"
agents_behaviour.yaml
tools.py
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
agents_behaviour.yaml
tools.py
final_version.py
.env
Set conversation history to see detailed execution flow in conversation_history.json
This project is available under the MIT License.