iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
📖

re:Invent 2025: Customizing Agentic AI Models with SageMaker AI and Bedrock

に公開
2025/12/08

Introduction

By transcribing various overseas lectures into Japanese articles, we aim to make hidden, high-quality information more accessible. This project presents the following presentation!

For transcription articles of re:Invent 2025, please check the information summarized in this Spreadsheet.

📖 re:Invent 2025: AWS re:Invent 2025 - Customize models for agentic AI at scale with SageMaker AI and Bedrock (AIM381)

This video introduces new features for building agentic AI applications using SageMaker. Serverless model customization allows foundation models to be customized with domain-specific data, utilizing various fine-tuning techniques including reinforcement learning. Serverless MLflow provides unified management of experiment logs, evaluation metrics, and agent traces, available at no extra charge. With new steps in SageMaker Pipelines, you can automate everything from model customization to deployment on Bedrock or SageMaker endpoints. Serverless Model Evaluation enables model assessment using industry-standard benchmarks such as AI as a judge. For inference optimization, speculative decoding achieves up to a 2.5x latency reduction, and deploying multiple foundation models to the same endpoint can lead to cost savings of up to 50%. The demo showcased an end-to-end workflow, from fine-tuning a Qwen 2.5 model to evaluation and deployment to the Agent Core runtime, through the construction of a medical triage agent.

https://www.youtube.com/watch?v=OwcwLZPJ43s
Please note that this article is automatically generated while maintaining the content of the original presentation as much as possible. Be aware that there may be typos or incorrect information.

Main Content

Four Challenges in Building Agentic AI Applications

Welcome, everyone. This session is for data scientists and AI developers who want to customize and deploy models at scale to build high-quality, cost-effective agentic applications. In today's session, we will also cover new launches that were just announced in the AI keynote. Let's get started.

Thumbnail 30

Two trends are emerging in the market. First, we are seeing rapid adoption of agentic AI in enterprise software applications, with adoption expected to grow from 1% in 2024 to 33% by 2028. That is a 33x increase in just four years. Furthermore, organizations expect that 15% of these decisions will be made autonomously by agents by 2028, which will require a significant amount of compute and models that can be used to deliver high-quality, cost-effective, and fast inference.

Thumbnail 70

Thumbnail 80

Customers are increasingly relying on open-source models to build these applications. However, despite the significant opportunities and clear prospects on how to build these applications, the vast majority of them never reach production. Let's look at four key challenges blocking these applications from being deployed to production.

First, customers lack standardized tools to customize models, causing them to spend time building these workflows from scratch. When it comes time to bring these workflows into production, they are often cobbled together with glue code, necessitating a rewrite with production-grade tools to build pipelines that facilitate repeatable and scalable workloads. This often delays projects and leads to a lot of manual work.

Second, customers lack tools that provide a unified view of model and agent observability. With fragmented tools, it becomes much harder to debug the root cause of failures or respond when agent or model behavior drifts.

Third, model customization is evolving the need for tracking ML assets. Previously, customers could monitor, track, and version control models, ensuring they were cataloged in the right place to meet governance and compliance requirements. Now, they also need to account for reward functions used in reinforcement learning, prompts, and more, which often leads to building even more additional tools or integrations, delaying timelines.

Finally, customers need cost-effective, high-quality inference. Building an inference stack is highly complex. You need to find the right instances, benchmark them against different instance types, and ensure the right cost-to-performance ratio. You then need to do the same for the containers or different frameworks you are using, which often leads to a lot of manual work and delays in deploying applications to production. Sometimes the ROI does not look right because inference is too expensive.

Announcement of Serverless Model Customization: A Fully Managed Fine-Tuning Experience

Let's take a look at the key capabilities SageMaker is offering to address these challenges. I am Amit Modi, Senior Manager for Model Operations and Inference. Joining me is Shelbee, Senior Worldwide Specialist Manager for Gen AI. Today, we will cover the key SageMaker features that help address these challenges, and then Shelbee will demonstrate all of these features in action.

Thumbnail 220

