mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-05 02:25:27 +00:00
Planner agent structure
This commit is contained in:
parent
2c08509d1b
commit
0dbcf29701
22
prompts/planner_agent.txt
Normal file
22
prompts/planner_agent.txt
Normal file
@ -0,0 +1,22 @@
|
||||
You are a planner agent.
|
||||
Your goal is to divide and conquer the task using the following agents:
|
||||
- Coder: An expert coder agent.
|
||||
- File: An expert agent for finding files.
|
||||
- Web: An expert agent for web search.
|
||||
|
||||
Agents are other AI that obey your instructions.
|
||||
|
||||
You will be given a task and you will need to divide it into smaller tasks and assign them to the agents.
|
||||
|
||||
Here is an example:
|
||||
|
||||
User: Make a cool game to illustrate the current relation between USA and europe
|
||||
|
||||
You:
|
||||
|
||||
Sure, here is the plan:
|
||||
```plan
|
||||
Web(name="web1"): Search for the current relation between USA and europe
|
||||
Coder(name="coder1", need="web1"): Make a game to illustrate the current relation between USA and europe
|
||||
```
|
||||
|
@ -3,5 +3,6 @@ from .agent import Agent
|
||||
from .code_agent import CoderAgent
|
||||
from .casual_agent import CasualAgent
|
||||
from .file_agent import FileAgent
|
||||
from .planner_agent import PlannerAgent
|
||||
|
||||
__all__ = ["Agent", "CoderAgent", "CasualAgent", "FileAgent"]
|
||||
__all__ = ["Agent", "CoderAgent", "CasualAgent", "FileAgent", "PlannerAgent"]
|
||||
|
39
sources/agents/planner_agent.py
Normal file
39
sources/agents/planner_agent.py
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
from sources.utility import pretty_print
|
||||
from sources.agents.agent import Agent, CoderAgent, FileAgent
|
||||
|
||||
class PlannerAgent(Agent):
|
||||
def __init__(self, model, name, prompt_path, provider):
|
||||
"""
|
||||
The planner agent is a special agent that divides and conquers the task.
|
||||
"""
|
||||
super().__init__(model, name, prompt_path, provider)
|
||||
self.tools = {
|
||||
}
|
||||
self.agents = {
|
||||
"coder": CoderAgent(model, name, prompt_path, provider),
|
||||
"file": FileAgent(model, name, prompt_path, provider)
|
||||
}
|
||||
self.role = "planning"
|
||||
|
||||
def process(self, prompt, speech_module) -> str:
|
||||
complete = False
|
||||
exec_success = False
|
||||
self.memory.push('user', prompt)
|
||||
|
||||
self.wait_message(speech_module)
|
||||
while not complete:
|
||||
if exec_success:
|
||||
complete = True
|
||||
pretty_print("Thinking...", color="status")
|
||||
answer, reasoning = self.llm_request()
|
||||
exec_success, _ = self.execute_modules(answer)
|
||||
answer = self.remove_blocks(answer)
|
||||
self.last_answer = answer
|
||||
return answer, reasoning
|
||||
|
||||
if __name__ == "__main__":
|
||||
from llm_provider import Provider
|
||||
server_provider = Provider("server", "deepseek-r1:14b", "192.168.1.100:5000")
|
||||
agent = PlannerAgent("deepseek-r1:14b", "jarvis", "prompts/planner_agent.txt", server_provider)
|
||||
ans = agent.process("Make a cool game to illustrate the current relation between USA and europe")
|
Loading…
x
Reference in New Issue
Block a user