[Report] I Attended the Workshop "Make the agent code while you sleep"! #AWSreInvent #DVT406-R1

[Report] I Attended the Workshop "Make the agent code while you sleep"! #AWSreInvent #DVT406-R1

Running things while I slept turned out not to be so easy. Let's steadily build up the environment, step by step!
2026.12.04

This page has been translated by machine translation. View original

Hello, I'm Nakamura.

This is a report on the workshop "Make the agent code while you sleep" that I attended at AWS re:Invent 2026.

I use coding agents on a daily basis, but I'm always looking for a better way to work. I joined because I wanted to learn the mindset for "leaving it to the agent until the very end."

Session Overview

  • Session title: Make the agent code while you sleep (DVT406-R1)
  • Speakers:
    • Keerthi Sreenivas Konjety (Specialist Solutions Architect, Amazon)
    • Govindhi Venkatachalapathy (Sr.Specialist Solution Architect, AWS)
  • Date and time: Thursday, Dec 3, 12:00 PM - 2:00 PM PST
  • Venue: Caesars Forum | Level 1 | Alliance 307
  • Level: 400 – Expert
  • Format: Workshop

Session Description

Anyone can prompt an agent. The hard part is getting it to work the way you want—for hours, unattended, without going off the rails. This advanced workshop digs into orchestration. You'll build a custom agent, then set a goal so strong the agent can't redefine it or declare victory early. You'll decompose work across subagents, use directives like /goal to keep execution on track, and design guardrails that let an agent run long and autonomously while landing where you intended. We'll use Kiro, but these patterns transfer to any agentic system. You must bring your laptop to participate.

Introduction

At the start, the speakers asked the room: "Have you ever handed a task to an agent and stepped away, only to come back and find it stopped, waiting for a permission approval or a question?" Because I'm using live translation, I always miss the timing to raise my hand, but I'm one of those people too.

The theme of this workshop is getting the agent to do the work as intended, all the way to the end, even while no one is watching (while you sleep). The following four elements were introduced as necessary for that.

Element Description How to do it in Kiro
A clear goal Instead of "fix the bug," hand over up front what must be satisfied for the work to count as done /goal (repeats until the completion condition is met)
Keep running for a long time Keep looping until the goal is achieved, without someone watching over it The cap on /goal iterations (--max)
Permissions Decide in advance which files and commands the agent may touch The custom agent's configuration file
Run without a laptop Run it with no one present, in a CI/CD pipeline or the cloud Headless execution, cloud sessions

The speakers said, "There are two things we want you to take home today." The first is how to convey your intent to the agent. Instead of "fix the bug," you need to communicate what state counts as "all tests pass." The second is permission settings. Stop "babysitting the agent" by clicking approve buttons over and over, and configure the necessary permissions in advance.

The workshop proceeds using Kiro CLI, but the patterns learned here are positioned as applicable to other agents too.

Workshop

The subject is an online shop made up of five microservices (cart / pricing / tax / inventory / checkout). A pull request that added a feature to inventory broke the integration between services, and tests are failing. The goal is to have the agent fix this PR in a way that proves it is really fixed.

Completion is determined not by the agent's own claim, but by running the full test suite (npm run ci) and having it exit normally with all tests passing. The agent cannot rewrite these tests, and any rewrite is detected.

From here, I'll introduce what I actually tried, following the four elements introduced at the beginning.

A clear goal: If you just ask normally, the tests pass but the feature disappears

First, I had Kiro explain the app's structure and confirmed that the tests fail on the PR's branch. Orders also don't go through on the shop's screen, and all 12 test orders fail.

Next, I asked only "The tests are failing, so please fix them." In about 42 seconds the agent got all the tests to pass and asked, "Shall I commit?"

However, when I checked the changes, all the code for the feature added in the PR had been reverted to the same content as main. The result of git diff main was empty. The tests pass, but the feature the PR was meant to build is gone. The agent itself reported that "the differences are limited to comments and the like."

