Skip to content

docs(event-handler): add docs page for Bedrock Agent Function #3991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

dreamorosi
Copy link
Contributor

Summary

Changes

Please provide a summary of what's being changed

This PR adds a page to the docs dedicated to the new Event Handler for Bedrock Agent Functions.

This page borrows from the one being added in aws-powertools/powertools-lambda-python#6564 but deviates a bit due to the fact that we don't support OpenAPI specs for this feature.

This page follows the same structure as similar pages and includes:

  • a mermaid diagram to explain the flow (moved the Action Group in the same "box" as the agent)
  • a getting started section with SAM & CDK templates to create an agent
  • a section that explains how to create a tool, how parameters are handled
  • a section about error handling & custom responses
  • a section about working with session attributes
  • a section about how to access the current event and context

Please add the issue number below, if no issue is present the PR might get blocked and not be reviewed

Issue number: closes #3990


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@dreamorosi dreamorosi self-assigned this May 28, 2025
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation event-handler This item relates to the Event Handler Utility internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) labels May 28, 2025
@pull-request-size pull-request-size bot added the size/XL PRs between 500-999 LOC, often PRs that grown with feedback label May 28, 2025
@dreamorosi dreamorosi changed the title Docs/bedrock agents docs(event-handler): add docs page for Bedrock Agent Function May 28, 2025
--8<-- "examples/snippets/event-handler/bedrock-agents/gettingStartedFunctionsTool.ts"
```

1. The `description` field is optional, but highly recommended in the action group definition.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should say why we recommend this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, good point. Can't add it until tomorrow when I get on a laptop. But if you wanna suggest a line like you did with the previous ones I can accept it.

The gist of why we need it is that it gives the LLM better context on the tool and how to use it.

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dreamorosi! i just left some comments that probably make sense you review it.


By default, the `BedrockAgentFunctionResolver` uses the global `console` logger and emits only warnings and errors.

You can change this behavior by passing a custom logger instance to the `BedrockAgentFunctionResolver` constructor and setting its log level. Alternatively, you can also enable [Lambda Advanced Logging Controls](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs-advanced.html) and setting the log level to `DEBUG`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not add the Powertools log level explanation here instead of ALC? Setting the Powertools log level will solve the problem both in local environment (testing, mock API and other things) and in production, running on Lambda. ALC will solve it only in production.

I would not mention ALC in this doc.


When debug logging is enabled, the resolver will emit logs that show the underlying handler registration and the routing process. This is useful for understanding how the agent resolves the tools and routes the requests.

For example, when using the [Powertools for AWS Lambda logger](../logger.md), you can set the `LOG_LEVEL` to `DEBUG` in your environment variables or at the logger level and pass the logger instance to the `BedrockAgentFunctionResolver` constructor to enable debug logging.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you accept the previous suggestion, you can remove it.

Co-authored-by: Leandro Damascena <[email protected]>
Copy link

sonarqubecloud bot commented Jun 2, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation event-handler This item relates to the Event Handler Utility internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) size/XL PRs between 500-999 LOC, often PRs that grown with feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: add docs for Bedrock Agents feature
3 participants