
I often work with organizations that struggle with having confidence in their agents in production. They find their agentic workloads run smoothly most of the time, but occasionally they produce unpredictable results. Large language models (LLMs) are nondeterministic. You could attempt to build a deterministic system through an orchestration engine such as AWS Step Functions, but you would forfeit the power of a reasoning LLM. It would be nice to have something that is agentic but also a bit more deterministic. Agent Standard Operating Procedures (Agent SOPs) address this challenge. You can use the power of agentic AI but give yourself a more deterministic (or consistent) output. In this post, I show you how Agent SOPs work and how you can use them in your agentic workloads.
Background
Most modern LLMs are good at following directions, but because they’re essentially token generation engines, it can be difficult to get a consistent output. LLMs are inherently nondeterministic, meaning that if you give an LLM the exact same prompt over and over, you can expect slightly different results each time.
Nondeterminism becomes more of a problem when you use a reasoning LLM as part of an agentic workload. The agent uses an LLM to reason about the set of tools available and how it can use them to accomplish its goal. Occasionally an agent might behave unexpectedly, which might happen because of unexpected results using tools or an unclear prompt. Regardless, when an agent behaves unexpectedly, it’s often because there’s some ambiguity in the agent’s instructions, requiring it to fill in the gaps itself.
Agent SOPs are a concept that Amazon Web Services (AWS) introduced late in 2025 to better control the behavior of an agent. Agent SOPs act as a middle ground between the flexibility of an LLM and having a deterministic system. The SOP provides a clear set of instructions so the agent knows exactly how to operate, including in ambiguous situations that might otherwise produce unexpected results.
An Agent SOP is written in a markdown format with the following characteristics:
- It contains structured steps with RFC 2119 constraints, meaning keywords such as MUST, SHOULD, and MAY are used to provide precise control over agent behavior. This approach does a better job at guiding the agent without rigid, brittle scripting.
- Agent SOPs accept parameters that customize behaviors.
- Agent SOPs are straightforward to read and write. Both humans and LLMs can readily understand them.
- Agent SOPs can instruct agents to document their steps. This makes it more straightforward to debug what an LLM is doing and why.
Prerequisites
To follow along with this post, you need:
- An AWS account that has access to Amazon Bedrock models
- A command line interface (CLI) where you can run Python 3.11 or above
Code example
I’ve built an agent for a fictional nonprofit organization with the Strands Agents SDK to demonstrate how Agent SOPs can improve results from an agent. In this example, the agent performs two tasks: It writes grant proposals and thank-you emails for donations.
The GitHub project consists of three main files: a demo.py file, which illustrates a comparison of how an SOP can affect an agent’s output; agent.py, which demonstrates how an agent can use a SOP to gather clarifying data; and the sops/ directory, which contains two example SOPs. The first SOP provides guidance on how to write a donation thank-you email, and the second SOP provides guidance on how to write a grant proposal.
The following is the SOP to write thank-you emails for donations:
# Donor Thank-You Letters
## Overview
This SOP guides agents in writing personalized thank-you letters to donors who have made financial contributions. The goal is to ensure consistent, professional, and heartfelt communication that strengthens donor relationships and encourages continued support. This procedure applies to all monetary donations of any amount, from individual donors, corporate sponsors, and foundation grants.
## Parameters
- **donor_name** (required): Full name of the donor
- **donation_amount** (required): Specific dollar amount donated
- **donation_date** (required): Date the donation was received
- **program_name** (required): Specific program or project supported by the donation
- **impact_description** (required): How the donation will be used and its measurable impact
- **organization_name** (required): Name of the nonprofit organization
- **engagement_opportunity** (optional): Specific next step for donor engagement (event, newsletter, volunteer opportunity)
## Steps
### 1. Gather and Validate Donor Information
Collect all required parameters before beginning the letter.
**Constraints:**
- You MUST verify the donor's full name spelling is correct
- You MUST confirm the exact donation amount (dollar figure)
- You MUST identify the specific program or project the donation supports
- You MUST verify any special designation or restrictions on the gift
- If information is incomplete, You MUST pause and request missing parameters before proceeding because incomplete information will result in an unprofessional letter that could damage donor relationships
### 2. Personalize the Opening
Create a personalized greeting using the donor's name and express immediate gratitude.
**Constraints:**
- You MUST address the donor by name in the greeting (e.g., "Dear Jane," or "Dear Jane Doe,")
- You MUST reference the specific donation amount in the first sentence (e.g., "$500", not "your generous gift") because donors need to know you're acknowledging their specific contribution
- You MUST mention the specific program name in the first sentence because this shows you understand where their money is going
- You MUST use conversational language like "Thank you so much" or "We're so grateful" because this creates warmth and connection
- You MUST NOT use generic greetings like "Dear Donor," "Dear Friend," or "Dear Supporter" because these feel impersonal and mass-produced
- You MUST NOT use formal phrases like "We are pleased to acknowledge" or "We wish to thank you" because these sound corporate rather than heartfelt
- You MUST NOT omit the specific dollar amount from the opening because this makes the letter feel generic
- You SHOULD keep the opening to 1-2 sentences maximum
- You SHOULD express genuine enthusiasm with phrases like "so grateful," "means the world," or "thrilled"
- You MAY vary the greeting style based on donor relationship (first-time vs. recurring)
### 3. Connect to Mission and Impact
Explain how the donation will be used through specific, measurable impact.
**Constraints:**
- You MUST include at least TWO specific numbers in the impact statement (e.g., "10 children," "50 meals," "3 months of tutoring") because quantifiable impact helps donors understand the concrete difference they're making
- You MUST explain exactly what the donation will fund (e.g., "reading materials and workbooks") because vague descriptions like "program support" don't help donors visualize their impact
- You MUST connect the donation to measurable outcomes with percentages or quantities because this demonstrates accountability and effectiveness
- You MUST use concrete, vivid language that helps the donor visualize impact
- You MUST NOT use vague phrases like "help our community," "make a difference," or "support our work" because these are meaningless without specifics
- You MUST NOT write generic impact statements that could apply to any donation because personalization is key to donor retention
- You MUST NOT omit specific numbers or quantities because this makes the impact feel abstract rather than real
- You SHOULD include 2-3 sentences for this section
- You SHOULD reference organizational track record with specific metrics (e.g., "Last year, 85% of participants...")
- You SHOULD use active, present-tense language (e.g., "Your gift will provide..." NOT "Your gift will help us provide...")
- You MAY include relevant statistics about program effectiveness
- You MAY share a brief story or example with specific details
### 4. Express Authentic Gratitude
Convey genuine appreciation for the donor's support.
**Constraints:**
- You MUST use warm, personal language like "We're so grateful," "Thank you again," or "Your generosity is changing lives" because authentic emotion strengthens donor relationships
- You MUST acknowledge the donor's partnership with phrases like "partner in our mission" or "have you as part of our community" because this makes them feel valued beyond their money
- You MUST keep this section to 1-2 sentences because brevity maintains impact
- You MUST NOT use formal phrases like "We wish to express our appreciation," "Your contribution is valued," or "We are grateful for your consideration" because these sound like corporate boilerplate
- You MUST NOT use generic phrases like "Thank you for your support" without additional context because this feels perfunctory
- You MUST NOT be overly effusive or insincere because donors can detect inauthentic gratitude
- You SHOULD write as if speaking to a friend or valued partner
- You SHOULD use contractions (e.g., "We're" instead of "We are") to sound more conversational
### 5. Provide Next Steps and Engagement Opportunities
Include at least one specific way for the donor to stay connected.
**Constraints:**
- You MUST provide at least ONE specific engagement opportunity with concrete details because vague invitations are rarely acted upon
- You MUST include specific dates, links, or contact information where applicable because this removes barriers to engagement
- You MUST NOT use vague phrases like "contact us if you have questions" or "let us know if you'd like to get involved" because these place the burden on the donor and are too generic
- You MUST NOT provide engagement opportunities without any specific details because this makes them meaningless
- You SHOULD include upcoming events with specific dates (e.g., "Spring Reading Celebration on April 15th")
- You SHOULD include newsletter signup with specific benefits (e.g., "quarterly updates about the program's progress")
- You SHOULD include volunteer opportunities with specific activities (e.g., "volunteer as a reading tutor on Tuesday afternoons")
- You MAY customize engagement opportunities based on donation level
- You MAY offer multiple ways to stay involved (2-3 options)
### 6. Close with Warmth
End with a warm closing that reinforces gratitude and partnership.
**Constraints:**
- You MUST reiterate thanks
- You MUST use "Happy reading," as the closing phrase because this is the organization's signature sign-off that reinforces the literacy mission
- You MUST sign with appropriate name and title after "Happy reading,"
- You MUST NOT use other closing phrases like "With gratitude," "Sincerely," "With sincere appreciation," or "Best regards" because "Happy reading," is the required organizational standard
- You SHOULD reinforce the donor's impact in the final sentence before the closing
- You MUST verify the final letter is between 150-250 words because letters under 150 words feel rushed and letters over 250 words lose the reader's attention
- You MUST verify all required parameters are included because missing information makes the letter feel incomplete
- You MUST verify the tone is warm and conversational throughout because formal tone reduces donor connection
## Examples
### Example 1: Complete Donor Thank-You Letter
**Input Parameters:**
- donor_name: "Jane Doe"
- donation_amount: "$500"
- donation_date: "March 15, 2026"
- program_name: "Youth Literacy Program"
- impact_description: "reading materials, workbooks, and one-on-one tutoring support for 10 children in our after-school program this semester"
- organization_name: "Joy of Reading Institute"
- engagement_opportunity: "Spring Reading Celebration on April 15th and quarterly updates about the program's progress"
**Output:**
```
Dear Jane Doe,
Thank you so much for your generous donation of $500 to our Youth Literacy Program. Your support means the world to us and to the children we serve.
Your gift will provide reading materials, workbooks, and one-on-one tutoring support for 10 children in our after-school program this semester. These resources will help them build the foundational literacy skills they need to succeed in school and beyond. Last year, 85% of our program participants improved their reading level by at least one grade—and your contribution makes that possible.
We're so grateful to have you as a partner in our mission to ensure every child has access to quality literacy education. If you'd like to see the program in action, we'd love to invite you to our Spring Reading Celebration on April 15th. We'll also be sending you quarterly updates about the program's progress.
Thank you again for investing in our community's children. Your generosity is changing lives.
Happy reading,
[Name]
[Title]
Joy of Reading Institute
```
### Example 2: Poor Letter (What NOT to Do)
**Output:**
```
Dear Donor,
Thank you for your recent contribution to our organization. We appreciate your support.
Your donation will help us continue our important work in the community. We rely on generous donors like you to fund our programs and services.
If you have any questions, please contact our office.
Sincerely,
[Name]
```
**Why this fails:**
- Uses generic greeting "Dear Donor" instead of donor's name
- No specific donation amount mentioned
- No specific program referenced
- Vague impact statement ("help us continue our important work")
- No specific engagement opportunity
- Too short (55 words, below 150-word minimum)
- Overly formal, corporate tone
## Troubleshooting
### Missing Parameter Information
If you don't have all required parameters, pause and ask the user for the missing information. Explain which specific parameters you need and why they're important for creating an effective thank-you letter.
### Letter Feels Too Generic
If the letter sounds like it could apply to any donor or any organization, you haven't included enough specific details. Go back and ensure you have:
- Donor's actual name in the greeting
- Exact dollar amount in the opening
- At least 2 specific numbers in the impact statement
- Specific program name mentioned
- Concrete engagement opportunity with dates/details
### Letter is Too Long or Too Short
Aim for 150-250 words. If too short, expand the impact statement with more specific details about outcomes. If too long, remove unnecessary adjectives and focus on the most compelling impact metrics.
### Tone Feels Too Formal
Replace formal phrases with conversational language:
- "We wish to express" → "We're so grateful"
- "We are pleased to acknowledge" → "Thank you so much"
- "Your contribution is valued" → "Your generosity is changing lives"
- Use contractions (we're, you're, it's) to sound more natural
As you look through the SOP, notice it lists expected parameters and whether they’re required or not. The SOP lists steps the agent can take. If some of the required parameters are missing, the agent would stop and request additional information. The remaining steps discuss how the thank-you email should be written, and some good and bad examples are provided.
To run the example, run pip install -r requirements.txt to install the dependencies, and then run python demo.py
In this example, two sample emails are generated. The first is without SOP guidance:
Dear Mary,
Thank you for your generous donation of $450 to AnyCompany Nonprofit on December 31, 2025. Your kindness and commitment to youth literacy truly inspire us.
Because of donors like you, we can make a real difference in the lives of young readers. Your contribution will put approximately **90 books** into the hands of children through our Joy of Reading program—opening new worlds, sparking imagination, and building essential literacy skills that will serve them throughout their lives.
The Joy of Reading program is one of our cornerstone initiatives, and it simply wouldn't be possible without supporters like you who believe in the power of literacy to transform lives. Every book we place in a child's hands is a step toward a brighter future, and you've made 90 of those steps possible.
We would love to keep you updated on the impact your donation is making. If you haven't already, we invite you to subscribe to our newsletter, where you'll receive stories from the children and families we serve, program updates, and news about upcoming opportunities to get involved.
Thank you again for your compassionate support and for choosing to invest in our community's young readers.
With gratitude,
[Signature]
[Name]
[Title]
AnyCompany Nonprofit
The second email is with SOP guidance:
Dear Mary,
Thank you so much for your generous donation of $450 to our Youth Literacy Program. Your support means the world to us and to the young readers we serve.
Your gift will provide 90 books for children in our Joy of Reading program. These books will go directly into the hands of young readers who are building their love of reading and developing the literacy skills they need to succeed in school and beyond. Last year, participants in our Joy of Reading program showed measurable improvement in both reading comprehension and enthusiasm for books—and your contribution makes that possible.
We're so grateful to have you as a partner in our mission to ensure every child has access to quality literacy education. We'd love to keep you connected with quarterly updates about the Joy of Reading program's progress and the impact your gift is making. You can sign up for our newsletter at [newsletter signup link] to receive stories from the children you're helping and program milestones.
Thank you again for investing in our community's young readers. Your generosity is changing lives.
Happy reading,
[Name]
[Title]
AnyCompany Nonprofit
Although both emails are good, the email with SOP guidance provides more detailed information around the donor’s impact and the organization’s mission, and it uses the tone and voice of the organization. (For example, it finishes the message with “Happy reading,”.)
You can also see an example of using SOPs to write grant proposals by invoking:
python demo.py --sop grant-proposal
In each case, the SOP helps the agent generate text that is aligned with the organization’s brand, voice, and requirements.
Getting started
You can author your own custom SOPs by hand, write them with your preferred AI offering, or copy an existing SOP and make changes. The Strands Agent SOP GitHub repository has some good SOP examples you can start with.
After you’ve created an SOP, you can add it to your agent using the system prompt. As an example, my code looks like the following example, where CONTEXT could contain “donor communications” or “grant writing,” SOP_CONTENT is the text of the SOP, and MODEL_ID is the Amazon Bedrock model ID of the LLM you want to use:
system_prompt = f"""You are a helpful assistant for a nonprofit organization. You help with {CONTEXT}.
You must follow these Standard Operating Procedures:
{SOP_CONTENT}
Always adhere to the quality standards and procedures outlined in the SOP above.
IMPORTANT: The progress tracking logs, resumability notes, and step completion messages in the SOP are for your internal process only. Do NOT include them in your final output. Only provide the final letter or document requested by the user."""
agent_with_sop = Agent(model=MODEL_ID, system_prompt=system_prompt)
After the agent has been created, you can generate a thank-you letter with this code:
result = agent_with_sop ("Write a thank-you letter for a donation")
If the agent doesn’t have enough information to complete the task as defined in the SOP, it will return and ask for additional information. After the agent has enough information to complete the task the way it’s been defined in the SOP, it will generate results.
The agent.py file is an example agent that loads the SOP for thank-you emails so you can interact with it. I’ll start by running the agent from the command line:
python agent.py
The agent pauses so I can provide instructions. I type:
I'd like a thank-you note to a donor who gave $300
The agent evaluates its SOPs and realizes it doesn’t have enough information to proceed. It identifies the data it needs to continue and pauses again. I enter:
The donor is Carlos Salazar. The date we received the donation was January 1, 2026. The donation will go to our "Reading for Success" program, which is one of our reading programs here at AnyCompany Nonprofit. Every $1 donation helps us put 1 book in the hands of a child. Every $30 donation helps us provide enough books for a classroom of students for 1 month. We deliver books to classrooms during the school year (August through May). Higher reading exposure was 95% positively correlated with a region of the brain supporting semantic language processing. We have also seen that 61% of low income families have no books in their home, so every book we can make available to a child helps support their growing brains. We'd like people to sign up for our newsletter so they can stay aware of what we're doing. They can subscribe at this URL: [https://anycompany-nonprofit/newsletter/]
The agent now has enough information to proceed, so it generates a thank-you email based on the instructions in the SOP, as shown in the following screenshot:
Figure 1: Using SOPs to generate an example donor thank-you message
Conclusion
SOPs are an effective method to get consistent, reliable output from agentic workloads. You can use the capabilities of LLMs while providing clear instructions, which helps prevent unexpected agent behavior. SOPs can be used in your agentic workloads, but you can also use them in other AI services. For example, you can add them as steering docs to your Kiro workspace so that any generated code adheres to your SOPs.
If you’re experiencing inconsistent results from your production agents, consider experimenting with implementing an SOP for your most critical workflow. The Strands Agents SDK GitHub repository includes templates you can adapt to your needs. As you refine your SOPs, consider contributing your examples back to the community. Production-tested SOPs help everyone building reliable agentic systems. To learn more, contact your AWS account team or the AWS Public Sector team.