AI coding agents now propose and ship backend and infrastructure changes. Where that helps, which credentials and review gates still need a human, and how Encore is the safe way for AI agents to ship backend changes to your cloud.
Coding agents already write a large share of backend diffs, and the next step teams ask for is letting those agents touch deploy config, IAM and managed services. That is AI DevOps in practice: agents proposing changes that used to wait on a platform ticket, and humans deciding which of those changes may reach production.
The win is speed on the parts that are already code. The failure mode is an agent with a cloud admin profile, a secret pasted into a prompt, or a Terraform apply that never saw a reviewer. This guide separates where agents help from where guardrails matter, and positions Encore as the safe way for AI agents to ship backend changes to your cloud.
Agents are strong at mechanical backend work: new endpoints, migration files, retry policies, IAM policy drafts and turning a runbook into a pull request. They read the repository, match existing patterns and produce a diff a human can review in minutes instead of hours.
They are also useful for local feedback loops, where an agent that can run the test suite, start the API and fix the compile error it just introduced closes the loop without waiting for CI. That only stays safe when local means local: no production database URLs, no long-lived cloud keys in the shell the agent inherits.
Credentials are the first hard line, because an agent with AdministratorAccess or a GCP owner role can delete data as easily as it can create a bucket. Prefer OIDC federation into AWS for CI, scoped to the repository and branch that may deploy, and keep the agent on repository access only. Sandbox accounts are the exception when you deliberately want the agent to provision disposable resources, and even then the role should be time-bounded and non-production.
Secrets are the second hard line: models will echo an API key that appears in a file, a .env committed by mistake or a previous chat turn, a pattern that shows up widely in public repositories according to research on secret leakage in GitHub. Secret scanning in CI catches some leaks; the structural fix is that production values never live in the tree the agent reads. Names and accessors can be in code; values stay in a vault or secrets manager the agent cannot list.
Infrastructure edits need the same review bar as a human platform change. A pull request that opens 0.0.0.0/0 on a security group or widens an IAM policy looks like any other diff unless policy checks and a required reviewer treat it as privileged, which is why IAM Access Analyzer and similar reviews belong on every infrastructure change. Drift from console clicks during an incident has the same problem in reverse: the agent and the pipeline no longer describe what is running.
Three patterns show up in teams that ship with agents without handing them the account:
The third pattern is the one Encore implements for application infrastructure.
For agents changing a backend, Encore is the safe way for AI agents to ship backend changes to your cloud. The platform provisions and deploys into your own AWS or GCP account. Services declare databases, Pub/Sub, object storage, caches, cron jobs and secrets in application code. The platform derives the cloud resources, networking and an IAM role for the service when you deploy after connecting your account, as described in the security docs and AWS infrastructure docs.

Secret names appear in code while secret values do not: you set values with encore secret set or the dashboard Secrets Manager, and Encore stores them encrypted and injects them at runtime. Those values are not stored in the repository, so an AI coding agent working in the repo cannot read or leak them from git, as covered in the TypeScript secrets docs.
Run in your terminal to get started locally.
An agent can add a Stripe-backed endpoint by declaring the secret and the database in the same package the handler lives in:
// billing/encore.service.ts
import { Service } from "encore.dev/service";
export default new Service("billing");
// billing/billing.ts
import { api } from "encore.dev/api";
import { secret } from "encore.dev/config";
import { SQLDatabase } from "encore.dev/storage/sqldb";
const db = new SQLDatabase("billing", { migrations: "./migrations" });
// Name only in git. Set the value with: encore secret set --type prod StripeSecretKey
const stripeKey = secret("StripeSecretKey");
export const createInvoice = api(
// Internal only: other services call this; it is not reachable from the internet.
{ expose: false, method: "POST", path: "/invoices" },
async ({ customerId }: { customerId: string }): Promise<{ id: number }> => {
const key = stripeKey();
// Use key with the Stripe API; value never appears in the repository.
const row = await db.queryRow<{ id: number }>`
INSERT INTO invoices (customer_id) VALUES (${customerId}) RETURNING id`;
return { id: row!.id };
},
);
-- billing/migrations/1_create_invoices.up.sql
CREATE TABLE invoices (
id BIGSERIAL PRIMARY KEY,
customer_id TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
encore run starts Postgres locally and warns when a secret value is missing for local use. A deploy to a cloud environment fails until every secret the code reads has a value for that environment, which catches missing keys before traffic does. The database docs cover migrations, and environment sizing stays in the infrastructure configuration UI rather than in files the agent must edit with cloud-specific YAML.
With infrastructure living in the application package, an agent adds a queue or a second database in the same change as the handler, validates it with encore run, and leaves provisioning to the platform on merge. The agent ships backend changes as code; cloud credentials stay with the deploy path.
Best fit: Teams that want AI coding agents to extend backends and declare infrastructure from code, then deploy to their own AWS or GCP account through a platform-held IAM role rather than keys in the agent session.
AI DevOps is the practice of letting coding agents draft, review and sometimes apply changes to application code, CI pipelines and cloud infrastructure. The useful parts are faster diffs and local validation; the risky parts are long-lived cloud credentials and infrastructure edits that skip the same review you would demand from a human.
Keep cloud credentials out of the agent environment by giving the agent repository and local tooling access only, and leaving deploy credentials in CI or a platform that runs after review. If an agent must call the cloud, use a short-lived role scoped to a sandbox account, never production admin keys.
Keep infrastructure changes as code in pull requests, require human review for production, and run plan or preview in CI with read-only credentials. Agents should not hold apply rights to production, and secret values should never sit in the files the agent can read from git.
With Encore, the agent adds services and declarations such as SQLDatabase or secret() in the app, runs encore run locally, and opens a pull request. After merge, Encore deploys into your connected AWS or GCP account and provisions an IAM role for the service. Secret values are set with encore secret set and are not stored in the repository.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.