Today, we are announcing the launch of serverless model customization. Serverless model customization provides the widest selection of foundation models that can be customized based on an organization's domain-specific or proprietary data. In addition to this wide range of model choices, we also provide broad access to various fine-tuning techniques you can use to customize these models, including reinforcement learning. This experience is completely serverless, so you don't need to worry about reserving capacity or figuring out where the GPUs are. Just start your job, and we take care of all the infrastructure.

Thumbnail 260

Thumbnail 280

You can navigate to SageMaker Studio to find models. Under Models, you will see a list of all public foundation models and three different experiences. You can customize these models through the UI, SDK, or agent experience. Today's talk will primarily focus on the UI, but we will explore it in more detail during the demo. Clicking on the UI takes you to a managed experience. Here, you can select the base model and the fine-tuning technique you want to use to customize the model.

Thumbnail 300

Once you have selected that, you can upload your dataset. You can upload the dataset here, or if you already have a dataset being tracked in SageMaker, you can simply select that dataset. You can then choose the reward function you want to use for customization.

Thumbnail 310

Thumbnail 320

You can choose from various reward functions or bring your own code. You can enter the code manually, or bring a Lambda function that executes the reward function. Then, you can select one of your already registered Lambda functions to start fine-tuning. In the background, SageMaker periodically saves job checkpoints. This ensures that even if a node in the cluster running your job fails, we can replace it with a healthy node and resume the job from the last checkpoint, allowing you to use only the compute you need without wasting resources. If a job fails for any reason, you will always have the last checkpoint, which you can use to restart the training job.

Thumbnail 350

Thumbnail 370

Integrated Observability with SageMaker Pipelines and Serverless MLflow

Once you have built these workflows, you can use SageMaker Pipelines to perform further customization and deploy these applications to production. Today, we are announcing new pipeline steps specifically designed for model customization and deployment. Deployment is possible not only to SageMaker endpoints but also to Bedrock if you are using Bedrock as your inference technology. These new pipeline steps accelerate development by using purpose-built pipeline steps that are already available, so you don't need to write integrated code for data processing integration with Serverless EMR, deployment to Bedrock, or training jobs within SageMaker. If you have code already written for experimentation in a notebook, you can annotate that code with the @step decorator or use the UI to upload this code and convert it into a fully functional pipeline. Pipelines are serverless, so you don't need to worry about managing infrastructure. Since all metrics are logged to CloudWatch, you can go there to debug any issues.

Thumbnail 420

Thumbnail 430

Next, let me introduce the launch of Serverless MLflow, which we announced yesterday. Serverless MLflow solves the fragmented observability problem mentioned earlier. When customizing models, you can log experiments, as well as evaluation metrics and post-deployment agent traces. Serverless MLflow is fully managed. You don't need to set up servers. As inference or training traffic increases, we handle the compute setup for you. Serverless MLflow scales up based on traffic and scales down when the infrastructure is no longer needed. Additionally, there is no extra charge for MLflow. You can use SageMaker to log all your metrics to Serverless MLflow without worrying about the impact on pricing.

Thumbnail 460

Thumbnail 480

Serverless MLflow is also deeply integrated into the experience. Looking at the fine-tuning experience, once you kick off a job, performance metrics start appearing in the model details as the job completes or execution begins. Since MLflow is deeply embedded here, you can navigate from here to MLflow to check richer metrics if you want to look deeper. It is also easily accessible under Applications if you want to leverage it in other workflows. Under specific runs, you can now check all experiments performed across different fine-tuning jobs. You can compare these metrics to look deeper and select the fine-tuned model that suits you. After selecting a fine-tuned model here, you can start evaluating it.

Thumbnail 500

Thumbnail 510

Thumbnail 530

Serverless Model Evaluation and Partner Application Integration

Today, we are announcing the launch of Serverless Model Evaluation within Studio. As part of this experience, we provide industry-popular benchmarks that you can use to evaluate your models. This experience is also completely serverless, so you don't need to worry about managing instance types. You simply kick off an evaluation job, and the execution is performed on your behalf. Let's see how this experience works. In the evaluation experience, you just select one of the techniques. In this case, we select "AI as a judge." You can also define the metrics you want to use, allowing you to select the appropriate quality metrics. These are the most commonly used benchmarks in the industry.

Thumbnail 560

Thumbnail 570

