What the agent does
The v1 SDK is finished: its GitHub repository is archived and its description reads "This SDK has reached end-of-support". The agent begins by measuring how much of it a program uses, since that sets the size of the job. In a tool like utkusen/wholeaked the answer is small. main.go imports three v1 packages, aws, aws/session and service/ses, and one function, sendWithSES, uses them. It opens a session with session.NewSession(&aws.Config{Region: aws.String(region)}), builds a MIME message with gomail, copies the recipient list into a []*string, wraps the bytes in ses.RawMessage, and calls svc.SendRawEmail(input). The region comes from AWS_REGION in the repository's CONFIG file; credentials come from wherever the SDK finds them.
It builds the program before changing it and runs the SES path once with no credentials, to capture the error a user sees today (NoCredentialProviders: no valid providers in chain) and the exit code, 1. That run also finds something unrelated to AWS: with the default flags the tool calls exiftool, and without that binary on the machine it panics before it reaches the mail code. The agent passes -metadata=false for its checks and notes the dependency in the pull request instead of working around it in code.
The port itself follows the v2 shapes. The three imports become aws-sdk-go-v2/config, service/ses and service/ses/types. The session becomes config.LoadDefaultConfig(ctx, config.WithRegion(region)), the client becomes ses.NewFromConfig(cfg), and every operation takes a context.Context first. Input structs lose a layer of pointers, so Destinations is a plain []string and the loop that built the pointer slice is deleted. RawMessage moves to the types package. Fetching the new modules also raises the go line in go.mod from 1.17 to 1.24, because the current v2 modules require it, and that change is part of the diff a reviewer has to accept.
The agent cannot send real mail and does not try. v2 reads a per-service endpoint from the environment, so it starts a small HTTP server on localhost, sets AWS_ENDPOINT_URL_SES to it with placeholder keys, and runs the new binary. The server records what arrived, a form-encoded POST with Action=SendRawEmail, Source, Destinations.member.1 and RawMessage.Data, and replies once with a success document and once with a MessageRejected error. The first reply makes the program print its normal success line; the second shows the new error text, which begins operation error SES: SendRawEmail, https response error StatusCode: 400. The same variable has no effect on the v1 binary, which ignores it and calls the real service, so the agent runs the old binary only without credentials.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Migrate this Go program from github.com/aws/aws-sdk-go (v1) to github.com/aws/aws-sdk-go-v2. Read go.mod and every file that imports the v1 SDK, and list each service client, each operation called, how the session and region are configured, and every place that inspects an AWS error. Build the unchanged program and run each AWS code path once with no credentials in the environment and an empty HOME; record the output and exit code. Never run the old binary with credentials of any kind. Port to v2: config.LoadDefaultConfig with the same region source, NewFromConfig clients, a context on every call, value slices instead of pointer slices, types from each service's types package, and errors.As with smithy.APIError where the code checked awserr. Keep user-facing messages and exit codes the same unless the SDK's own text is printed. Then test the new binary without touching AWS: start a local HTTP server, point the service at it with AWS_ENDPOINT_URL_<SERVICE> and placeholder keys, and show the request it received plus the program's output for one success response and one error response. Run go build, go vet and go mod tidy. Report any change to the go directive and why. Open a pull request with all recorded output.",
"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
A pull request that changes main.go, go.mod and go.sum. The code diff is short: three imports, the config call, the client constructor, a context argument, and a deleted loop. The module diff is long. The single v1 requirement is replaced by config, service/ses, the core aws-sdk-go-v2 module, smithy-go and about a dozen indirect modules for credentials, instance metadata and single sign-on. The description explains the jump of the go directive to 1.24 and quotes the request the local server received.
The reviewer checks three things. First, the error text: a script that greps this tool's output for NoCredentialProviders will not find it, because the same condition now reads failed to refresh cached credentials. Second, the build environment: any Dockerfile, release job or contributor guide that names an older Go has to move with go.mod. Third, what was not proven. The local server shows that the request is well formed and that both replies are handled, but it does not check a signature, so the first send against the real service is still the reviewer's to make, with a verified sender address.
Run it on every repository that still imports aws-sdk-go v1
Most organizations have this migration many times over, one per service, with a different set of AWS clients in each. Search your code host for github.com/aws/aws-sdk-go/ in go.mod files, and send the body above to POST /o/{org}/sessions once per repository with that repository as the resource. Give each request a request_id that is a UUID v5 of the repository's full name, so running the script twice returns the runs it already started.
Give the key a webhook_url and each finished run posts run.completed there with the session's address, which is enough to build a list of open pull requests as they arrive. A key starts at most max_concurrent runs at once (4 by default, within your plan's limit); the rest wait as queued and need no retry loop.
The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.
Why run it on Rush?
The dangerous step in an SDK migration is the test. On a laptop the default credential chain finds whatever profile the engineer last used, and a quick manual check can send a real message or write to a real bucket. The agent's sandbox holds no AWS credentials unless you put them there, and the prompt tells it to prove the port against a local endpoint. The v1 binary's habit of ignoring the endpoint variable is exactly the kind of fact that is safer to learn where there is nothing to reach.
The work is also the same in every repository and slightly different in each, which is the shape that suits many runs at once. One run reads one program's clients and error handling, records its own evidence, and opens its own pull request, so a platform team reviews twenty small diffs instead of writing them.
Frequently asked questions
Do I have to migrate every service client at once?
No. The two SDKs have different module paths and can be imported side by side in one binary. For a program with one client, as here, a single pull request is simpler. For a large service the agent can port one package per run if the prompt names it.
Why did the go directive change?
The v2 modules declare a minimum Go version of their own, and go get raises yours to match. In this repository that moved go 1.17 to go 1.24. If you must stay on an older toolchain, say which one in the prompt, and the agent pins v2 releases that still support it or reports that none do.
Does the binary get much bigger?
Not in this case. In a check made while this page was written, the same program built to 17,282,295 bytes with v1 and 17,502,085 bytes with v2 on one machine. v2 is split into one module per service, so a program links only the clients it imports.
How does the agent test code that calls AWS without an AWS account?
It points the v2 client at a server it starts inside the sandbox, using the AWS_ENDPOINT_URL_<SERVICE> environment variable, and inspects the request that arrives. That proves the call is built and its responses are handled. It does not prove permissions, quotas or a verified identity, and the pull request says so.
Should the code move from the SES API to SESv2 as well?
That is a different change. aws-sdk-go-v2/service/ses carries the same SendRawEmail operation the program already uses, so the port keeps it. Moving to the sesv2 client changes the request shape, and the agent does it only when asked.
More jobs like this: Upgrade dependencies weekly
- Migrate AWS SDK for JavaScript v2 to v3 in an Express S3 App (AWS SDK for JavaScript)
- Replace Axios With Native fetch in a Node.js Library (Axios)
- Migrate From babel-eslint to @babel/eslint-parser (babel-eslint)
- Migrate a Go Project From Blackfriday to goldmark (Blackfriday)
- Migrate From Bluebird to Native Promises in a Node.js Library (Bluebird)
- Replace body-parser With express.json() in an Express App (body-parser)