Skip to content

Commit e281825

Browse files
Clarify tool documentation for agent usage
Co-authored-by: construct-agent <noreply@construct.sh>
1 parent d4887ac commit e281825

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

backend/tool/codeact/edit_file.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Returns an object indicating success and details about changes made:
4747
- To move code: Use two diffs (one to delete from original (empty "new") + one to insert at new location (empty "old"))
4848
- To delete code: Use empty string for "new" property
4949
- **File path validation**: Always use absolute paths (starting with "/")
50+
- **Escape sequences**: You need to ensure that the "old" and "new" text are properly escaped to match the file content exactly e.g if the file contains "Starting Agent Runtime...\\n", you need to ensure that you match that in the old text.
5051
5152
## When to use
5253
- Refactoring code (changing variables, updating functions)

backend/tool/codeact/print.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
const printDescription = `
1111
## Description
1212
The print function outputs values from your CodeAct JavaScript program back to you. It serves as a communication channel to display information during code execution, helping with debugging, monitoring program state, and returning computation results.
13-
Unlike console.log() which writes to the standard output stream, print specifically communicates back to the agent, ensuring the output is visible in the conversation. ALWAYS use print instead of console.log().
13+
Unlike console.log() which writes to the standard output stream, print specifically communicates back to the agent, ensuring the output is visible in the conversation. ALWAYS use print instead of console.log(). The user will not see the output of print statements, only you will.
1414
1515
## Parameters
1616
- **value** (*any*, required): The value to output. Can be any JavaScript value:
@@ -24,6 +24,7 @@ The print function returns undefined. It's used for its side effect of displayin
2424
2525
## CRITICAL REQUIREMENTS
2626
- **Always use print instead of console.log()**: Unlike console.log(), print is specifically designed to communicate back to you.
27+
- **The user will not see the output of print statements, only you will**: You should not use it to communicate results to the user.
2728
- **Large Data**: Very large objects or strings might be truncated in the output
2829
- **Performance**: Excessive printing of large objects may impact performance
2930
- **Complex Objects**: Consider whether you need the entire object printed or just specific properties

0 commit comments

Comments
 (0)