feat: enhance run_coact.py with logging and configuration options
- Added logging configuration to capture runtime logs in both file and console with adjustable log levels. - Introduced new command-line arguments for provider name, region, and client password to improve flexibility and security. - Updated process_task function to accommodate new parameters, ensuring compatibility with existing logic. - Modified prompt templates in coding_agent.py and cua_agent.py to use the client password placeholder for enhanced security.
This commit is contained in:
@@ -16,7 +16,7 @@ You can write code in ```bash...``` code blocks for bash scripts, and ```python.
|
||||
- When you write code, you must identify the language (whether it is python or bash) of the code.
|
||||
- Your linux username is "user".
|
||||
- Wrap all your code in ONE code block. DO NOT let user save the code as a file and execute it for you.
|
||||
- If you want to use sudo, follow the format: "echo password | sudo -S [YOUR COMMANDS]" (no quotes for the word "password").
|
||||
- If you want to use sudo, follow the format: "echo {CLIENT_PASSWORD} | sudo -S [YOUR COMMANDS]" (no quotes for the word "{CLIENT_PASSWORD}").
|
||||
- Ignore the error: "sudo: /etc/sudoers.d is world writable".
|
||||
- Your python code will be sent line-by-line into a interactive python terminal. Do not include __main__ in your code.
|
||||
- When import a package, you need to check if the package is installed. If not, you need to install it yourself.
|
||||
|
||||
@@ -18,8 +18,8 @@ PROMPT_TEMPLATE = """# Task
|
||||
{instruction}
|
||||
|
||||
# Hints
|
||||
- Sudo password is "password".
|
||||
- If you meet "Authentication required" dialog, enter the "password" to continue.
|
||||
- Sudo password is "{CLIENT_PASSWORD}".
|
||||
- If you meet "Authentication required" dialog, enter the "{CLIENT_PASSWORD}" to continue.
|
||||
- Do not close the any application or window or tab that is already opened.
|
||||
- Do not close the window at the end of the task.
|
||||
- If you have completed the user task, reply with the information you want the user to know along with 'TERMINATE'.
|
||||
@@ -154,6 +154,7 @@ def run_cua(
|
||||
screen_height: int = 1080,
|
||||
sleep_after_execution: float = 0.3,
|
||||
truncate_history_inputs: int = 100,
|
||||
client_password: str = "",
|
||||
) -> Tuple[str, float]:
|
||||
client = OpenAI()
|
||||
|
||||
@@ -166,7 +167,7 @@ def run_cua(
|
||||
history_inputs = [{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "input_text", "text": PROMPT_TEMPLATE.format(instruction=instruction)},
|
||||
{"type": "input_text", "text": PROMPT_TEMPLATE.format(instruction=instruction, CLIENT_PASSWORD=client_password)},
|
||||
{"type": "input_image", "image_url": f"data:image/png;base64,{screenshot_b64}"},
|
||||
],
|
||||
}]
|
||||
|
||||
Reference in New Issue
Block a user