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.
Release files for lwa-fastapi-middleware-bedrock-agent 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lwa_fastapi_middleware_bedrock_agent-0.0.4.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lwa_fastapi_middleware_bedrock_agent-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / lwa_fastapi_middleware_bedrock_agent-0.0.4.tar.gz
| Download URL | lwa_fastapi_middleware_bedrock_agent-0.0.4.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c65632b602f8a4f20702b74ed539449ce68be0c4460dc79d0aaafe6da4a9cf8
|
|
BLAKE2b-256 checksum How to use checksums |
e5737080623560aac9e0111679a692f4e489ca36ecf2a2a7d356ff80901f0cef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / lwa_fastapi_middleware_bedrock_agent-0.0.4-py3-none-any.whl
| Download URL | lwa_fastapi_middleware_bedrock_agent-0.0.4-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17b9e4059f996bee00cd9dd50d1cee81d8491ddc0e5757bd0ebff7e119218b16
|
|
BLAKE2b-256 checksum How to use checksums |
42e5115398cfb892dba175a694b2d83619b84239b4170041a499a7fad00c342c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|