FastAPI Middleware for Agents for Amazon Bedrock. Use with AWS Lambda Web Adapter.
Project description
FastAPI Middleware for "Agents for Amazon Bedrock"
This is FastAPI Middleware for "Agents for Amazon Bedrock". Use with AWS Lambda Web Adapter.
Agents for Amazon Bedrock requires:
- Lambda function that defines the business logic for the action that your agent will carry out.
- OpenAPI schema with the API description, structure, and parameters for the action group.
By using this middleware, you can create Lambda as a FastAPI. OpenAPI schemas can also be easily generated.
How to install
pip install lwa-fastapi-middleware-bedrock-agent
How to use
from bedrock_agent.middleware import BedrockAgentMiddleware
from fastapi import FastAPI
app = FastAPI(
description="This agent allows you to query the information.",
)
app.add_middleware(BedrockAgentMiddleware)
If you specified AWS_LWA_PASS_THROUGH_PATH, add the pass_through_path parameter. (Default is "/events")
app.add_middleware(BedrockAgentMiddleware, pass_through_path="/pass_through_path")
Example
Examples are located in the example directory
License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lwa_fastapi_middleware_bedrock_agent-0.0.4.tar.gz.
File metadata
- Download URL: lwa_fastapi_middleware_bedrock_agent-0.0.4.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c65632b602f8a4f20702b74ed539449ce68be0c4460dc79d0aaafe6da4a9cf8
|
|
| MD5 |
c17736dd88a0259027a4e7763bd2f542
|
|
| BLAKE2b-256 |
e5737080623560aac9e0111679a692f4e489ca36ecf2a2a7d356ff80901f0cef
|
File details
Details for the file lwa_fastapi_middleware_bedrock_agent-0.0.4-py3-none-any.whl.
File metadata
- Download URL: lwa_fastapi_middleware_bedrock_agent-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17b9e4059f996bee00cd9dd50d1cee81d8491ddc0e5757bd0ebff7e119218b16
|
|
| MD5 |
1f69464aaf0eb568dbd079792fa66890
|
|
| BLAKE2b-256 |
42e5115398cfb892dba175a694b2d83619b84239b4170041a499a7fad00c342c
|