What the agent does
The agent reads how the app builds before writing a workflow. In a TypeScript CDK app shaped like typescript/api-cors-lambda-crud-dynamodb in aws-samples/aws-cdk-examples, package.json pins aws-cdk 2.1133.0 and aws-cdk-lib 2.262.1, has build as tsc and a postinstall that runs npm install inside lambdas/, where the five handlers and their own package.json live. cdk.json runs the app with npx tsc && npx tsx index.ts, and tsconfig.json sets noEmit: true, so npm run build is a type check and nothing more. index.ts defines one stack with a DynamoDB table and five NodejsFunction constructs on Runtime.NODEJS_24_X, bundled by esbuild with depsLockFilePath pointing at lambdas/package-lock.json. There is a jest.config.js with @swc/jest and aws-cdk-lib/testhelpers/jest-autoclean but no test file in this app, and no lock file at the top level either.
Those two absences shape the workflow. Jest exits non-zero when it finds no tests, so a test step would fail on day one; the agent adds one assertion test, index.test.ts, in the style of the sibling lambda-cron example's lambda-cron.test.ts: Template.fromStack on the stack, resourceCountIs for the five functions and one table, and hasResourceProperties on the REST API's OPTIONS method for the CORS headers index.ts sets. And npm ci needs a package-lock.json, so the agent generates one at the top level and, through postinstall, in lambdas/, commits both and says so, because the esbuild bundling in index.ts reads the lambdas lock file at synth time. The repository-level build-pull-request.yml and scripts/build-typescript.sh show how the examples repository handles this today, falling back to yarn when no lock exists; the new workflow is for a single app and does not need that branching.
The workflow, .github/workflows/ci.yml, triggers on pull requests and pushes to main, sets permissions: contents: read, checks out, sets up Node with npm caching on the version matching the Lambda runtime, runs npm ci, npm run build, npx jest, and npx cdk synth --quiet. Synth needs no AWS credentials for this stack because nothing in index.ts does an environment lookup, and esbuild bundling runs locally since esbuild is a devDependency, so no Docker is needed on the runner. The step uploads cdk.out as a workflow artifact so a reviewer can read the CloudFormation template a pull request produces. A commented second job shows where cdk diff would go with an OIDC role, because diff needs an account and the agent will not add a credential it cannot test.
In the sandbox the agent runs exactly those steps on the same Node version: npm ci, npm run build, npx jest with the new test, npx cdk synth --quiet, and it reads cdk.out/ApiLambdaCrudDynamoDBExample.template.json, named for the stack id index.ts passes to the constructor, to confirm the five functions, the table and the API are there. It runs actionlint on the workflow, and git status to list what the lock files and cdk.out added, keeping cdk.out out of the commit with the .gitignore the typescript/ README describes.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add a GitHub Actions CI workflow for this AWS CDK app. Read package.json, cdk.json, tsconfig.json, jest.config.js, index.ts, the lambdas directory and its package.json, and README.md first. Note that there is no test file and no package-lock.json. Add index.test.ts using Template.fromStack with resourceCountIs for the Lambda functions and the DynamoDB table and hasResourceProperties for the CORS OPTIONS method, generate package-lock.json at the top level and in lambdas through postinstall, and commit both with an explanation. Write .github/workflows/ci.yml on pull requests and pushes to main with contents read permission, Node matching the Lambda runtime in index.ts with npm caching, npm ci, npm run build, npx jest, npx cdk synth --quiet, and an upload of cdk.out as an artifact; add a commented job showing where cdk diff would go with an OIDC role and do not add credentials. Run every step in the sandbox, read the synthesized template to confirm the resources, run actionlint, keep cdk.out out of git, and open a pull request with the outputs.",
"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 adding .github/workflows/ci.yml, index.test.ts, package-lock.json and lambdas/package-lock.json, with cdk.out ignored. The description explains why the lock files are there, which Node version the workflow uses and why it matches Runtime.NODEJS_24_X, and that synth runs without credentials because the stack does no environment lookups.
The evidence is the sandbox run: npm run build clean, the jest output naming the new assertions, cdk synth finishing with the stack listed, a few lines from the synthesized template showing the resource types, and actionlint with no findings. The workflow then runs on the pull request itself, which is where the first green check comes from; the description does not claim one in advance.
A reviewer opens the cdk.out artifact from the pull request's run to read the template, decides whether cdk diff against a dev account is worth an OIDC role now, and whether the test should also pin the table's removal policy, which index.ts sets to DESTROY with a comment saying it is not for production.
Run it on every CDK app without CI
A platform team with one CDK app per service starts one run per repository: a POST /o/{org}/sessions with this prompt and the repository in resources, with a request_id per repository so a retried request returns the run already started. Each run reads that app's cdk.json and package.json, so an app built with ts-node or one whose stack uses fromLookup gets a workflow that reflects it, including a note that lookups need credentials at synth time.
Give the key a webhook URL and Rush posts run.completed or run.failed when each turn ends. When the team later creates the OIDC role, a follow-up on the parked session uncomments the diff job with the role ARN and pushes to the same pull request, with node_modules and cdk.out still on disk.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
A CDK workflow that merely runs tsc proves little; the useful checks are a synth that actually bundles the handlers and a test that reads the template, and both need the exact dependency set installed, which is why the missing lock files matter. The agent finds those gaps by running the steps in its own sandbox rather than by reading the files, and the first failure, Jest with no tests, is something it fixes before the workflow ever reaches GitHub.
The record is the review. The run's transcript holds the synth output, the template excerpt, the jest run and the reason no credentials were added, so a reviewer can see what the workflow will do and what it deliberately does not. The branch carries the lock files and the workflow and nothing is deployed; cdk deploy never appears.
Frequently asked questions
Does the workflow need AWS credentials?
Not for build, test and synth on this stack, because index.ts makes no environment lookups and esbuild bundles the handlers locally. cdk diff and cdk deploy do need an account, so the agent leaves a commented job showing where an OIDC role would go and adds no secret.
Why does the pull request add package-lock.json files?
Because npm ci refuses to run without one, and index.ts points depsLockFilePath at lambdas/package-lock.json for bundling. The agent generates both, commits them and explains it, so installs in CI are reproducible and match what synth expects.
Why is there a new test file?
jest.config.js was present but no test existed, and Jest fails when it finds none. The added index.test.ts asserts the resource counts and the CORS headers from the synthesized template, which is the same style the lambda-cron example in the repository uses.
Which Node version does it use?
The one matching the Lambda runtime index.ts declares, Runtime.NODEJS_24_X, so the handlers are type-checked and bundled with the same major version they run on. If a repository has a .nvmrc or .node-version, that wins and the agent says so.
Will it add cdk deploy on merge to main?
Not without being asked, and not without an account to deploy to. Ask for it in a follow-up with the role and environment, and the agent adds a deploy job gated on main with the OIDC role and a manual approval environment.