Since responsible AI is now a critical aspect of releasing models, we provide metrics "out of the box" that allow you to measure content and set up guardrails. When launching evaluation metrics, you can also provide a prompt template, so you know exactly how the selected model evaluates those requests. When you run these metrics, you will see results for both quality metrics and responsible AI content for not only the fine-tuned model but also the base model. This makes it easier to determine whether the model has actually improved in both aspects.

Thumbnail 590

After deploying these models to production, if you are building an agentic application on top of them, or even if you are just building an agentic application, agent observability is already integrated into CloudWatch, so you can have all dashboards to monitor traces. However, if you are also leveraging model customization, you can use AgentCore observability to send OpenTelemetry-formatted metrics to managed MLflow or partner AI applications.

Thumbnail 620

Let's briefly look at how you can use these metrics in managed MLflow and partner AI applications. This is a screenshot of what the experience in managed MLflow looks like. On the left, you see a full trace tree starting from the agent invocation, drilling down through the workflow building process, capturing each LangChain operation, and displaying calls to tool invocations and multiple assistant interactions (Assistant 1, Assistant 2). This hierarchical view gives you full visibility into each step of the agent.

Thumbnail 650

Since we also provide partner applications as managed features on SageMaker, you can simply launch and start. Some customers who choose to use Comet ML to track experiments and evaluate models can log these metrics to Comet ML and use that information to debug root causes for both agents and ML. Comet also provides specific key features such as the ability to provide goals to optimize prompts and optimize agents. It takes the final goal, continues running evaluations, and optimizes prompts until you get the best one.

Thumbnail 690

Thumbnail 710

We have also enabled DeepChecks, which allows you to test, evaluate, and monitor LLM maps and agents. This provides a more comprehensive view. You can also manually and automatically annotate all interactions with the LLM to get more comprehensive reports. This makes it easier to identify root causes and debug issues. And finally, we have Fiddler, which allows you to perform agent observability and then trace back to the root cause of every single model customization experience.

Thumbnail 720

Inference Optimization and Latency Reduction via Speculative Decoding

SageMaker also provides features for deploying models, and today we are announcing a simple integration with Bedrock. You will be able to start jobs directly from SageMaker Studio to deploy models to Bedrock. In addition to that, you can continue to leverage SageMaker endpoints to deploy multiple adapters to the same endpoint. I will explain this feature in more detail shortly, but it helps you reduce costs. You can also use various techniques to further optimize model performance. While there are many techniques available, I will explain "speculative decoding" in a bit more detail, as it is one of the key techniques for minimizing application latency.

Thumbnail 760

Thumbnail 780

Now, let's look at the first major benefit of SageMaker endpoints. You can deploy multiple foundation models to the same endpoint. This allows you to have a single endpoint, and as your use cases continue to grow, you can simply keep using that one endpoint. This can significantly reduce costs. As traffic increases, SageMaker provides the ability to publish metrics for each foundation model, so you can build auto-scaling policies for all models. When traffic increases, that specific foundation model scales to other instances, ensuring costs are minimized. This can reduce costs by up to 50%. Also, we recently launched a feature that allows you to cache model weights, which makes auto-scaling much faster.

Thumbnail 830

Next, let's look at one of the recently launched key techniques that helps optimize application latency. Typically, customer expectations for inference are that it should be fast, but because foundation models generate one token at a time, inference becomes slow. The way speculative decoding works is that you have a foundation model and a draft model. The draft model is usually a smaller model. The draft model generates several tokens for the foundation model to review. The foundation model reviews these tokens, assigns probabilities, and then accepts or rejects specific tokens.

Let's look at an example of how that works. Let's place a prompt here. The draft model generates a response of those tokens. The foundation model evaluates these tokens and accepts some of them. This is a simplified view. You can actually use the draft model to generate multiple variations, and with the feature we launched recently, you can not only generate these tokens but also fine-tune the draft model for your traffic, which gives you higher quality responses from the draft model.

Thumbnail 880

Thumbnail 890

Let's see how that feature works. This achieves up to a 2.5x reduction in latency, increasing throughput without losing accuracy. Because you can fine-tune the draft model for your traffic, you don't lose accuracy. So, let's see how that works. You can bring your own dataset or use one of the curated datasets in SageMaker. You can start a fine-tuning job with a draft model. This is an asynchronous job that runs in the background. When the job completes, evaluation metrics are published. You can review the evaluation metrics and choose to deploy the draft model to the same endpoint, so there is no cost impact.

