
Weekend Agent Challenge: Gatekeeper — An Always-On Agent That Knows When to Ask
An EventBridge-scheduled agent that monitors my apps and drafts a morning digest with Bedrock, while the only outward-facing action — publishing — stays behind a human approval gate.
Vision & What the Agent Does
I run twelve small production apps as a solo builder. Nobody checks them at
3 AM, and nobody reads the AWS What's New feed for me either. That is exactly
the kind of work an always-on agent should do — but it is also the moment I
trust an agent least, because it runs while I sleep and I can't supervise it.
Gatekeeper is my answer to that tension. Every night at 03:00 JST, EventBridge
Scheduler wakes a Lambda function. Inside it, an agent built with the Strands
Agents SDK and Claude Sonnet 4.6 on Amazon Bedrock checks the health of all
twelve apps over HTTP, pulls the last 24 hours of AWS announcements, and
drafts a morning digest: which apps are slow, which announcements actually
matter to my stack, and up to three suggested actions for tomorrow.
Then comes the part I care about most. Everything the agent does autonomously
is read-only. The single outward-facing action — publishing the digest to a
public URL — is not executed. It goes into a DynamoDB approval queue, and the
morning report lands in my inbox via SNS with three links: approve, reject,
and the URL the digest will live at if I approve. Until I click approve, the
public page returns 404.
The design rule I gave myself: the approval gate must be enforced in code, not
in the prompt. The night-run Lambda has no code path that publishes anything,
and its IAM role can only write new pending items. Only the approval endpoint,
holding a single-use token that never passes through the model, can flip a
digest to public. A prompt injection in the news feed could make the agent
write a weird digest, but it cannot make the digest public.
How You Built It
I started from the success condition rather than the architecture: "the agent
runs on a schedule, does useful read-only work, and one privileged action
waits for a human." From there the pieces fell into place in an evening.
The agent itself is small. Strands lets me define two Python tools —
check_app_health and fetch_aws_news — and hand them to the model with a
system prompt that demands every statement be grounded in tool output. The
handler wraps the agent: it stores the digest as pending with a random
token, then emails the report. Deciding what to say is the model's job;
deciding what is allowed to happen is the handler's job.The one real fight was a 403. My approval endpoint is a Lambda Function URL
with auth type NONE, and the classic
lambda:InvokeFunctionUrl resource
policy that has worked for years kept returning Forbidden. It turns out that
since October 2025, new Function URLs also require lambda:InvokeFunction ,
ideally scoped with the lambda:InvokedViaFunctionUrl condition key. My first
fix attempt failed too, because FunctionUrlAuthType is not a valid condition
for that second action. Two permission statements later, the gate opened.A smaller stumble: the digest renders Markdown tables, and Python's
markdown
library ignores tables unless you enable the extension. The first published
digest had a wall of pipes in it.AWS Services Used / Architecture Overview
EventBridge Scheduler (cron in Asia/Tokyo, so no UTC math) triggers the
night-run Lambda. That function calls Amazon Bedrock cross-region from Tokyo
to us-east-1, writes to DynamoDB, and publishes the report through Amazon SNS.
A second Lambda behind a Function URL handles approve, reject, and the public
view, guarded by a constant-time token compare and a conditional write so each
digest is decided exactly once. The whole stack is one CloudFormation
template; deploy is a zip upload plus
aws cloudformation deploy .Flow: Scheduler → Lambda (Strands + Bedrock) → DynamoDB + SNS → human clicks
a link → approval Lambda → digest goes public.

What You Learned
EventBridge Scheduler's timezone-aware cron is a small feature that removes a
whole class of bugs. The October 2025 Function URL permission change cost me
an hour and taught me to distrust "policies that always worked." But the
bigger lesson is architectural: "human in the loop" becomes real only when the
loop is enforced by IAM and code paths rather than by instructions to the
model. An agent you run at 3 AM should be physically unable to do the things
you would want to review — then you can let it run every night without
thinking about it.
First night's verdict, drafted while I slept: all twelve apps healthy, five
announcements worth reading, one of them directly relevant to how this very
agent stores its Lambda code.
Link to App or Repo
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article