write_file
write_file
: Write Content to File
write_file
: Write Content to FileWrites content to a file, creating it if it doesn't exist.
def write_file(
agent_name: str,
file_path: str,
content: str,
base_url: str = aios_kernel_url
) -> StorageResponse
Parameters:
agent_name
: Identifier for the agent making the requestfile_path
: Path to the file to writecontent
: Text content to write to the filebase_url
: API endpoint URL
Returns:
StorageResponse
object containing write operation status
Example:
# Write a simple HTML file
html_content = """
<!DOCTYPE html>
<html>
<head>
<title>AIOS Project</title>
</head>
<body>
<h1>Welcome to AIOS</h1>
<p>This is a sample project page.</p>
</body>
</html>
"""
response = write_file(
"web_developer",
"projects/website/index.html",
html_content
)
print(response["response]["response_message"])
Last updated