Skip to content

feat(aws): add Bedrock Knowledge Base connector#6799

Open
tshepomaredi wants to merge 4 commits intomainfrom
tshepo-aws-bedrock-knowledgebase
Open

feat(aws): add Bedrock Knowledge Base connector#6799
tshepomaredi wants to merge 4 commits intomainfrom
tshepo-aws-bedrock-knowledgebase

Conversation

@tshepomaredi
Copy link
Copy Markdown

Adds a new outbound connector for AWS Bedrock Knowledge Base Retrieve API. Enables semantic search over documents indexed in a Bedrock Knowledge Base.

Description

  • BedrockAgentRuntimeClient-based implementation
  • Retrieve operation with query and numberOfResults parameters
  • Results returned as Camunda Document (JSON)
  • Error handling: throttling retry, KB errors, serialization errors
  • Element template with authentication, configuration, and operation groups
  • Unit tests: executor (2), input validation (3) — all passing

Related issues

NA

closes #

Checklist

  • Backport labels are added if these code changes should be backported. No backport label is added to the latest
    release, as this branch will be rebased onto main before the next release. Example backport labels:
    • backport stable/8.8: for changes that should be included in the next 8.8.x release.
    • or backport release-8.8.7: for changes that should be included in the specific release 8.8.7, and this
      release has already been created. The release branch will be merged back into stable/8.8 later, so the change
      will be included in future 8.8.x releases as well.
  • [ x] Tests/Integration tests for the changes have been added if applicable.

Adds a new outbound connector for AWS Bedrock Knowledge Base Retrieve API.
Enables semantic search over documents indexed in a Bedrock Knowledge Base.

- BedrockAgentRuntimeClient-based implementation
- Retrieve operation with query and numberOfResults parameters
- Results returned as Camunda Document (JSON)
- Error handling: throttling retry, KB errors, serialization errors
- Element template with authentication, configuration, and operation groups
- Unit tests: executor (2), input validation (3) — all passing
@tshepomaredi tshepomaredi force-pushed the tshepo-aws-bedrock-knowledgebase branch from 60d996e to 8b228cb Compare March 26, 2026 09:13
@tshepomaredi tshepomaredi marked this pull request as ready for review March 26, 2026 09:58
@tshepomaredi tshepomaredi requested a review from a team as a code owner March 26, 2026 09:58
@maff maff requested review from a team and removed request for ztefanie March 26, 2026 10:06
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@YanaSegal Could you provide an icon for this? 💕

Copy link
Copy Markdown
Contributor

@mdii mdii left a comment

Choose a reason for hiding this comment

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

Looks good 👍
I have a few comments.

"configuration",
"knowledgeBaseId",
"operation",
"operationDiscriminator"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to declare operationDiscriminator here 🤔 ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I believe we do. I followed a similar approach as the actionDiscriminator in the S3 connector.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think there is a difference between how it is done in the S3 connector. Here operationDiscriminator is a nested property of operation whereas in the S3 connector actionDiscriminator is at the root level. You can try removing it as see if the connector works as before.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

operationDiscriminator does no exist anyways. There is an operation.operationDiscriminator instead.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

You're correct, I've updated it

import io.camunda.connector.api.document.Document;

public record KnowledgeBaseRetrievalResult(
Document resultsDocument, int resultCount, String nextToken) {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is nextToken?
It is not referred to in the tests.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Its a pagination token, I've renamed in for clarity (its named that way from the AWS side). The tests don't verify the pagination token at all since its just a pass-through value from the aws response. But we could add an assertion for it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes maybe just an assertion to make sure it is set correctly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

- Remove redundant @PropertyConstraints where @notblank is present
- Remove unused REGION constant from BaseTest
- Rename nextToken to paginationToken for clarity
- Extract error codes into constants
- Add retry backoff (3 retries, 5s) for throttling
- Use generic createClient() pattern
@YanaSegal
Copy link
Copy Markdown

YanaSegal commented Mar 27, 2026

UX feedback
Screenshot 2026-03-27 at 10 58 38

ICON (SVG)
Arch_Amazon-Bedrock_32

@tshepomaredi
Copy link
Copy Markdown
Author

UX feedback Screenshot 2026-03-27 at 10 58 38

ICON (SVG) Arch_Amazon-Bedrock_32

Hi @YanaSegal, good question on the UX feedback. So currently the connector is setup to be used with an agent task, so it retrieves from the KB and returns the raw query outputs in a camunda doc, and the agent task would generate an output. If there's a use case for using the connector on its own, then maybe a Retrieve And Generate option could be added to combine retrieval with LLM generated answers. But if not we can remove the drop-down completely.

Te query is a natural language search string. More specific queries yield better results (e.g. "What does the policy cover for stolen vehicles?" vs just "coverage"). I've added a query guidelines section with examples to the documentation PR

Output mapping is optional. Without it, the full response (document reference, result count, pagination token) is stored in the result variable

… paginationToken test

- Remove operationDiscriminator from inputVariables (nested inside operation object)
- Add test assertion for paginationToken pass-through
- Add test for null paginationToken when no more results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants