5 views
This guide focuses on EventBridge agent backbone for production systems, with practical trade-offs for reliability, security, and cost.
If a tool takes three minutes (terraform plan, warehouse query, image build), do not hold the Bedrock turn open. Emit an event, return a correlation id, and let the agent poll get_job — or resume via Step Functions callback. Day 34 makes EventBridge the async backbone.
⚡ TL;DR: Sync tools for <2s work; async via EventBridge for longer. Persist job state in DynamoDB with idempotency. Teach the model the start/get contract; cap polls in the graph.
EventBridge agent backbone: production guidance
start_job(args, idempotencyKey)
→ DynamoDB PENDING (conditional)
→ PutEvents JobRequested
→ return {jobId}
Worker rule → run → SUCCEEDED|FAILED + result pointer
get_job(jobId) → status for next agent turn
python
import uuid, time, json, boto3
ddb = boto3.resource("dynamodb").Table("AgentJobs")
eb = boto3.client("events")
def start_job(tenant: str, tool: str, args: dict, idem: str) -> dict:
job_id = str(uuid.uuid4())
try:
ddb.put_item(
Item={
"pk": f"tenant#{tenant}",
"sk": f"idem#{idem}",
"jobId": job_id,
"status": "PENDING",
"tool": tool,
"createdAt": int(time.time()),
},
ConditionExpression="attribute_not_exists(sk)",
)
except ddb.meta.client.exceptions.ConditionalCheckFailedException:
prev = ddb.get_item(Key={"pk": f"tenant#{tenant}", "sk": f"idem#{idem}"})["Item"]
return {"jobId": prev["jobId"], "deduped": True}
eb.put_events(Entries=[{
"Source": "agent.tools",
"DetailType": "JobRequested",
"Detail": json.dumps({"jobId": job_id, "tenant": tenant, "tool": tool, "args": args}),
"EventBusName": "agents",
}])
return {"jobId": job_id, "deduped": False}
Why EventBridge
Rules fan out to workers, metrics, and security audit without hard-coding consumers. You can still target SQS for buffering. Schema discipline prevents silent payload drift.Production checklist
- [ ] Job table with status enum + TTL
- [ ] Idempotency on start_job
- [ ] DLQ on worker failures
- [ ] Prompt/tool docs describe async contract
- [ ] Trace
jobIdacross EventBridge → worker - [ ] Poll cap in Step Functions / agent loop
Series navigation
← Day 33 · Day 35 → Last updated September 11, 2026 Related: EventBridge Scheduler: Overnight Agent Batches Without Cron Drift; Day 51: Multi-Agent Roles: Planner, Implementer, Critic; Day 53: Avoiding Agent Ping-Pong.Watch: 100 Days of AI on YouTube
Short videos from CheatCoders, one AI engineering topic per day.
Most viewed
- Python Decorators Explained: From Simple Wrappers to Production Patterns
- Claude Code vs Cursor vs GitHub Copilot: Choose by Workflow, and Set Up One Repo That Works With All Three
- AI Agent Frameworks in 2025: LangGraph vs CrewAI vs AutoGen vs Raw API
- Python String Methods: Every str Method With Real Production Examples
- Css Animation Performance: Performance-Optimized Motion for Modern UIs
Newly added
- AWS Systems Manager Parameter Store: Hierarchical Runtime Config for Coding Agents
- Amazon Cognito Identity Pools: Federate Coding-Agent Tool Callers Without Long-Lived Keys
- Amazon Athena for Coding Agents: Query Tool Audit Logs and Eval Traces on S3 Without a Warehouse
- AWS Batch for Coding Agents: Parallel Overnight PR Reviews and Long-Running Jobs Without Lambda Timeouts
- Amazon Bedrock Prompt Management: Version and A/B Test Coding-Agent System Prompts
Deep-dive PDF
Get the expanded guide for this post — extra diagrams-style checklists, failure modes, and a production walkthrough. Free when you subscribe to CheatCoders.
Already subscribed? or open the subscribe page.
Discover more from CheatCoders
Subscribe to get the latest posts sent to your email.
