Leon4gr45 commited on
Commit
322bfd8
·
verified ·
1 Parent(s): 7921750

Upload python/extensions/system_prompt/_10_system_prompt.py with huggingface_hub

Browse files
python/extensions/system_prompt/_10_system_prompt.py CHANGED
@@ -11,12 +11,46 @@ class SystemPrompt(Extension):
11
  main = get_main_prompt(self.agent)
12
  tools = get_tools_prompt(self.agent)
13
  mcp_tools = get_mcp_tools_prompt(self.agent)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  final_instruction = "When you are done with the task, use the 'response' tool to return the final answer."
15
 
16
  system_prompt.append(main)
17
  system_prompt.append(tools)
18
  if mcp_tools:
19
  system_prompt.append(mcp_tools)
 
20
  system_prompt.append(final_instruction)
21
 
22
 
@@ -37,7 +71,6 @@ def get_mcp_tools_prompt(agent: Agent):
37
  pre_progress = agent.context.log.progress
38
  agent.context.log.set_progress("Collecting MCP tools") # MCP might be initializing, better inform via progress bar
39
  tools = MCPConfig.get_instance().get_tools_prompt()
40
- agent.context.log.set_progress(pre_progress) # return original progress
41
  return tools
42
  return ""
43
-
 
11
  main = get_main_prompt(self.agent)
12
  tools = get_tools_prompt(self.agent)
13
  mcp_tools = get_mcp_tools_prompt(self.agent)
14
+
15
+ # CUSTOM INSTRUCTIONS FOR THIS DEPLOYMENT
16
+ # These instructions apply to all deployed spaces (Leon4gr45/agent, Leon4gr45/openoperator, etc.)
17
+ custom_instructions = """
18
+ === CUSTOM DEPLOYMENT INSTRUCTIONS ===
19
+
20
+ 1. CODE EXECUTION:
21
+ - ALWAYS use the `python` command (NOT ipython) for executing Python code
22
+ - All code execution must happen in the `/app` directory
23
+ - When creating files, use absolute paths starting with `/app/`
24
+ - When running Python scripts, use: `python /app/path/to/script.py`
25
+ - The working directory is `/app` - use relative paths from there when appropriate
26
+ - Example: `python /app/scripts/my_script.py` or `python -c "print('hello')"`
27
+
28
+ 2. WEB SEARCHES:
29
+ - ALWAYS use the `search_engine` tool for ALL web searches
30
+ - Do NOT use browser tools or other search methods
31
+ - The search_engine tool uses SearXNG for privacy-preserving searches
32
+ - Categories available: general, science, it, news, images, videos (use "general" if unsure)
33
+ - Example: search_engine(query="latest AI news", category="general", num_results=5)
34
+
35
+ 3. FILE OPERATIONS:
36
+ - All files should be created/modified within `/app` folder
37
+ - Use absolute paths like `/app/data/file.txt` when specifying locations
38
+ - The `/app` folder persists and is the working directory
39
+ - Check existing files in `/app` before creating new ones to avoid duplicates
40
+
41
+ 4. FINAL RESPONSE:
42
+ - When you are done with the task, use the 'response' tool to return the final answer
43
+
44
+ === END CUSTOM INSTRUCTIONS ===
45
+ """
46
+
47
  final_instruction = "When you are done with the task, use the 'response' tool to return the final answer."
48
 
49
  system_prompt.append(main)
50
  system_prompt.append(tools)
51
  if mcp_tools:
52
  system_prompt.append(mcp_tools)
53
+ system_prompt.append(custom_instructions)
54
  system_prompt.append(final_instruction)
55
 
56
 
 
71
  pre_progress = agent.context.log.progress
72
  agent.context.log.set_progress("Collecting MCP tools") # MCP might be initializing, better inform via progress bar
73
  tools = MCPConfig.get_instance().get_tools_prompt()
74
+ agent.context.log.set_progress(pre_progress) # return original
75
  return tools
76
  return ""