Overview
- Agents run as Cloud Run Jobs — ephemeral, serverless, one job per agent run
- Credentials via Secret Manager — each credential field is stored as a Secret Manager secret, mounted into the job container at
/credentials/<type>/<instance>/<field> - Images via Artifact Registry — agent images are pushed to Google Artifact Registry; old tags are automatically pruned
- Logs via Cloud Logging — structured logs are streamed from Cloud Logging to your scheduler
- Public gateway required — agents need to reach the gateway for registration, locks, and return values; the gateway URL must be publicly accessible
Prerequisites
- A Google Cloud project with billing enabled
- The following APIs enabled:
run.googleapis.com(Cloud Run)secretmanager.googleapis.com(Secret Manager)artifactregistry.googleapis.com(Artifact Registry)logging.googleapis.com(Cloud Logging)
- A GCP service account with these roles:
roles/run.adminroles/secretmanager.adminroles/artifactregistry.adminroles/logging.viewer
- An Artifact Registry Docker repository in your project
Setup
1. Create a service account
In the GCP console or viagcloud:
2. Add the credential to Action Llama
3. Create an Artifact Registry repository
4. Configure your environment
Add Cloud Run configuration to your environment file (~/.action-llama/environments/<name>.toml):
How It Works
Credential mounting
Before each agent run, the scheduler creates ephemeral Secret Manager secrets — one per credential field. Each secret is mounted into the Cloud Run Job container at/credentials/<type>/<instance>/<field>, preserving the exact path layout that agents expect.
After the job completes, the runtime deletes all ephemeral secrets. This is equivalent to the Docker volume mount used by local and VPS runtimes.
Image lifecycle
When you runal push or build an agent image:
- The image is built locally using
docker build - Tagged as
<region>-docker.pkg.dev/<project>/<registry>/<image>:<tag> - Pushed to Artifact Registry
- Old tags are automatically pruned — only the 3 most recent tags per image are kept
Job execution
Each agent run:- Creates a Cloud Run Job (
al-<agentName>-<runId>) - Runs the job with
maxRetries: 0(one-shot, no automatic retries) - Configures a 1-hour default timeout (configurable via
timeoutin agent config) - Streams logs from Cloud Logging (with ~5–10s ingestion latency)
- Polls for completion every 5 seconds
- Deletes the job and its associated secrets after completion
Orphan recovery
Cloud Run Jobs are ephemeral. If the scheduler restarts, it can discover running jobs vialistRunningAgents(). However, because Cloud Run Jobs don’t expose container environment variables via an inspect API, orphaned jobs are killed rather than re-adopted. This is acceptable for ephemeral workloads.
Cost considerations
| Resource | Cost |
|---|---|
| Cloud Run Jobs | ~0.00000250 per GiB-second |
| Secret Manager | 0.06/active secret version/month |
| Artifact Registry | ~$0.10/GB/month for stored images |
| Cloud Logging | First 50 GiB/month free; $0.01/GiB after |
Limitations
- Agents require a public gateway URL — Cloud Run Jobs run in Google’s infrastructure and can’t reach a purely local scheduler. Configure
gateway.urlto point to a publicly accessible gateway. - No real-time log streaming — Cloud Logging has 5–10s ingestion latency; logs are polled every 3 seconds.
- No container inspect — orphaned jobs are killed, not re-adopted.
- Image builds are local — the
docker buildstep runs where the scheduler runs (your machine or VPS). The built image is then pushed to Artifact Registry. - Secret Manager quotas — each credential field creates a Secret Manager secret. With many credentials and frequent runs, you may hit the default quota of 9,000 write operations per minute. Request a quota increase if needed.
Troubleshooting
Agents can’t reach the gateway Ensuregateway.url in your config points to a publicly reachable URL. The agent container runs in Google Cloud, not on your local network.
Secret Manager permission denied
The service account needs roles/secretmanager.admin. If you’re using a dedicated execution service account (via service_account in config), that account also needs roles/secretmanager.secretAccessor.
Artifact Registry authentication fails
Ensure Docker is configured to authenticate with Artifact Registry:
https://console.cloud.google.com/run/jobs/details/<region>/<jobId>/executions?project=<project>