AWS runner

Deploy a runner into your own AWS account, wire it to Evident, and understand exactly what it holds and what it costs.

This runner runs in your own AWS account, not on your machine and not on Evident's infrastructure — Evident boots and suspends it on demand instead of you running evident run yourself (see the local runner for that path).

For the ordered path from a new Evident team to a first Slack reply, start with the MicroVM quickstart.

Two strategies, one package

Both AWS strategies ship from a single published package, @evident-ai/runner-cdk (pnpm add @evident-ai/runner-cdk, no checkout required to install it).

  • Fargate — EvidentScaleToZeroConstruct. A long-running container that scales itself to zero when idle. Your runner image is any ecs.ContainerImage — a registry reference, no checkout of this repo needed. After installing, the package's own README at node_modules/@evident-ai/runner-cdk/README.md has a short walkthrough and the full props table — this page doesn't duplicate it. A longer Fargate walkthrough (shared infra, secrets, the image, the two grants, wiring the wake webhook) isn't published yet — ask Evident if you need it.
  • MicroVM — EvidentMicrovmConstruct. A per-session Lambda MicroVM that boots on demand and suspends between messages — the rest of this page. Evident publishes a multi-architecture base image to GHCR, and you extend it with a Dockerfile you control. stageMicrovmBuildContext() combines that build context with your full repository checkout before CDK uploads it.
View diagram source
graph TB
  subgraph AWS["your AWS account"]
    CDK["@evident-ai/runner-cdk · private preview"]
    CDK -->|"Fargate strategy"| Fargate["EvidentScaleToZeroConstruct — long-running container, scales to zero"]
    CDK -->|"MicroVM strategy"| MicroVM["EvidentMicrovmConstruct — controller + per-session Lambda MicroVM"]
  end
  Evident -->|"wake request via Function URL, HMAC-verified"| MicroVM
  Fargate -->|"runner outbound: conversational traffic"| Evident["Evident"]
  MicroVM -->|"runner outbound: conversational traffic"| Evident
Both strategies deploy inside your own AWS account; the runner reaches Evident outbound, while Evident uses a signed wake request to start the MicroVM.

What you get, and what stays yours

Evident never holds a key to your AWS account, and the infrastructure you deploy holds no Evident credential at rest. The only Evident secret it stores is a shared HMAC key, and its only job is verification: your controller uses it to check that a request really came from Evident before it starts or suspends anything. It grants no access to Evident, and no access to AWS.

A running runner is the one exception — stated plainly rather than softened. While a runner is running, it does hold an Evident credential: a runner key that Evident issues for that boot so the runner can call Evident back (that is how it streams your conversation and how it reconnects after a suspend). It is not your Evident account credential. It is scoped to that single runner, so it cannot touch any other runner, and it cannot manage your team, your billing or your API keys. It expires on its own within nine hours — longer than the eight hours AWS allows a MicroVM to live, so every cold start gets a fresh one — but nothing revokes it early when a VM stops; expiry is what ends it. And it travels with the VM rather than with your infrastructure: it is written inside the VM at boot and is present in the VM's suspended snapshot. If the Evident Swarm — several runners behind one address — provisions this runner and has a credential-proxy default, the VM also holds a separate assignment-scoped inference token in its protected runner credential store. The token is present in the suspended snapshot but is never a provider credential or a team-management credential.

The runner only ever dials out to Evident — there is nothing inbound to open on your side. Model provider credentials and the runner's durable state stay in your account, in the S3 bucket the stack creates.

One more honest detail: although the HMAC key never appears in the CloudFormation template or its outputs, anyone in your account with lambda:GetFunctionConfiguration can read its resolved value from the controller Lambda's environment. That's acceptable because it is a verification key — it grants access to nothing of Evident's.

What isn't configurable yet

  • The workspace repository is fixed at image build time — it ships the repository you pass to stageMicrovmBuildContext(), checked out at the commit the image was built from. Any repository works. Dependency installation and build work belong in your customer-owned Dockerfile.
  • There is no per-runner repository setting yet.
  • Changing the workspace repository or Dockerfile requires rebuilding the image — about five minutes, via one cdk deploy.

