lamia-cloud¶
Run Lamia scripts in the cloud with the same .lm workflow you use locally.
lamia-cloud currently supports GCP and gives you:
- one-time cloud execution with
--remote - cloud scheduling with Cloud Scheduler
- Cloud Run Job execution with logs in Cloud Logging
- event-driven triggers (see Triggers)
Installation¶
Configuration¶
Add a cloud section to your project's config.yaml:
| Field | Required | Description |
|---|---|---|
provider |
yes | Cloud provider (gcp) |
project_id |
yes | Your GCP project ID |
location |
yes | Region for scheduling and execution (e.g. us-central1) |
Authentication¶
lamia-cloud uses Application Default Credentials. Authenticate once:
One-time Cloud Run (--remote)¶
Use this first to validate cloud permissions, runtime behavior, and logs before creating a schedule.
Cloud Scheduling¶
This uses the same cloud runtime as one-time --remote execution.
All other commands work transparently:
lamia schedule list # shows both local and cloud jobs
lamia schedule update <id> --cron "0 12 * * *"
lamia schedule remove <id> # tears down the cloud job + scheduler job
How It Works¶
lamia <script>.lm --remotepackages your project and deploys a Cloud Run Job- Your script runs via the
lamiaCLI inside the job container (same script semantics as local) lamia schedule add --remotecreates a Cloud Scheduler trigger for that job- Logs (stdout/stderr) go to Cloud Logging under Cloud Run Job execution logs
- Exit status is reported back to the local lamia registry so
lamia schedule listshows it
Version: A cloud script is built with the newest version of Lamia at the time you deploy it, and it keeps that version until it's rebuilt. Deploying again after you change your script rebuilds it with the latest version. Updates stay compatible with your existing scripts, so cloud runs behave the same as running on your computer.
Logs¶
View execution logs:
Or directly in GCP Console under Cloud Run > Jobs > lamia-... > Executions > Logs.
API Enablement¶
lamia-cloud automatically enables required APIs on first use. In restricted org environments where API auto-enablement is blocked by policy, a platform administrator can run:
gcloud services enable run.googleapis.com cloudscheduler.googleapis.com cloudbuild.googleapis.com logging.googleapis.com --project=my-gcp-project
File Sync for Cloud Execution¶
When your script uses with files(...) to provide context to the LLM, Lamia automatically uploads the referenced files to cloud storage (GCS) so the script runs identically in the cloud.
What gets uploaded¶
Only the folders and files specified in with files(...) syntax are uploaded. Nothing else.
with files("./docs", "./data/input.csv"):
def summarize():
"Summarize {@report.pdf} and {@input.csv}"
In this example, every file inside ./docs/ and the single file ./data/input.csv are synced to cloud storage.
How it works at runtime¶
When files are synced, the GCS bucket is mounted as the container's working directory via GCS FUSE. All relative file paths in your script resolve directly into the mounted bucket. Reads pull from the bucket, writes go to the bucket. No copying, no configuration — transparent filesystem.
Incremental sync¶
Lamia tracks file checksums. On subsequent deploys, only changed or new files are uploaded. Files already in the bucket with matching content are skipped. This keeps re-deploy times fast.
When multiple team members sync the same project, Lamia issues a warning before overwriting files that have been modified by someone else.
Security considerations¶
All files in with files(...) directories are uploaded recursively. This includes every file in the folder — Lamia uploads everything so the LLM context resolution works exactly as on your local machine.
Risks to be aware of:
-
Secrets — Lamia scans for common secret file patterns (
.env, files containingAPI_KEY,private key, etc.) and blocks the upload with a clear error. Nevertheless, review what's in your directories before deploying. -
Security surface — Every file you upload exists in cloud storage. Fewer files = smaller attack surface. Only upload what the script actually needs.
-
Sync speed — Larger directories mean more files to check and upload on every script update. Every time you modify your script, Lamia must scan the referenced directories and sync changes. Hundreds of large files slow this down.
-
Storage and bandwidth cost — GCS storage is cheap (~$0.02/GB/month for Standard), but bandwidth adds up with large syncs. For typical Lamia usage (documents, configs, CSVs), costs are negligible — a few cents per month. If you're syncing gigabytes of data, consider limiting scope.
Best practices¶
| Practice | Why |
|---|---|
Create a dedicated folder for your script's data (e.g., ./context/) |
Keeps scope clear, fast sync, no surprise files |
Avoid pointing with files(...) at ~/Documents or home directories |
Personal files, secrets, irrelevant data — all gets uploaded |
| Use relative paths from the project root | Portable across machines and team members |
| Keep referenced directories small and focused | Faster sync, lower cost, better LLM context quality |
It is not terrible to reference a larger directory — Lamia handles it correctly and securely. The practical concern is that LLMs can get lost in large file sets (context dilution), sync gets slower, and the security surface grows. If your workflow genuinely needs many files, it works — just understand the tradeoffs.
Gitflow for Lamia (Team Workflows)¶
When multiple developers work on a shared Lamia project, file paths must be consistent across machines. The recommended approach: use paths relative to the Git repository root.
The problem with absolute paths¶
# BAD for teams — breaks on other machines
with files("~/Documents/company_data/"):
def analyze():
"Summarize {@quarterly_report.pdf}"
This works for one developer but fails for everyone else (different home directory, different folder structure).
The solution: repository-relative paths¶
# GOOD for teams — works for everyone who clones the repo
with files("./data/"):
def analyze():
"Summarize {@quarterly_report.pdf}"
Place the files your script needs inside the Git repository (or a subdirectory of it). Every team member gets the same structure after cloning.
Recommended project structure for teams¶
my-project/ ← Git repository root
├── config.yaml ← cloud configuration
├── daily_report.lm ← script
├── data/ ← files referenced in with files("./data/")
│ ├── templates/
│ │ └── report_template.html
│ └── reference_data.csv
└── requirements.txt
Rules for team-shared projects¶
- All
with files(...)paths must be relative — no~/, no/absolute/paths - Referenced directories must be inside the Git repository — otherwise teammates won't have them
- Git is the recommended source control — Lamia assumes Git when detecting project boundaries for teams
- Uploading to Git does NOT eliminate cloud sync — Lamia still syncs files to the GCS bucket for fast runtime access. Git is the source of truth; the bucket is the execution cache.
Sensitive files in team repos¶
Be careful:
- Don't commit secrets to the repository
- Lamia will still block uploads of detected secret files but you will still have a problem if you commit them to the repository.
- If you have not committed files in the repository lamia --remote command will upload your locale executable and instead of the state that is in the remote git repo as the team would expecct you local state would be running on the cloud. That is why CI/CD flow is a recommened appoach for the team projects.
CI/CD integration (GitHub Flow)¶
For automated deployments, set up a CI workflow that triggers lamia <script>.lm --remote when relevant files change:
# .github/workflows/lamia-deploy.yml
name: Deploy Lamia Script
on:
push:
branches: [main]
paths:
- 'daily_report.lm'
- 'data/**'
- 'config.yaml'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install "lamia-lang[cloud]"
- run: lamia daily_report.lm --remote
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GCP_SA_KEY }}
This ensures the cloud deployment updates whenever the script or its data files change in the repository — no manual --remote runs needed.
Benefits over manual sync:
- Only committed and pushed changes get deployed (no accidental local files)
- Full audit trail of what was deployed and when
- Team members don't need individual GCP credentials for deployment
Limitations¶
- Scripts using browser automation uses headless browser setup in cloud environments which is inferior to the
- Only GCP is supported currently; additional providers may be added in future versions
Practical cost note¶
You usually do not need to build custom cloud agents from scratch to start automation in production.
lamia-cloud is designed to cover common agentic workflows with much lower setup and maintenance overhead.