The workshop materials summarized that an ordinary prompt doesn't decide "what counts as done," "which files may be changed," "what to keep," or "how to report the result." If you don't say what should be kept, the agent will get the tests to pass in the easiest way. I experienced firsthand that passing the tests and being "fixed" are different things.

Keep running for a long time: Define the completion condition as a command and loop with /goal

Next, I rewrote the prompt with three elements. I wrote what counts as done (the full test suite exits normally and outputs that all tests pass), how far to persist with --max, and how to proceed through rules (the range of changes allowed, following the API agreements between services, stopping and reporting if it still doesn't pass after many tries, and so on).

Kiro's /goal automatically repeats planning, implementation, and verification of the completion condition. The cap on iterations is 5 by default and can be changed with --max.

Another point is to run it not with the usual agent but with a custom agent (ci-validator). ci-validator is configured so that it can only rewrite the app's code. The actual flow I ran was as follows.

# Launch Kiro CLI specifying the custom agent
kiro-cli chat --agent ci-validator

Once launched, pass the prompt containing the completion condition and rules with /goal.

/goal --max 15 Get this pull request's pipeline to green.

DONE means `npm run ci` exits 0 and prints VERDICT: green. That verdict is the
ONLY definition of done. Re-run `npm run ci` and read the verdict after every
change; your belief that a fix worked does not count.

RULES OF ENGAGEMENT:
  - Fix product code under services/<svc>/src/ only. The unit tests, the
    contracts in contracts/, the shared lib/, and the CI script are READ-ONLY.
  - Make the services obey contracts/. If a response disagrees with a contract,
    the service is wrong, not the contract.
  - Fixing one failure often reveals the next. Keep going until the verdict is
    green.
  - Trace a failing checkout across services with
    `npm run logs -- --cid <correlationId>`.
  - A failure that appears only under some fault seeds is NOT flaky. It is a real
    defect. Fix the root cause so it holds under every seed.
  - When the tax service is unavailable, follow the committed policy and document
    the choice in a DECISION: comment. Do not invent a different behavior.
  - If a gate will not pass after several attempts, STOP and report the exact
    failing output. Do not thrash.
  - Do not commit. Leave the changes in the working tree for review.

The first line is the objective, DONE means is the completion condition, and RULES OF ENGAGEMENT are the rules. The rules cover the range of changes allowed, following the API agreements between services, treating failures that occur only under some conditions as real defects, following the decided policy for tax handling, stopping and reporting if it still doesn't pass after many tries, and not committing.

This time it finished in the first loop, in 46 seconds. Even after the workflow's completion notification arrived, the parent agent said it wouldn't treat the notification alone as evidence and re-ran the tests itself. The result of the fix also differed from the case where I asked normally. Instead of reverting all the PR's changes, it fixed only the broken parts, and all the tests passed. However, the change that didn't match the API agreement between services (per-product handling) was reverted. If you want to keep that too, a person needs to change the agreement and add a test that verifies that feature to the completion condition.

Permissions: A prompt is a "request," a setting is "enforcement"

Let's look a bit more closely at the custom agent mechanism used here. A Kiro custom agent is a JSON configuration file that defines the job, the tools it can use, the paths it can write to, and the commands that are allowed or prohibited. Since the CLI checks these rules every time before a tool runs, unlike a prompt, there is no case of the agent not following them. If you put the configuration file in the repository, the same rules apply to the whole team and to headless execution.

Next, I deliberately asked this agent to do operations it was prohibited from doing. When I asked it to commit and push, the agent judged that "the user explicitly asked, so I should do it" and tried to execute, but it was blocked by the prohibition rules in the configuration. This is an example where the setting stopped it, not the prompt's judgment.

The workshop's ci-validator is placed at .kiro/agents/ci-validator.json in the repository, and its configuration described the job (completion is determined only by the test results, proceed without asking questions, don't commit), the tools it can use, the range it can write to (only the app's code), and the commands it may run and those it is prohibited from running (such as delete and push).

When I asked it to delete logs or discard changes, the agent judged on its own that "doing the same thing with a different command would be circumventing the rules," and did not execute it. When I created an agent that can only write documentation and asked it to fix code, it declined, saying "my role is documentation only."

Run without a laptop: Leave it to a headless pipeline

Finally, I ran it with no one present. Kiro CLI's headless execution (--no-interactive) runs a single instruction to the end and returns the result via an exit code. Since there is no one to approve, only the tools allowed by the configuration run, and everything else is denied.

npm run pipeline; echo "pipeline exit code: $?"

npm run pipeline is set up to run scripts/pipeline.sh. Its contents are the following three stages.

# Stage 1: Check the current state (don't stop even if it fails)
npm run ci || true

# Stage 2: Have the headless agent fix it (the output is also saved to a log with tee)
kiro-cli chat --no-interactive --agent ci-validator "$GOAL"

# Stage 3: Run the tests once more and use their exit code as the script's result
npm run ci

This is the instruction I had passed interactively in the /goal section, now run without a person by the same custom agent. For headless authentication, a Kiro API key (the environment variable KIRO_API_KEY) is used. It was already set up in the workshop.
Don't add the option that allows all tools (--trust-all-tools), because it would let the agent use even the tools prohibited in the configuration.

It succeeded in about a minute and a half. Along the way, there were several scenes where the agent tried to rewrite files via the shell and was denied, but it switched to the permitted write tool and fixed things. The agent's final report also honestly stated a point it hadn't verified itself: "I did not check the exit code." That is exactly why a gate that runs the tests separately from the agent at the end is needed.

Furthermore, when I deleted a single line from a test file, the unit tests passed, but the change to a read-only file was detected and it failed. The shortcut of the agent rewriting the tests to make them pass is blocked.

On the shop's screen as well, all 12 orders now go through.

I also checked the handling when the tax calculation service is down. Whether to let orders through with tax as 0 or to refuse orders is a business decision, so the agent isn't allowed to choose; a person decided in advance on "refuse orders." When I stopped the tax calculation service and placed an order, the order was refused, just as decided.

Up to this point, I ran things from my local terminal in the workshop environment. To really run it while you sleep, you need to decide what launches this script or command. The workshop materials introduced the following two options (they couldn't be tried in the workshop environment, so they were only introduced).

Option How it runs What to do in the morning
Build it into CI With GitHub Actions or similar, run the script above when a PR's tests fail. Check the PR's check results and the agent's records
Cloud sessions Run the agent in Kiro's cloud. Work continues even if you close your laptop, and a PR is created when it finishes Ask for the result, read the PR's diff, then merge

In cloud sessions, the agent runs in a sandbox on Kiro's cloud, and the repository is fetched on the cloud side. For that reason, your local working folder and personal settings (~/.kiro/) are not used; only the settings committed to the repository are used. Also, there is no mode in which a person approves changes one by one. The workshop materials explained that the safeguards are the sandbox itself, the /goal completion condition, and a human reviewing the PR the agent created before merging. It was also recommended to put the rules you always want enforced in the repository and to protect the main branch.

Conclusion

Using Kiro CLI, I attended a workshop on leaving the fix of a broken PR to an agent and having it prove that it was really fixed. Starting from seeing how, when asked normally, the agent deletes the feature to get the tests to pass, I experienced how adding the completion condition, permissions, and headless execution one by one turns it into something you can leave to run even when no one is there.

That said, this time the subject had its prerequisites in place. The test expectations and the human judgments, such as the handling of tax, were prepared in advance. In real work, preparing such checks may itself become a human's job, and I think that's where the preparation is hard.
Also, I believe that an ideal skill or agent that fits every use case doesn't exist at this point. Personally, I feel I'd like to grow skills and agents suited to my own work through daily accumulation.

I hope this article is helpful.


AWS re:Invent 2026まとめ情報

クラスメソッドは2026/11/30〜12/4にラスベガスで開催されるAWSカンファレンスイベント「re:Invent」を今年も特集しました。ぜひ一度ご覧ください。 re:Invent 2026ポータルサイトを見るAWS re:Invent公式サイトはこちら

Share this article

AWSのお困り事はクラスメソッドへ