Prerequisites

  • An AWS account with permission to create Lambda MicroVM images, Lambda functions, IAM roles, and an S3 bucket.
  • The AWS CLI configured for that account.
  • cdk bootstrap already run for that account and the region you'll deploy into.
  • Node.js and pnpm.
  • pnpm add @evident-ai/runner-cdk @evident-ai/lambda-microvm-cdk@^0.1.1 aws-cdk-lib@^2.240.0 constructs@^10.5.0 — the construct and its three peer dependencies. No checkout of the Evident repository is required.
  • A full (non-shallow) clone of the repository your agent will work on, which is baked into the image as its workspace.
  • An Evident team where you are an admin or owner — provisioner configuration and controller shape checks are manage-gated.

Choose a region

The default region is eu-west-1. These are the regions Evident expects MicroVMs to run in today:

  • eu-west-1
  • us-east-1
  • us-east-2
  • us-west-2
  • ap-northeast-1

The region is whichever one your own stack deploys into — set it on the stack's env, as you would for any CDK stack. The construct adds no region check of its own, so deploying into a region without Lambda MicroVM support fails at the AWS API rather than at synth; check the list above first, and check AWS's own documentation if it looks out of date.

How the deploy fits together

The ordered walkthrough lives in the MicroVM quickstart.

The controller must hold the signing secret before it can be deployed, so its URL only exists afterwards. Provisioner configuration requires owner or admin access because the shape-catalogue read and Swarm update are manage-gated.

EvidentMicrovmConstruct emits no CfnOutput. The ControllerFunctionUrl output exists only when your own stack declares it.

A MicroVM has two provider-configuration routes. By default, the runner stays token-only and uses the construct's runnerOpencodeConfigPath overlay, which becomes RUNNER_OPENCODE_CONFIG; relative overlay paths resolve against the baked workspace. The opt-in route, autoConfigureCredentialsProxy, asks the runner to install generated providers instead. The currently published @evident-ai/runner-cdk@latest does not expose that prop yet. Until a release does, set RUNNER_AUTO_CONFIGURE_CREDENTIALS_PROXY to the exact string true through extraImageEnvironment; any other value warns and keeps the runner token-only. The base image pinned on this page already reads this variable.

If the selected credential pool is unavailable, creation stops with an actionable error rather than falling back to direct provider access. No default leaves future runners on the manual model-provider setup path.

Customising the image

The image you deploy combines the published base with your Dockerfile. Put operating-system installs and project build work in that Dockerfile, and keep secrets out of both the Docker build context and image environment.

FROM ghcr.io/sroze/evident-microvm-base:sha-c852a6f

