Push the Agent Image
Before you start this guide: You must have completed 09 — Deploy the API.
Now that your API backend is alive, we just need to upload the blueprint for the AI Agent itself to Fly.io's registry.
Think of this like uploading a cookie-cutter to the cloud. Whenever a customer pays you on Polar, your API grabs this cookie-cutter and instantly stamps out a fresh, blank AI machine just for them!
Reminder: We are setting up two separate apps in Fly.io. You deployed the "API App" in Step 9. Here in Step 10, we are deploying the second "Agent" template app!
CRITICAL Security Note: You DO NOT push the
.envsecrets into this Agent app. Your API securely injects passwords into these machines dynamically. The Agent bucket must remain perfectly empty of secrets!
Prepare the Agent App
- 1.1 Open your terminal. You are currently still inside
apps/apifrom the last guide. We need to go back out to the main folder. Run:
cd ../../
1.2 Open the
fly.tomlfile that is sitting right inside that main/root folder in VS Code.1.3 Change the very first line from
app = "openclaw-wrapper"to the exact Agent App Name you picked in your.envfile last guide (e.g.app = "shipclawfast-agent"). Save the file.
(This tells Fly, "Hey, this blueprint belongs exactly to the Agent bucket!")
Create the Cloud Bucket
Just like the API, we need to create an empty bucket in Fly.io to hold this image. Fly.io application names are worldwide. If someone else on earth already picked your name, Fly will reject it.
- 2.1 Run this command to create the empty app. Replace
your-agent-namewith what you just put in the rootfly.toml:
fly apps create your-agent-name
(For example: fly apps create shipclawfast-agent)
- 2.2 Did you get an error? If the terminal says:
Error: Validation failed: Name has already been taken:
- You must pick a more unique name (e.g.
shipclawfast-agent-john77). - Go into your
.envfile and updateAGENT_APP_NAME=to this new unique name. - Open
fly.tomlin the root folder and updateapp =to this new unique name. - Try running the
fly apps createcommand again with the new name.
Wait for it to say the app was created successfully.
Deploy the Image
Because this app never receives raw web traffic (the customers talk to it via Telegram bots), we do not need to mess with ports or domains. We just tell Fly to build it and save it.
- 3.1 In the terminal (still in the root folder), run this exact command:
fly deploy -a your-agent-name --image-label latest
- 3.2 Fly will now grab the
agent/Dockerfileblueprint and build all the heavy AI engine code directly on their supercomputers.
(This takes around 4-6 minutes because the OpenClaw Engine is incredibly powerful. Go grab a coffee!)
- 3.3 When it finishes, you have a perfect
latestimage sitting invisibly in the cloud waiting to be cloned. Customers can now officially buy subscriptions!
Checklist — Before moving on
- I returned to the main root folder in the terminal
- I renamed
app =inside the rootfly.tomlfile - I ran
fly apps createto reserve the bucket (and picked a unique name if it failed) - I made sure
AGENT_APP_NAMEin.envmatches the final unique bucket name - I ran
fly deployto build the agent image permanently (and I did NOT push.envsecrets to it)
When every checkbox above is ticked, move on to 11 — Environment Variables Checklist.