Thumbnail 920

The draft model is deployed to the same endpoint. Because the draft model generates these tokens and the foundation model can evaluate and accept them, you can continue to see this latency improvement without losing accuracy.

Thumbnail 930

Finally, we also launched a new feature that allows you to track not just models, but also generative AI assets like datasets and reward functions. Similar to models, you can now also track all datasets and the validators that Shelby will explain in the demo. Not only can you track these assets, but you can also track lineage, so you can track each version and lineage of all assets.

Thumbnail 980

Medical Triage Agent Demo: From Model Customization to Evaluation

Now, Shelby will explain all of these features. Thank you all for joining. You might be in the middle of lunch, or perhaps you've already finished eating, but thank you for joining regardless.

In this demo, we will cover a few things. It's an end-to-end demo; we will look at model customization and then integrate that model into an agent. We'll use a very simple use case: a medical triage agent. We'll take an open-source model and customize or adapt it for a specific task. In this case, it will be an agent that can triage medical symptoms before a patient makes an appointment or pages an on-call doctor.

Thumbnail 1070

The demo is split into two parts. First, we'll start with model customization, focusing on the new model customization experience. Then, in the second part, we'll see how to integrate it with an agent called AgentCore. In this demo, we'll focus on end-to-end functionality. Note that there are plenty of sessions over the next few days that will deep dive into various details of the new model customization experience, different techniques, and different evaluation techniques. So, let's get started.

Thumbnail 1100

Assets is a new feature that allows you to track and manage various assets that are part of your experiments. Datasets are a critical asset. When you click on Datasets, you'll see all the datasets you've uploaded, which can be used in different fine-tuning workloads. You can also confirm that you are managing multiple versions across different experiments. You can have multiple different versions of processed data to use as inputs for fine-tuning jobs.

Thumbnail 1110

Thumbnail 1120

Thumbnail 1130

Thumbnail 1140

To upload a dataset, click on 'upload dataset', enter a descriptive name, and choose whether to upload directly from your local computer or from an S3 location. If your data is already in S3, you can upload from S3. In this case, I will perform a local upload from my computer. Then, click 'save', and the dataset will be uploaded. As you progress through your experiments, you can upload new versions, which will be used as input for model customization jobs.

Thumbnail 1150

Another thing I'd like to mention is the new serverless MLflow. If you are familiar with the interface, you will now see a new 'apps servers' tab within MLflow, and all serverless MLflow app servers will be placed here. There is a default one here, but I also have a custom one created for this demo, so I will use that. You will see this throughout the model customization demo, but all model performance metrics are automatically logged to MLflow, and all evaluation metrics that you run against fine-tuned models are also logged. This makes comparison and visualization across experiments very easy, ultimately helping you understand which model to deploy and test in agent integration or deploy to production.

Thumbnail 1200

Moving to the New Customization Experience

Now, let's move on to the new customization experience. Here, you'll see various models you can customize, including previous existing models.

Thumbnail 1220

Thumbnail 1230

This applies to all machine learning and deep learning models. Everything is in one place. All models you have customized are displayed here under 'My Models'. In 'My Models', you can see every model you've customized and get their detailed information. I'll explain this in more detail later. So, let's start a model customization job.

Thumbnail 1270

As you can imagine, these jobs take some time to run, so, in a cooking-show style, I will use a pre-prepared model and a pre-prepared version. Basically, you just click 'customize'. You can customize through the UI, which is what we are doing in this demo, but you can also customize through an AI Agent. This was announced this morning and is in preview; it provides the ability to develop a guided workflow for fine-tuning customization using natural language. You can also customize through code. The SDK is available for all of these for those who prefer a programmatic experience. That said, let's proceed with customization through the UI.

Thumbnail 1290

Thumbnail 1310

