You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/event_handler/bedrock_agents.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Agents for Amazon Bedrock
3
3
description: Core utility
4
4
---
5
5
6
-
Author[Agents for Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/agents.html#agents-how){target="_blank"} using event handlers and auto generation of OpenAPI schemas.
6
+
Create[Agents for Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/agents.html#agents-how){target="_blank"} using event handlers and auto generation of OpenAPI schemas.
7
7
8
8
<center>
9
9
```mermaid
@@ -13,10 +13,10 @@ Author [Agents for Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/us
13
13
14
14
## Key features
15
15
16
-
* Similar experience when authoring [REST](api_gateway.md){target="_blank"} and [GraphQL APIs](appsync.md){target="_blank"}
17
16
* Minimal boilerplate to build Agents for Amazon Bedrock
18
17
* Automatic generation of [OpenAPI schemas](https://www.openapis.org/){target="_blank"} from your business logic code
19
18
* Built-in data validation for requests and responses
19
+
* Similar experience when authoring [REST](api_gateway.md){target="_blank"} and [GraphQL APIs](appsync.md){target="_blank"}
20
20
21
21
## Terminology
22
22
@@ -30,11 +30,11 @@ Author [Agents for Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/us
30
30
31
31
**Large Language Models (LLM)** are very large deep learning models that are pre-trained on vast amounts of data, capable of extracting meanings from a sequence of text and understanding the relationship between words and phrases on it.
32
32
33
-
**Agent for Amazon Bedrock** is an AWS service to build and deploy conversational agents that can interact with your customers using Large Language Models (LLM) and AWS Lambda functions.
33
+
**Agent for Amazon Bedrock** is an Amazon Bedrock feature to build and deploy conversational agents that can interact with your customers using Large Language Models (LLM) and AWS Lambda functions.
34
34
35
35
## Getting started
36
36
37
-
???+ tip "All examples shared in this documentation are available within the [project repository](https://github.com/aws-powertools/powertools-lambda-python/tree/develop/examples)"
37
+
!!! tip "All examples shared in this documentation are available within the [project repository](https://github.com/aws-powertools/powertools-lambda-python/tree/develop/examples)"
38
38
39
39
### Install
40
40
@@ -50,8 +50,8 @@ To build Agents for Amazon Bedrock, you will need:
|[Lambda Function](#your-first-agent)| Defines your business logic for the action group | ✅ | ✅ |
52
52
|[OpenAPI Schema](#generating-openapi-schemas)| API description, structure, and action group parameters | ❌ | ✅ |
53
-
| Bedrock [Service Role](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-permissions.html){target="_blank"} | Allows Amazon Bedrock to invoke foundation models | ✅ | ✅ |
54
-
|Agent for Bedrock| The service that will combine all the above to create the conversational agent | ❌ | ✅ |
53
+
|[Bedrock Service Role](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-permissions.html){target="_blank"} | Allows Amazon Bedrock to invoke foundation models | ✅ | ✅ |
54
+
|Agents for Bedrock | The service that will combine all the above to create the conversational agent | ❌ | ✅ |
55
55
56
56
=== "Using AWS Serverless Application Model (SAM)"
57
57
Using [AWS SAM](https://aws.amazon.com/serverless/sam/){target="_blank"} you can create your Lambda function and the necessary permissions. However, you still have to create your Agent for Amazon Bedrock [using the AWS console](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-create.html){target="_blank"}.
@@ -77,10 +77,10 @@ To build Agents for Amazon Bedrock, you will need:
77
77
78
78
### Your first Agent
79
79
80
-
To create an Agent for Amazon Bedrock, use the `BedrockAgentResolver` to annotate your actions.
80
+
To create an agent, use the `BedrockAgentResolver` to annotate your actions.
81
81
This is similar to the way [all the other Event Handler](api_gateway.md) resolvers work.
82
82
83
-
It's required to include a `description`for each API endpoint and input parameter. This will improve the understanding Amazon Bedrock has of your actions.
83
+
You are required to add a `description`parameter in each endpoint, doing so will improve Bedrock's understanding of your actions.
84
84
85
85
=== "Lambda handler"
86
86
@@ -190,8 +190,7 @@ Similarly, if the response fails validation, your handler will abort the respons
190
190
191
191
### Generating OpenAPI schemas
192
192
193
-
Use the `get_openapi_json_schema` function provided by the resolver.
194
-
This function will produce a JSON-serialized string that represents your OpenAPI schema.
193
+
Use the `get_openapi_json_schema` function provided by the resolver to produce a JSON-serialized string that represents your OpenAPI schema.
195
194
You can print this string or save it to a file. You'll use the file later when creating the Agent.
196
195
197
196
You'll need to regenerate the OpenAPI schema and update your Agent everytime your API changes.
@@ -247,13 +246,13 @@ The following video demonstrates the end-to-end process:
247
246
<iframewidth="720"height="405"src="https://www.youtube-nocookie.com/embed/NWoC5FTSt7s?si=AG2qpLJbxCkyiLma&controls=1"title="YouTube video player"frameborder="0"allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"allowfullscreen></iframe>
248
247
</center>
249
248
250
-
During the creation process, you should use the schema generated in the previous step when prompted for an OpenAPI specification.
249
+
During the creation process, you should use the schema [previously generated](#generating-openapi-schemas) when prompted for an OpenAPI specification.
251
250
252
251
## Advanced
253
252
254
253
### Accessing custom request fields
255
254
256
-
The event sent by Agents for Amazon Bedrock into your Lambda function contains a number of extra event fields, exposed in the `app.current_event` field.
255
+
The event sent by Agents for Amazon Bedrock into your Lambda function contains a [number of extra event fields](#request_fields_table), exposed in the `app.current_event` field.
257
256
258
257
???+ note "Why is this useful?"
259
258
You can for instance identify new conversations (`session_id`) or store and analyze entire conversations (`input_text`).
@@ -267,6 +266,7 @@ The event sent by Agents for Amazon Bedrock into your Lambda function contains a
0 commit comments