USER root
RUN apt-get update \
  && apt-get install -y --no-install-recommends tree \
  && rm -rf /var/lib/apt/lists/*

COPY --chown=10001:10001 workspace /workspace
USER runner
WORKDIR /workspace
RUN git reset --quiet
RUN if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile; fi

If an installed tool needs a value at runtime, pass it through the construct's extraImageEnvironment prop. Every VM launched from that image version can read those values, so never put a secret there.

Adding packages or build work makes the image larger and slows the AWS image build. The image rebuilds the next time you run cdk deploy.

What Evident sets for you

  • Evident allocates the durable-state location each runner writes to.
  • Each cold boot gets a fresh runner key — the same short-lived, single-runner key described above, not a second thing.
  • When the Swarm has a credential default, each new runner receives an assignment-scoped inference token. It stays in the protected runner credential store and reaches OpenCode through EVIDENT_PROXY_TOKEN, not through project configuration. The construct's runnerOpencodeConfigPath becomes RUNNER_OPENCODE_CONFIG, and the boot hook applies it with --opencode-config-overlay.
  • Machine size defaults to the stack's default shape, and is chosen in the Swarm's settings.

The optional generated configuration preserves unrelated providers, plugins, permissions, and project settings. The runner reports whether Evident validated that generated configuration, whether you manage provider configuration yourself, or whether no configuration claim is available. Managed inference becomes ready after credential delivery and proxy policy readiness. Tunnel connectivity remains separate, so the runner can come online for diagnostics even when managed inference is not ready.

A normal resume keeps the OpenCode process and inference token already stored in the suspended VM; it confirms them without rotating. A cold start retries uncertain delivery with a replacement token. If local application fails, restart the runner to retry. If proxy policy refresh fails, restore proxy connectivity and retry acknowledgment instead.

Verification

Open the provisioner's detail page from Provisioners, then confirm the Machine size section lists the sizes your stack advertises. This section is a live signed probe of your controller: if it lists sizes, Evident reached your controller and the signing key matched on both sides. Enter the URL under Controller URL and select Check to re-verify it.

You can also confirm the stack itself deployed correctly by reading the ControllerFunctionUrl output declared by your own stack.

For the real end-to-end test, send a message to the Swarm. Expect a first boot of about 27 seconds, after which the runner comes online. It will boot successfully even without a model provider connected — that's expected, not a failure — but it needs one to actually answer; see model providers.

Troubleshooting

If the machine-size picker can't load shapes, it shows one of these messages:

What you see Likely cause
"Generate a signing secret above to choose a machine size." The provisioner has not generated a signing secret yet.
"Save a controller URL above to choose a machine size." The signing secret exists, but no controller URL is saved.
"This webhook is currently disabled, so its machine sizes aren't available right now." The controller's webhook is disabled.
"The controller can't be reached from here, so its machine sizes aren't available right now." The URL is blocked from the current environment.
"Couldn't reach the controller, so its machine sizes aren't available right now." The controller could not be reached.
"The controller didn't respond the way Evident expects, so its machine sizes aren't available right now." The controller returned an unexpected status.
"The controller didn't answer with a list of machine sizes Evident recognises." The response did not contain a recognised machine-size catalogue.
"Expected before you've generated the signing secret — the controller can only be verified once it holds one. Generate the secret above, then check again." The signing secret has not reached the controller yet.
"Couldn't reach this URL just now. It may still be correct — check for typos, or confirm the controller is running, then try again." The signed check did not reach the controller.
"The controller responded, but not the way Evident expects yet. It may still be correct — try again once it holds the secret." The controller may not hold the signing secret yet, or it may use an older field name. For a caller-owned stack, inspect the Secrets Manager secret referenced by your own controllerSigningSecret stack input. Its JSON field must be CONTROLLER_SIGNING_SECRET. DoorbellSecret is relevant only to Evident's own default stack, where it is the logical ID of the SOPS-backed signing-secret resource. If an older secret still uses DOORBELL_SECRET, rename that field, redeploy the controller, then check again once it holds the secret.
"The controller answered, but not with a machine-size catalogue Evident recognises." The signed check response was not a recognised catalogue.
Reached the controller — it offers machine sizes. The signed check succeeded.

Cost

A runner suspends itself automatically about two minutes after it goes idle. That is the default, and you can override it with EVIDENT_IDLE_TIMEOUT_SECONDS through the construct's extraImageEnvironment. A non-numeric value produces a warning and falls back to 120 seconds. AWS terminates a MicroVM after at most eight hours, but that lifetime limit is not a resource or cost ceiling. There is nothing for you to switch on for the default suspension behavior.

To select machine size, open the provisioner's detail page and use its Machine size section. The default Standard shape has 4,096 MiB and runs at roughly ~$0.30/hour at that size. A stack can replace the catalogue with the construct's shapes prop. AWS automatically bursts a running MicroVM vertically under load, billed at the same per-second rates only for what's actually used above the selected size. You don't configure or trigger this burst yourself. For current unit rates and to measure your own usage, see AWS's MicroVM sizing table and the AWS Lambda pricing page.

  • Suspended: ~$0.0024/day, assuming roughly 0.75 GB of snapshot state — effectively free either way.
  • ~$0.004 per suspend/resume cycle (writing and reading that state).

When a runner reaches the lifetime limit

In two cases, nothing asks the runner to suspend and it runs until the eight-hour lifetime limit:

  • The webhook connector is switched off while a runner is live.
  • A runner dies without a clean shutdown — a crash, or a hard network drop — rather than exiting normally.

When a sleeping runner is within two hours of the eight-hour lifetime limit, Evident starts it on a fresh machine on the next wake instead of resuming the old one. This happens automatically and needs no configuration. The fresh machine starts from the clean workspace in the runner image, so files and uncommitted edits that existed only on the old machine are lost. Your connected model providers, their credentials, and chat history are preserved.

Two gaps we haven't closed: whether standing storage for the MicroVM image itself is billed is not yet established, and the S3 buckets plus the controller Lambda carry a small, nonzero cost beyond what's shown above.

Teardown

Before tearing anything down, let any running or suspended runner stop on its own. Then destroy the stack from your own CDK app:

npx cdk destroy

The durable-state S3 bucket is retained on purpose and survives cdk destroy, so it keeps costing you money until you delete it yourself. It's retained because it holds each runner's credentials and state, which deleting a stack must not throw away. Because the bucket is versioned, emptying it means deleting object versions, not just current objects.

The MicroVM image itself goes with the stack. The CDK bootstrap/staging bucket is separate and shared with other CDK apps in the account — don't delete it blindly.

Next steps