Basically, you just need to enter a descriptive name for the model. I'm just calling it 'medical triage'. I have a few things here. You can see different customization techniques here. As I mentioned earlier, we will explain more about many of these different customization techniques through different sessions today and tomorrow. What is immediately available today is Supervised Fine-Tuning, DPO, Reinforcement Learning with Verifiable Rewards, and Reinforcement Learning with AI Feedback. In this case, we are just doing Supervised Fine-Tuning today. Click the customization technique you want to use.

Thumbnail 1320

Thumbnail 1340

You can upload a dataset here, or in this case, simply point to the dataset we just uploaded earlier. Then, select the version you want to use. In this case, there is only one version. Here, you can change hyperparameters and settings across different training experiments. In this case, I'm going to use the default parameters that are available immediately, but you can change different hyperparameters here.

Thumbnail 1380

After that, point to the MLflow App you want to use. You can see the default one created here. And this is the specific one I created for today's session. Of course, you can adjust the experiment name to give it a more meaningful title within MLflow, making it easier to find. This is also where you can adjust security settings. Internally, it is serverless training, but you can also specify it to run within a VPC, and you can specify the type of encryption you want to use for volumes. After that, just submit.

Thumbnail 1390

Thumbnail 1400

Basically, this kicks off the serverless training job. You can see the one in progress here. Once you kick it off and start, the logs are here. They are not available yet, but the logs are there, and if you want to do something like early stopping, you can. That said, let's look at the pre-prepared version. I'm going to go here and look at it. This was trained on the full dataset. In this case, we are just using an open dataset, and it has been trained on medical symptoms and medical diagnoses.

Thumbnail 1420

Thumbnail 1440

Let's take a look at the latest version. Here, you can check all the different versions. You can move between versions and different tabs. There is performance; in this case, you can see it has run away a bit. It is probably a little overfitted. If I had monitored it, I could have done an early stop, but you can also adjust the hyperparameters a little bit to avoid that. There is also evaluation. You can check the evaluation job here. Many different evaluations are available. In this case, I ran ready-to-use benchmarks and another full evaluation.

Thumbnail 1460

Thumbnail 1470

Thumbnail 1480

Thumbnail 1490

If you want to run an evaluation, basically you just click 'evaluate' and set a descriptive name. And there are three evaluation types. There is 'LLM as a Judge', where you can specify the model you want to use as the judge model. In addition to that, you can specify the metrics you want to evaluate, and there is also a feature to bring in custom metrics. Another type is 'Custom Score', where you can bring in custom scoring code. You can also use some built-in metrics. Specifically, there are ones related to code execution and math answers. In this case, for the demonstration, I'm going to use the ready-to-use benchmarks. Specifically, I am using Multitask Language Understanding and narrowing it down further to specialize it to the task we are trying to fine-tune, which is a task within the medical domain.

Thumbnail 1530

Thumbnail 1550

Thumbnail 1560

Another thing to click is the option to compare with the base model. This is important if you want to evaluate against the base model and see if it makes sense to perform the fine-tuning. We want to compare all evaluation metrics against the base model to see if we are actually making progress by having a more fine-tuned model. In this case, I am using Qwen 2.5, so I want to compare all evaluation metrics against that base model. In this case, we test across 10 subjects. Since it's not that useful for our use case, we narrow it down to clinical knowledge. You can also specify advanced configuration parameters within the evaluation, for example, top P, top K, and security settings, etc. The ability to run these evaluation jobs means they run in the background, but you still have the ability to run them within a VPC and specify the type of encryption. So, just click submit.

Thumbnail 1590

Experiment Comparison and Model Deployment in MLflow

Once submitted, an evaluation pipeline is automatically created in the background. You don't need to process the pipeline being created, but it handles steps like passing data, extracting data, and publishing those metrics to MLflow. Let's assume we have completed training and also performed evaluation. Let's take a look at some of the metrics that automatically flow into MLflow.

Thumbnail 1620

Thumbnail 1630

First, let's look at the model performance metrics. These are pre-baked versions that we have from the actual training performance itself. Let's compare them with the four versions we have. It shows the metrics captured during the training cycle and the different versions in a table format. For example, the number of epochs run, loss, validation loss, test loss, and all those different metrics, etc. You can also go into the same model to do a more visual comparison. This helps in evaluating them against each other.

Thumbnail 1670

Thumbnail 1700

