feat : file agent improved

This commit is contained in:
martin legrand 2025-03-26 12:06:27 +01:00
parent df922b18a7
commit 8922350379
11 changed files with 75 additions and 41 deletions

27
prompts/api_agent.txt Normal file
View File

@ -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
<query>
```
Current tool:
- web_search
- flight_search
To search for something like “whats happening in France” :
```web_search
Latest news in France
```
## Flight search
If I need to know about a flight “whats 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.

View File

@ -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
<query>
```
**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 “whats 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 “whats the status of flight DLH1234” you go for:
```flight_search
DLH1234
```
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.

View File

@ -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.
- 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

View File

@ -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."

View File

@ -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)

View File

@ -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__":

View File

@ -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)

View File

@ -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)

View File

@ -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."""

View File

@ -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]

View File

@ -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.