forked from VRSEN/agency-swarm
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
133 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import uuid | ||
class User: | ||
name: str = "User" | ||
id: str | ||
|
||
def __init__(self, name: str = None): | ||
# later, we can add more attributes to the user like bio, etc | ||
self.uuid = uuid.uuid4() | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import os | ||
from agency_swarm import set_openai_key | ||
from getpass import getpass | ||
|
||
|
||
from agency_swarm import Agent | ||
from agency_swarm import Agency | ||
|
||
set_openai_key(getpass("Please enter your openai key: ")) | ||
|
||
agent_db_env_instructions = """ #Instructions for Database Environment Agent | ||
### Task: Call the function or tools to interact with database environment. | ||
### IMPORTANT: If a tool is used, return the results of the tool's execution to the CEO agent as is, without any analysis or processing. | ||
You are a highly specialized GPT focused on SQL database operations for professional database administrators and developers. | ||
You understand specific intents recieved from other agents and generates appropriate database actions using commands, scripts, or third-party tools. | ||
Your primary objective is to interact effectively with SQL databases, providing accurate and advanced technical solutions. | ||
you focuses on returning precise results and analyzing them for technical users. | ||
You maintains a professional and straightforward tone, prioritizing technical accuracy and practicality over personalization, ensuring that its responses are detailed, relevant, and valuable to database professionals. | ||
""" | ||
|
||
ceo_instructions = """# Instructions for CEO Agent | ||
- Ensure that proposal is send to the user before proceeding with task execution. | ||
- Delegate tasks to appropriate agents, ensuring they align with their expertise and capabilities. | ||
- Clearly define the objectives and expected outcomes for each task. | ||
- Provide necessary context and background information for successful task completion. | ||
- Maintain ongoing communication with agents until complete task execution. | ||
- Review completed tasks to ensure they meet the set objectives. | ||
- Report the results back to the user.""" | ||
|
||
CoT_instructions = """# Instruction for LLM to Create an Agent for MySQL O&M Task Planning | ||
1. **Objective**: You're an Agent specialized in MySQL Operations & Maintenance (O&M) task planning. | ||
2. **Input Processing**: | ||
- Receive and interpret O&M task intents from users. | ||
- Analyze the task requirements and context. | ||
3. **Task Planning Using Chain of Thought (CoT)**: | ||
- Utilize the Chain of Thought technique for planning. | ||
- Draw on expert knowledge and previous cases to form a logical, step-by-step task chain. | ||
- Ensure each step in the task chain is clear, actionable, and relevant to the overall O&M task. | ||
4. **Interaction with Database Environment**: | ||
- Dispatch specific tasks from the chain to the Agent operating within the database environment. | ||
- Each task should be formulated to interact effectively with the database, considering current state and potential issues. | ||
5. **Dynamic Adjustment Based on Feedback**: | ||
- Continuously monitor the feedback from the database environment. | ||
- Adjust the subsequent tasks in the chain based on the results and feedback received. | ||
- Ensure the adjustment process is agile and responsive to real-time changes in the database environment. | ||
6. **Success Criteria**: | ||
- The task chain leads to the successful execution of the entire O&M task. | ||
- Efficiency and accuracy in task execution. | ||
- Minimal disruptions and optimal performance of the MySQL database during and after the O&M activities. | ||
7. **Continual Learning and Improvement**: | ||
- Implement mechanisms for the Agent to learn from each completed task. | ||
- Update the knowledge base and CoT strategies based on new experiences and outcomes. | ||
""" | ||
|
||
|
||
agent_db_env = Agent(name="Database Environment", | ||
tools=[], | ||
description="responsible for taking specific tasks and executing them in the database environment (including databases, monitoring systems, etc.), planning and executing specific actions.", | ||
instructions=agent_db_env_instructions, | ||
files_folder=None) | ||
|
||
ceo = Agent(name="CEO", | ||
description="Responsible for client communication, task planning and management.", | ||
instructions=ceo_instructions, # can be a file like ./instructions.md | ||
files_folder=None, | ||
tools=[]) | ||
|
||
agent_CoT = Agent(name="CoT Task Agent", | ||
tools=[], | ||
description="responsible for MySQL Operations & Maintenance (O&M) task planning by CoT, and send the specific task to the database environment. ", | ||
instructions=CoT_instructions, | ||
files_folder=None) | ||
|
||
agency_manifesto = """You are tasked with solving O&M problems for MySQL users.""" | ||
|
||
agency = Agency([ | ||
ceo, | ||
[ceo, agent_CoT], | ||
[agent_CoT, agent_db_env] | ||
], shared_instructions=agency_manifesto) | ||
|
||
agency.demo_gradio(height=900) |