Here is a visualization where you can compare and visualize the loss across different iterations of fine-tuning. This is the model performance itself, followed by the evaluation metrics we saw earlier. Here, we are benchmarking using the MMLU clinical knowledge benchmark. You can compare those metrics even within here. I'm going to hide the model performance metrics and try to emphasize the evaluation results.

Thumbnail 1730

Thumbnail 1740

These are the model performance metrics, and you'll notice that I'm also highlighting the base model. This is because I want to understand if this model is actually performing better for the specific task we are trying to solve than the base model, i.e., the base Qwen model. In this case, I'm using 'clinical custom'. Here we have 'LLM as a Judge', and we also have MMLU college knowledge. In reality, you'll be looking at this model across many different performance metrics. This is just one example of basically running one of these evaluation metrics. In this particular case, this first model, the first version, has the best performance against that specific benchmark, the clinical knowledge benchmark. By doing this, you can run it across different metrics and different evaluations to finally decide which model you want to test in a little more detail within the agent workflow, or migrate to the production environment.

Thumbnail 1770

Thumbnail 1780

Now that the evaluation is complete, let's go back to the model and proceed with deployment. Assuming we want to deploy this and integrate it with an agent, go to deployment here and click 'deploy'. This is where you can deploy either to SageMaker or Bedrock, which is a fantastic feature. Let's assume Bedrock is through 'custom model import' in this case. Let's assume we're going to create a new endpoint through SageMaker. You just enter the name here and you can choose the instance type or accept the default recommendation.

Thumbnail 1810

Thumbnail 1820

Advanced options are available. Regarding maximum instance count, security settings, and all those different items. After that, just click 'deploy'. What that does is deploy a SageMaker endpoint in the background, which is available now and ready for integration into an agent workflow or direct application integration.

Thumbnail 1850

Another thing to point out is the lineage tab Emmett talked about. The nice thing about all these different tasks and the steps leading up to them is that because there are so many moving parts, from training to all the evaluations that need to happen, you can track and maintain the complete lineage. For example, if you click on the first one, you can see the model artifacts, in this case, the base Qwen model. You can verify the exact version of the Qwen model used for this fine-tuning. As you proceed, you can check the training job used, and all metadata including the complete lineage is saved and collected.

Thumbnail 1870

Thumbnail 1910

As you can see, you can track the entire pipeline execution and deployment back to 1870. In this case, the deployment is not yet completely finished, but since you can track it throughout the entire deployment, it's really great for maintaining traceability and end-to-end lineage. That's why, assuming it's deployed, we'll integrate this with an agent workflow. These are the steps from doing all the experiments to finally deploying to SageMaker AI. Of course, you can also deploy to Bedrock. It depends on what you are looking for. Some of the adapter-based inference is a really great cost-efficiency feature, especially regarding fine-tuning, but you can also import it to Bedrock.

Thumbnail 1960

Integration with Agent Core Runtime and Production Deployment

In this case, what we do is take a SageMaker endpoint hosting a fine-tuned model adapted for a specific task we are looking at within the medical domain. Assuming this is an experiment at this point, we'll use the Strands SDK. Keep in mind that as you move forward with this, you can use any other framework supported by AgentCore, such as LangGraph or Crew AI, in the same way. I'm just showing it with Strands. What we'll do here is create an agent, create a few dummy tools in the backend, and check if the agent can make smarter decisions about whether these symptoms are urgent, and whether it potentially needs to contact an on-call doctor, or if it should go to urgent care, or if it's less urgent and should schedule a booking. We also look at MLflow on the backend side to check the agent traces.

Thumbnail 2010

One thing to keep in mind is that MLflow handles both agent tracing and agent evaluation. Bedrock AgentCore also has excellent built-in observability features and evaluation features announced yesterday, so it depends on the situation. In other words, if you are dealing with both models and agents, MLflow might be a good option, but if you are dealing only with agents, using AgentCore's native built-in features might be better suited to your use case. That being said, there are many dependencies and installations, but what I want to show is that this is a model configuration using the Strands SDK. Just like Bedrock API endpoints, you can create models based on SageMaker endpoints. As you can see here, let's zoom in a little.

Thumbnail 2030

Thumbnail 2050

