write_file

write_file: Write Content to File

Writes 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 request

  • file_path: Path to the file to write

  • content: Text content to write to the file

  • base_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