An elegant script using the google-genai SDK allows you to orchestrate and execute code remotely. The Python script within your snippet generates the sequence, handles the file operations, and reads back the results.
Here is the complete Python script you can use to run this interaction:
Python
from google import genai
Initialize the client
client = genai.Client()
Create and execute the interaction with the agent
interaction = client.interactions.create(
agent=“antigravity-preview-05-2026”,
input=(
"Write a Python script that generates the first 20 Fibonacci numbers "
“and saves them to fibonacci.txt. Then read the file and print its contents.”
),
environment=“remote”,
)
Output the results from the remote execution
print(f"Interaction ID: {interaction.id}“)
print(f"Environment ID: {interaction.environment_id}”)
print(f"Output:\n{interaction.output_text}")
Expected Output Structure
When you execute this code, the interaction.output_text returned by the agent will typically resemble the following text:
The first 20 Fibonacci numbers have been generated, saved to fibonacci.txt, and verified.
File Contents:
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181]
Would you like to explore how to retrieve files generated in this remote environment, or should we modify the prompt to handle more complex data processing?