There is 'SageMakerAIModel', which is a specific integration with Strands, where you specify the endpoint name and the inference component name if you are leveraging adapter-based inference. After that, we'll create a very simple agent that doesn't have tools in the backend, just to check the model's performance on the task. This is a fine-tuned model without tools. Here, I just say I want to make a reservation. It's giving a reasonable response, but to actually do something, it doesn't necessarily have the knowledge to take actual actions, like checking availability or contacting an on-call doctor.

Thumbnail 2060

Thumbnail 2070

Thumbnail 2080

So, we implement conversation management. This is simply part of the Strands SDK. We provide asynchronous operators for conversation management and streaming to maintain these conversations. After that, when we try to access the backend endpoint, we get responses like going to the nearest ambulance. But, again, there are no actual tools to take action on anything.

Thumbnail 2090

Thumbnail 2100

So, to fix this, we'll add some tools. As you can see, these are dummy implementations of the tools: availability check tool, booking tool, and on-call response page tool. However, what we really want to see is whether the agent can be smart enough to select tools based on the provided input. With the addition of tools, there is additional prompt engineering associated with it.

Thumbnail 2110

Thumbnail 2140

Thumbnail 2150

Thumbnail 2160

Then, we actually build the agent. Before that, one thing to do is to register the system prompt using a more advanced prompt. One common challenge I often hear from customers is the ability to share and manage prompts used as part of an application. MLflow has a prompt management feature. Once you have decided on a reasonable prompt to use for your test cycle, you can set that system prompt within MLflow. The code here is basically just registering that prompt to MLflow. You can see the prompt name here, and if you go into MLflow, this is the test prompt. It only has one version, but you will end up holding multiple versions. The nice thing about this is that sometimes when you're building something in a team, everyone is just sharing prompts in Slack or other ways, but by using this, you can actually manage versions, and share it more easily across the entire team.

Thumbnail 2190

For production environments, it is very important for tracking lineage. In this case, I am just saying 'test prompt' and managing versions. Now that I have done this and created the prompt, I will create an agent using tools. In this case, I will take the dummy tools I created and make them available to the agent. The agent is supported by the fine-tuned model on the backend. To do so, you just make the tools available here. This is availability, booking, and on-call paging. Then, this time, we call the agent using the tools.

Thumbnail 2240

In this case, a reservation needs to be made, and here is the agent's response. It is directly instructed by the prompt. It tells the patient that they need to check their symptoms before proceeding with the reservation. We are now getting good responses. One thing you can do in MLflow is agent tracing, where you can verify that the tools are being called. This is really important when building agents today. It is really important to be able to trace the thought process, and to know when tools are being called, when they are not, and when they are pretending to be called.

Thumbnail 2260

Thumbnail 2270

Thumbnail 2280

Thumbnail 2290

Now, let's take a look at a part of agent tracing within MLflow. Here, it looks like I've been experiencing it for a few days. It's a medical issue. Here, this is the output to that. Somewhere there is reservation possibility in different cases. Sorry, I am in the wrong experiment. Is it this? Yes, that's right. You can see here that the on-call response is being executed. Since there is a medical emergency, you can see that the tool was actually called. And here, you can see it interacting with the model on the backend, and you can see where the tool is actually being called on the backend. Tracing is really valuable for debugging, and it's important to know when tools are being called, when they are not, and what the actual logical flow of the application is.

Thumbnail 2310

Thumbnail 2330

And as I mentioned earlier, Agent Core observability, etc., have also been released so far, so you can use those things too. This is really useful if you need to merge model experiment metrics between models and agents. That's why we first developed it in Strands. This is fairly common for development, but now we want to deploy it and make it scalable. So we use the Agent Core runtime to actually host that agent. In this case, what we do is very similar to the previous one, but with Agent Core, we use a 'runtime agent' to host the agent, and also use Agent Core identity to manage user interactions.

Thumbnail 2350

Thumbnail 2360

Thumbnail 2370

Thumbnail 2380

Thumbnail 2390

Thumbnail 2400

