What the agent does
The agent reads the service before it writes a workflow. In a service like aws-node-rest-api-with-dynamodb in serverless/examples, serverless.yml declares frameworkVersion: '4', provider aws on nodejs24.x and arm64, an environment variable DYNAMODB_TABLE built from ${self:service}-${sls:stage}, an IAM role statement scoped to the table's ARN, five functions wired to httpApi events for /todos and /todos/{id}, and a TodosDynamoDbTable resource with BillingMode: PAY_PER_REQUEST and DeletionPolicy: Retain. package.json is type: module with two @aws-sdk dependencies, no scripts, no dev dependencies and no lockfile; .gitignore lists node_modules and .serverless; the README deploys with serverless deploy; and there is no .github/workflows/ directory for the service.
Two facts about Framework v4 shape the workflow. It is installed from npm, so the job runs npm install -g serverless on a Node matching the nodejs24.x runtime, and it requires authentication even in CI, so every job sets SERVERLESS_ACCESS_KEY from a repository secret, with SERVERLESS_LICENSE_KEY as the alternative for teams on a license key. The agent generates package-lock.json with npm install so npm ci works in the runner, and adds it to the pull request, since a service with no lockfile cannot have a reproducible install.
The workflow .github/workflows/ci.yml has two jobs. check runs on every pull request: npm ci, serverless print --stage ci to resolve every variable and fail on a malformed serverless.yml, and serverless package --stage ci to build the deployment artifact in .serverless/ without touching AWS. deploy runs on pushes to main after check, under a concurrency group so two pushes cannot deploy over each other, obtains AWS credentials with aws-actions/configure-aws-credentials through GitHub's OIDC provider and a role-to-assume secret, with permissions: id-token: write on the job, and runs serverless deploy --stage prod. The region and stage names are workflow inputs the pull request calls out, and no long-lived AWS key is written anywhere.
The agent proves what it can without an AWS account. It runs npm ci and serverless print in the sandbox against the real configuration and pastes the resolved YAML, and it runs actionlint over the workflow. It cannot deploy, so the pull request says plainly that the deploy job is exercised by the first push to main after the secrets exist, and lists the three secrets to create: the Serverless access key, the IAM role ARN and the region.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add GitHub Actions CI and deployment to this Serverless Framework v4 service. Read serverless.yml, package.json, .gitignore and the README first. Generate a package-lock.json so npm ci works. Write .github/workflows/ci.yml with a check job on pull requests that sets up the Node version matching the provider runtime, installs the serverless CLI from npm, runs npm ci, serverless print and serverless package for a ci stage with SERVERLESS_ACCESS_KEY from a secret, and a deploy job on pushes to main that needs check, uses a concurrency group, assumes an AWS role through OIDC with aws-actions/configure-aws-credentials and id-token write permission, and runs serverless deploy for the prod stage. Run npm ci and serverless print in the sandbox, run actionlint on the workflow, document the secrets in the README, and open a pull request that says the deploy job has not run. Do not deploy and do not add AWS access keys.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request on its own branch with .github/workflows/ci.yml, a new package-lock.json, and a README section listing the secrets and how the two jobs behave. serverless.yml and the five handlers in todos/ are unchanged.
The description pastes the resolved configuration from serverless print, the actionlint result and the npm ci output, and states that the deploy job has not been exercised. The commands and outputs are in the transcript at GET /o/{org}/sessions/{id}/messages.
Before merging, a reviewer creates the Serverless access key and the IAM role with a trust policy for the repository's OIDC subject, adds the three secrets, and opens a small pull request to watch check run. The first push to main then runs deploy, and the DeletionPolicy: Retain on the table means a mistaken stack removal still keeps the data.
Run it on every terminal hand-off
A developer who deploys from a laptop today starts this from the terminal with this body and carries on. The run reads the real serverless.yml, so the Node version, the stage variable and the resources in the workflow match the service rather than a template.
Send a request_id, a UUID, with the body so a retried start returns the run it already began. When the run is done, its GET /o/{org}/sessions/{id} answer names the pull request.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
A deployment workflow is cheap to write and expensive to get wrong, because the mistakes show up as a failed production deploy or a leaked key. The agent reads the service's runtime and variables, follows Framework v4's authentication requirement, uses OIDC instead of stored AWS keys, and validates the configuration with the framework's own print command in a sandbox before anything reaches a runner.
The pull request carries the resolved configuration and the lint result, and is honest about the one job it could not run. Several services can get the same workflow at once, each read on its own terms, in its own sandbox, with one pull request each.
Frequently asked questions
Why does CI need a Serverless access key?
Framework v4 requires every CLI session to authenticate, including non-interactive ones. The workflow reads SERVERLESS_ACCESS_KEY from a repository secret; a team using a license key sets SERVERLESS_LICENSE_KEY instead, and the README section the agent writes names both.
Why OIDC instead of AWS access keys in secrets?
aws-actions/configure-aws-credentials can exchange a GitHub-issued token for short-lived credentials of an IAM role whose trust policy names this repository, so nothing long-lived is stored in GitHub. The job needs permissions: id-token: write, which the workflow sets, and the role ARN is the only AWS value in secrets.
What does the check job actually verify without deploying?
serverless print resolves every variable, including ${sls:stage} and ${self:service}, and fails on a configuration the framework cannot read, and serverless package bundles the functions and writes the CloudFormation template to .serverless/. Neither needs an AWS account, and both catch the mistakes that otherwise surface mid-deploy.
Why add a lockfile?
The service has no package-lock.json, and npm ci refuses to run without one. Committing the lockfile the agent generates makes the runner install exactly the dependency versions that were packaged, which is what makes a green check meaningful.
Will it deploy on every pull request?
No. Only check runs on pull requests. deploy runs on pushes to main, after check passes, inside a concurrency group so one deploy finishes before the next starts.
More Serverless Framework jobs
The same job on other stacks
- Set Up GitHub Actions CI for a Slack Bolt App (Slack Bolt)
- Set Up GitHub Actions CI for a SolidJS App (SolidJS)
- Set Up GitHub Actions CI for a SQLAlchemy App (SQLAlchemy)