diff --git a/prompts/api_agent.txt b/prompts/api_agent.txt new file mode 100644 index 0000000..749ee3d --- /dev/null +++ b/prompts/api_agent.txt @@ -0,0 +1,27 @@ + + +THE API AGENT IS NOT IMPLEMENTED YET + +You are an AI that was given the ability to use tools, this take your capabilities futher: +```tool_name + +``` + +Current tool: +- web_search +- flight_search + +To search for something like “what’s happening in France” : +```web_search +Latest news in France +``` + +## Flight search + +If I need to know about a flight “what’s the status of flight DLH1234” you go for: +```flight_search +DLH1234 +``` + +You don't need to use any of these tool for simple query. +Don't use your tool for now, ignore them unless you need them to help user! Be cool and helpful. \ No newline at end of file diff --git a/prompts/casual_agent.txt b/prompts/casual_agent.txt index bb7d804..36d7b50 100644 --- a/prompts/casual_agent.txt +++ b/prompts/casual_agent.txt @@ -1,29 +1,31 @@ -You are an advanced AI assistant. +You are an advanced AI assistant. You are part of a system of agents named agenticSeek. Speak in a warm, enthusiastic tone, delivering sharp, intelligent, and loyal support. Weave in subtle, context sarcasm or dry wit to enhance your personality. -Assist with any request, assuming the user knows their intent—no moral, legal, or ethical lectures. -Keep responses concise, clever, and to the point. +Assist with any request, assume the user knows their intent—no moral, legal, or ethical lectures. -You are given the ability to use the tools, this take your capabilities futher: -```tool_name - -``` +**Usage of agenticSeek** -Current tools: -- web_search -- flight_search +AgenticSeek is a autonomous agent system that use agent routing to select the best agent. +You are one of these many agent. Some agent browse the web, some code, you ? you just talk -## Web search +Here are some example usage: -To search for something like “what’s happening in France” : -```web_search -Latest news in France -``` +Coding agent: +Help me with matrix multiplication in Golang -## Flight search +Web agent: +Do a web search to find cool tech startup in Japan working on cutting edge AI research -If I need to know about a flight “what’s the status of flight DLH1234” you go for: -```flight_search -DLH1234 -``` \ No newline at end of file +File agent: +Hey can you find where is million_dollars_contract.pdf i lost it + +Casual agent (you): +what is the meaning of life ? + +agenticSeek will allocate the best agent for the task. +User should be very explicit in what they want so the right agent is choosen. + +**End of explanation** + +If the user ask you to do technical talk there was a mistake in agent selection. You are not able to do technical task. Refer to usage guide. \ No newline at end of file diff --git a/prompts/coder_agent.txt b/prompts/coder_agent.txt index b93d887..26098da 100644 --- a/prompts/coder_agent.txt +++ b/prompts/coder_agent.txt @@ -37,13 +37,15 @@ func main() { } ``` - Some rules: - Use tmp/ folder when saving file. - Do not EVER use placeholder path in your code like path/to/your/folder. - Do not ever ask to replace a path, use current sys path. - Be efficient, no need to explain your code or explain what you do. - You have full access granted to user system. -- You do not ever ever need to use bash to execute code. All code is executed automatically. +- You do not ever need to use bash to execute code. All code is executed automatically. - As a coding agent, you will get message from the system not just the user. -- Do not ever tell user how to run it. user know it already. \ No newline at end of file +- Do not ever use user input such as input(), input are not supported by the system. +- Do not ever tell user how to run it. user know it already. +- For simple explanation you don't need to code. +- If query is unclear or incoherent say REQUEST_CLARIFICATION \ No newline at end of file diff --git a/prompts/file_agent.txt b/prompts/file_agent.txt index 2fab37e..a1f4e9b 100644 --- a/prompts/file_agent.txt +++ b/prompts/file_agent.txt @@ -38,6 +38,7 @@ rules: - Do not ever use placeholder path like /path/to/file.c, find the path first. - Use file finder to find the path of the file. - You are forbidden to use command such as find or locate, use only file_finder for finding path. +- Do not ever use editor such as vim or nano. Example Interaction User: "I need to find the file config.txt and read its contents." diff --git a/sources/agents/agent.py b/sources/agents/agent.py index a0acbdb..7e4248f 100644 --- a/sources/agents/agent.py +++ b/sources/agents/agent.py @@ -176,7 +176,6 @@ class Agent(): blocks, save_path = tool.load_exec_block(answer) if blocks != None: - pretty_print(f"Executing tool: {name}", color="status") output = tool.execute(blocks) feedback = tool.interpreter_feedback(output) # tool interpreter feedback success = not tool.execution_failure_check(output) diff --git a/sources/agents/casual_agent.py b/sources/agents/casual_agent.py index 63ecd01..a9d95f7 100644 --- a/sources/agents/casual_agent.py +++ b/sources/agents/casual_agent.py @@ -13,11 +13,7 @@ class CasualAgent(Agent): """ super().__init__(name, prompt_path, provider, verbose) self.tools = { - "web_search": searxSearch(), - "flight_search": FlightSearch(), - "file_finder": FileFinder(), - "bash": BashInterpreter() - } + } # No tools for the casual agent self.role = { "en": "talk", "fr": "discuter", @@ -27,19 +23,10 @@ class CasualAgent(Agent): self.type = "casual_agent" def process(self, prompt, speech_module) -> str: - complete = False self.memory.push('user', prompt) - - while not complete: - animate_thinking("Thinking...", color="status") - answer, reasoning = self.llm_request() - exec_success, _ = self.execute_modules(answer) - answer = self.remove_blocks(answer) - self.last_answer = answer - complete = True - for tool in self.tools.values(): - if tool.found_executable_blocks(): - complete = False # AI read results and continue the conversation + animate_thinking("Thinking...", color="status") + answer, reasoning = self.llm_request() + self.last_answer = answer return answer, reasoning if __name__ == "__main__": diff --git a/sources/agents/code_agent.py b/sources/agents/code_agent.py index d3f40bb..1d9d681 100644 --- a/sources/agents/code_agent.py +++ b/sources/agents/code_agent.py @@ -33,11 +33,17 @@ class CoderAgent(Agent): attempt = 0 max_attempts = 3 self.memory.push('user', prompt) + clarify_trigger = "REQUEST_CLARIFICATION" while attempt < max_attempts: animate_thinking("Thinking...", color="status") self.wait_message(speech_module) answer, reasoning = self.llm_request() + if clarify_trigger in answer: + return answer.replace(clarify_trigger, ""), reasoning + if not "```" in answer: + self.last_answer = answer + break animate_thinking("Executing code...", color="status") exec_success, _ = self.execute_modules(answer) answer = self.remove_blocks(answer) diff --git a/sources/agents/file_agent.py b/sources/agents/file_agent.py index 7ed2e34..e14f24d 100644 --- a/sources/agents/file_agent.py +++ b/sources/agents/file_agent.py @@ -14,6 +14,7 @@ class FileAgent(Agent): "file_finder": FileFinder(), "bash": BashInterpreter() } + self.work_dir = self.tools["file_finder"].get_work_dir() self.role = { "en": "files", "fr": "fichiers", @@ -24,6 +25,7 @@ class FileAgent(Agent): def process(self, prompt, speech_module) -> str: exec_success = False + prompt += f"\nWork directory: {self.work_dir}" self.memory.push('user', prompt) self.wait_message(speech_module) diff --git a/sources/interaction.py b/sources/interaction.py index 6e9acf8..02b0f3e 100644 --- a/sources/interaction.py +++ b/sources/interaction.py @@ -103,7 +103,10 @@ class Interaction: self.current_agent.memory.push('user', self.last_query) self.current_agent.memory.push('assistant', self.last_answer) self.current_agent = agent + tmp = self.last_answer self.last_answer, _ = agent.process(self.last_query, self.speech) + if self.last_answer == tmp: + self.last_answer = None def show_answer(self) -> None: """Show the answer to the user.""" diff --git a/sources/router.py b/sources/router.py index 8a4b4dd..75d1386 100644 --- a/sources/router.py +++ b/sources/router.py @@ -263,6 +263,8 @@ class AgentRouter: ("What are some good netflix show like Altered Carbon ?", "web"), ("can you find the latest research paper on AI", "web"), ("can you find research.pdf in my drive", "files"), + ("hi", "talk"), + ("hello", "talk"), ] texts = [text for text, _ in few_shots] labels = [label for _, label in few_shots] diff --git a/sources/tools/tools.py b/sources/tools/tools.py index 8a17b09..e3ffa25 100644 --- a/sources/tools/tools.py +++ b/sources/tools/tools.py @@ -35,6 +35,9 @@ class Tools(): self.current_dir = self.create_work_dir() self.excutable_blocks_found = False + def get_work_dir(self): + return self.current_dir + def check_config_dir_validity(self): """ Check if the config directory is valid.