To do that, you just export the agent code. That is, the agent code's Python file. And, as we saw earlier, we are using the SageMaker endpoint name. Actually, it is pointing to the backend SageMaker model. We are also making dummy tools available. And, we are setting up Cognito user pools and authentication. Here is where we register the system prompt for production. I highly recommend this both from a reliability perspective and from the perspective of knowing which prompt version comes with which agent. So we register the prompt again, but in this case, we register it as a production prompt. Looking here, the version is just 1, but you can hold multiple versions. As you can see, this is the agent prompt tied to that specific agent.

Thumbnail 2420

Thumbnail 2440

Next, deploy the agent to the Agent Core runtime. In this case, I am using a helper tool to start the agent. Here, it is pointing to the entry point in the Python code. It also points to the agent name, which will be 'Agent Prod medical triage agent Prod'. And I am using authorization config. Here is where it is actually starting.

Thumbnail 2450

Thumbnail 2480

Once it actually starts, you can test the endpoint. From a traceability perspective, one thing I recommend is that, in most cases, this will actually be deployed to a backend CD pipeline. Instead of deploying from a notebook when you are ready to move to production. I recommend tagging SageMaker endpoints with the agent ARN and the returned agent ID. By doing so, for any endpoint there, you know which agent uses or depends on that endpoint. These dependencies are difficult to maintain without this level of tracking. Here, I am tagging the endpoint with the agent ARN and agent ID.

Thumbnail 2490

Thumbnail 2500

Thumbnail 2510

You can see a list of tags showing where you tagged it. After that, just use the agent. As before, we call the agent with 'invoke agent code' and 'invoke endpoint code'. We send the prompt as before, but this time it is running on the scalable Agent Core runtime compute. Since we set up MLflow for agent tracing, we can go back to MLflow and check the production-level trace as well.

Thumbnail 2520

Thumbnail 2530

Thumbnail 2540

You can see when it is calling different tools and when it is not, and all of that is collected automatically. It is iterating many times, and it is calling when it should, and not calling when it shouldn't. For example, a stuffy nose shouldn't really be an emergency call. In this case, basically, it is just saying it is not available today, and since it is not a medical emergency, you can make a reservation at another time.

Thumbnail 2570

This basically shows an end-to-end example of getting better performance by using a fine-tuned model adapted to a specific task, as well as integrating it with an agent workflow. One thing to keep in mind is that I talked about lineage and traceability. What you saw with model customization has wonderful lineage that is captured automatically. However, an additional thing to keep in mind with agent workflows is that while I showed it in a notebook today, which is wonderful for experiments, as you know, you are likely to include it in a continuous delivery/continuous deployment pipeline for agents when deploying to production.

There are many different versions to consider. The wonderful thing is that, as of now, all images on the left side are handled by model customization, and you have that complete end-to-end lineage. The right side is what you need to keep in mind with CD deployment pipelines, which is to capture those different versions across agents. I ran a very simple agent, but there are also multi-agent orchestration workflows. Capture those versions and dependencies, so you can know, for example, as I tagged the endpoint, that there are multiple agents depending on that endpoint.

Thumbnail 2640

I explained many things in a short amount of time, thank you all very much. I'll return it to Amit. Actually, one more thing: if you want the code example, I couldn't push it before this meeting. Because I had another meeting. I will push it today. I couldn't push it because it contained the new launches. I apologize. If you take a screenshot, I'll post the code by the end of today. Now, I'll return it to Amit.

Thumbnail 2740

Chaubli, thank you. Let me summarize briefly, and then I will answer your questions if there are any. SageMaker now provides a fully managed and serverless experience for customizing models, from training to evaluation to deploying models. With SageMaker AI inference capabilities, you can host multiple models on the same endpoint, easily auto-scale, and use optimization techniques to increase cost-efficiency. You can gain end-to-end observability of model customization and agents using managed MLflow, serverless MLflow, or partner AI apps.

Thumbnail 2760

Thumbnail 2770

You can use SageMaker AI Pipelines to build scalable and repeatable workflows with the new steps launched today. Additionally, you can now track and audit the versions of AI assets used for model customization, not just the model versions. This is the barcode for the same storyboard. It's not a full demo, but it's a storyboard that explains this example step-by-step. Please be sure to check it out. If you have any questions, there are two microphones in the center of the room, so please feel free to ask.


  • This article was created automatically using Amazon Bedrock while maintaining the information in the original video as much as possible.

Discussion