trading_agent.tools.write_file_tool
¶
The write_file tool: creates or replaces a file in the desk's own folders.
Typical usage example:
tool = WriteFileTool(policy, checkpoints)
WriteFileArguments
¶
Bases: BaseModel
The arguments of write_file.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
The file; a relative path starts at your desk folder. |
content |
str
|
The complete text to write. |
WriteFileTool
¶
Bases: Tool
Writes a whole file.
Creates the tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy
|
PathPolicy
|
The desk's read and write rules. |
required |
checkpoints
|
Checkpoints | None
|
Snapshots the desk's files before each change, or None to take none. |
None
|
Source code in src/trading_agent/tools/write_file_tool.py
run
async
¶
Writes the file, creating its folders when needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arguments
|
WriteFileArguments
|
The file and its content. |
required |
Returns:
| Type | Description |
|---|---|
ToolResult
|
How much was written, or an error. |