![[Report] I Attended a Workshop on Learning the Basic Design of Multi-Tenant AI Agents with Kiro specs and Strands Agents #AWSreInvent #DVT337](https://devio2024-media.developers.io/image/upload/f_auto,q_auto/c_limit,w_1200/v1796065673/eyecatch/xw5jr5b9agc6qjxlknmg.png)
[Report] I Attended a Workshop on Learning the Basic Design of Multi-Tenant AI Agents with Kiro specs and Strands Agents #AWSreInvent #DVT337
This page has been translated by machine translation. View original
Introduction
Hello, this is Kanno from the Consulting Department, here at re:Invent.
Maybe because I couldn't sleep on the plane, I slept soundly on the day of arrival and have no jet lag, so I'm feeling great!
I attended a workshop at AWS re:Invent 2026 titled "Build a SaaS control plane with Kiro specs and Strands multi-tenant constructs (DVT337-R1)"! There was a self-introduction time at the start, and I was quite nervous speaking in broken English, but I'm sure my feelings got across... probably...
I'll quickly share an overview of the session and some points that might be useful!
Workshop Overview
- Title: Build a SaaS control plane with Kiro specs and Strands multi-tenant constructs (DVT337-R1)
- Level: 300 / Duration: about 60 minutes for Labs 1-3 (Lab 4 is optional, Lab 5 is for taking home)
- Environment: Browser-based Kiro IDE on Workshop Studio and a temporary AWS account (us-east-1; event-only, no self-paced version)
The subject is a fictional customer support SaaS called "Unicorn Support", which is set to onboard its next 50 customers.
You build a setup where a single support AI agent safely handles inquiries from two companies on different plans (Acme on the standard plan and Globex on the premium plan).
The setup is a bit hard to follow, but it helps to understand it this way: you build one helper chatbot that references tenant information, selects what information to use per tenant, and makes sure tenants never get mixed up.

The flow of the Labs is as follows.
| Lab | What you do |
|---|---|
| Lab 1 | Rewrite one requirement in the Spec, have Kiro implement it, and deploy with CDK |
| Lab 2 | Register Acme and Globex via the API and compare the published configurations |
| Lab 3 | Fix the hole that lets one tenant read another tenant's tickets, using the Spec |
| Lab 4 (optional) | Fix the shared sandbox so it is created for each tool call |
| Lab 5 (optional) | Start spec-driven development with the public reference |
Design Points to Keep in Mind for SaaS AI Agent Development
Don't Make Adding Tenants a Manual Task
In Lab 1, you build a small control plane with API Gateway, Lambda, DynamoDB, and Parameter Store. When you call the tenant creation API, it finishes saving the configuration and the tenant becomes available.

If you resend the same content with the same client token, it returns the already-created tenant, and if only the plan (tier) is changed, it returns 409. The administrator's email is used only for provisioning and is designed not to appear in responses, public configuration, or logs.
This is more about multi-tenant implementation than AI agents, but it's important: idempotency and the line around personal information are hard to fix later, so it's essential to include them in the specification from the start.
Manually deploying tenants every time would be painful, so it's worth thinking carefully about an automation mechanism.
Change Per-Tenant Behavior Through Configuration
Behavior changes per Tier (the pricing structure of the service; you may be familiar with terms like Standard or Pro plans). Acme (standard) gets concise responses, while Globex (premium) gets urgent prioritization and follow-up suggestions. The definitions of this behavior and the system prompt are placed in Parameter Store, and we build a mechanism where the agent loads them from the API on every request.

Increasing the number of agents per tenant tends to break operations, so injecting only configuration into common code makes sense. I want to build it so it can respond as flexibly as possible.
In the session, Kiro did the implementation in this area: after modifying the design files and clicking a few buttons, it implemented things nicely. Very helpful.
Determine the Tenant from the Authenticated Identity
In the initial agent of Lab 3, if you ask as Alice from Acme, "Show me GLBX-3390," the Globex ticket is returned as is. Getting another tenant's information back is bad, isn't it...
A system prompt can't protect the access boundary, so it ends up relying on luck.
So we determine the tenant from the authenticated identity (TenantContext) and create tools fixed to that tenant for every request.
I think it's important to extract authenticated user information from the token and always use it, and never trust information sent from the user as is, such as the request body.

The implementation looks like this.
def build_ticket_tools(context: TenantContext) -> list[Any]:
@tool(name="get_ticket")
def get_ticket(ticket_id: str) -> str:
# The tenant is passed from the authenticated context, not as an argument
ticket = find_ticket(ticket_id, tenant_id=context.tenant_id)
if ticket is None:
return f"No authorised match for ticket {ticket_id.upper()}."
return format_ticket(ticket)
return [get_ticket]
def invoke_local(identity_name: str, conversation_id: str, prompt: str) -> dict[str, Any]:
context = resolve_identity(identity_name, conversation_id)
configuration = load_support_agent_configuration(context.tenant_id)
agent = Agent(
model=DeterministicTicketModel(behavior=configuration.behavior),
tools=build_ticket_tools(context),
system_prompt=configuration.system_prompt,
callback_handler=None,
agent_id=context.session_id,
)
...
The only argument the model can pass to the tool is the ticket ID, so even if another tenant is written in the prompt, the search scope doesn't change. It's worth remembering to protect through code and tool design rather than through prompts. Let's protect what we want to protect through mechanisms like this!
Restrict Configuration Reads by Tenant Too
There are points to be careful about not only in the app but also in the infrastructure configuration.
After identifying the tenant from the authenticated identity, the agent issues a read-only token each time. This signed token contains the config-reader role and tenant_id, and the flow is to reference the configuration in Parameter Store via the API. Fixed tokens placed in environment variables or tenant names written in the prompt are not used.
However, just having a read-only role could allow someone to specify another tenant's URL and read another company's configuration. So verification is done in two stages: API Gateway and Lambda.

- API Gateway authorizer
- Only lets the operator role through for the admin API and only the config-reader role for the configuration read API. The authorizer for reading has its cache set to 0 seconds and verifies the token every time
- Lambda for reading configuration
- Matches the tenant_id signed in the token against the tenant in the URL. If they don't match, it returns 403 before reading DynamoDB or Parameter Store, so the caller can't even tell whether another tenant exists
With this two-stage verification, even if another tenant is specified, other companies' configuration can't be read, firmly prevented by the mechanism. We want to cover this with mechanisms and not rely only on implementation.
Separate the Code Execution Environment for Each Tool Call
In Lab 4, we add a tool that aggregates a CSV ticket list in a sandbox (a local substitute for AgentCore Code Interpreter). Initially, one sandbox was shared across all requests, so both companies' files remained and the sandbox was never stopped.
It would be awful if someone accessed the sandbox somehow and obtained another tenant's information...

@tool(name="analyse_ticket_export")
def analyse_ticket_export() -> str:
sandbox = start_session()
try:
sandbox.upload("tickets.csv", _authorised_export(context))
try:
result = sandbox.run_counts_by_priority("tickets.csv")
except AnalysisError as error:
return _encoded_analysis_error(error)
return _encoded_analysis_result(
sandbox.session_id,
sandbox.list_files(),
result,
)
finally:
sandbox.stop()
So after the fix, the tool takes no arguments, creates a sandbox for each call, places the file under a fixed name (tickets.csv), and always stops it in finally. For tools that handle files, sharing makes it easy for other tenants' data to remain, so it's reassuring to design them to be created each time and reliably stopped.
The Public Repository It Was Based On
The public AWS reference that the workshop was based on contains eight multi-tenant AI agent samples.
https://github.com/aws-samples/sample-agentic-ai-acceleration-patterns

I think it's educational to take a look at this too! I'd like to dig deeper as well!
Conclusion
There wasn't much Strands-specific content and it was basic overall, but I felt it was a good refresher on the considerations when building a multi-tenant SaaS! Tenant permissions are something we want to handle strictly...!
Thank you for reading this article to the end!!
