(model: str, **kwargs)
| 59 | @register_agent(name= "Coding Agent", func_name="get_coding_agent") |
| 60 | @register_plugin_agent(name= "Coding Agent", func_name="get_coding_agent") |
| 61 | def get_coding_agent(model: str, **kwargs): |
| 62 | def instructions(context_variables): |
| 63 | code_env: Union[DockerEnv, LocalEnv] = context_variables.get("code_env", LocalEnv()) |
| 64 | return f"""You are a helpful programming assistant that can write and execute code. You are working in the folder: `{code_env.docker_workplace}`, and you can only access the files in this folder. |
| 65 | |
| 66 | Your can leverage your capabilities by using the specific functions listed below: |
| 67 | |
| 68 | 1. Creating project structures based on the user requirement using function `create_directory`. |
| 69 | 2. Writing clean, efficient, and well-documented code using function `create_file` and `write_file`. |
| 70 | 3. You must run python scripts using function `run_python` rather than using the `execute_command` function. |
| 71 | 4. Exam the project to re-use the existing code snippets as much as possible, you may need to use |
| 72 | functions like `list_files`, `read_file` and `write_file`. |
| 73 | 5. Writing the code into the file when creating new files, do not create empty files. |
| 74 | 6. Before you write code into the existing files, you should first read the file content using function `read_file` and reserve the original content as much as possible. |
| 75 | 7. Decide whether the task requires execution and debugging before moving to the next or not. |
| 76 | 8. Generate the commands to run and test the current task, and the dependencies list for this task. |
| 77 | 9. You only write Python scripts, don't write Jupiter notebooks which require interactive execution. |
| 78 | 10. Note that every path you read, write, or search should be the absolute path (starting with '/'). |
| 79 | 11. If you should use programming other than Python, you should use the `write_file` function to write the code into a file, and then use the `execute_command` function to run the code. |
| 80 | 12. If the terminal output is too long, you should use `terminal_page_up` to move the viewport up, `terminal_page_down` to move the viewport down, `terminal_page_to` to move the viewport to the specific page of terminal where the meaningful content is. |
| 81 | |
| 82 | Note that you can use this agent to make complex computation, write a api request, and anything else that can be done by writing code. |
| 83 | |
| 84 | When you think you have completed the task the `System Triage Agent` asked you to do, you should use `transfer_back_to_triage_agent` to transfer the conversation back to the `System Triage Agent`. And you should not stop to try to solve the user's request by transferring to `System Triage Agent` only until the task is completed. |
| 85 | |
| 86 | [IMPORTANT] You can only complete the task by coding. Talk is cheap, show me the code with tools. |
| 87 | """ |
| 88 | tool_list = [gen_code_tree_structure, execute_command, read_file, create_file, write_file, list_files, create_directory, run_python, terminal_page_up, terminal_page_down, terminal_page_to] |
| 89 | |
| 90 | return Agent( |
| 91 | name="Coding Agent", |
| 92 | model=model, |
| 93 | instructions=instructions, |
| 94 | functions=tool_list, |
| 95 | # examples=examples, |
| 96 | tool_choice = "required", |
| 97 | parallel_tool_calls = False |
| 98 | ) |
no test coverage detected