Repository navigation
chore: aws-bedrock-agent-runtime-sink can retrieve passages and ask an agent, and the Redshift Kamelets can size their connection pool (#3170) - #3232
Merged
davsclaus merged 1 commit intoNov 18, 2026
Conversation
…n agent, and the Redshift Kamelets can size their connection pool (apache#3170) aws-bedrock-agent-runtime-sink takes `operation`: `retrieveAndGenerate` (the default, as before), `retrieve` and `invokeAgent`. For `retrieve`, `numberOfResults` and `searchType` set the vector search of the request, through the headers the component reads, and only when they are set. For `invokeAgent`, `agentId` and `agentAliasId` go on the endpoint. `modelId` and `knowledgeBaseId` are no longer required, as `invokeAgent` uses neither and `retrieve` no model; they are now optional placeholders. With the new options unset, the endpoint URI is the same as before. aws-redshift-source and aws-redshift-sink take `maxTotal`, `maxIdle` and `maxWaitMillis` for the commons-dbcp2 data source, with the names and wording of the other SQL Kamelets. aws-bedrock-text-sink is unchanged: the converse operation reads the conversation only from a header holding AWS SDK objects, which a Kamelet user cannot set, and the guardrail options apply only to converse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #3170:
aws-bedrock-agent-runtime-sinkcan find passages in a knowledge base without writing an answer, and ask a Bedrock agent.aws-redshift-sourceandaws-redshift-sinkcan size their connection pool.aws-bedrock-text-sinkis left unchanged; see "Left out".The options
aws-bedrock-agent-runtime-sink:operationoperation: "{{operation}}",default: retrieveAndGenerate, enumretrieveAndGenerate,retrieve,invokeAgentretrieveAndGenerateis today's behaviour.retrievegives the passages found, without an answer.invokeAgentsends the question to a Bedrock agent.agentIdagentId: "{{?agentId}}",pattern: ^[0-9A-Za-z]{10}$invokeAgent.agentAliasIdagentAliasId: "{{?agentAliasId}}", same patternTSTALIASID, forinvokeAgent.numberOfResultschoicesets theCamelAwsBedrockAgentRuntimeNumberOfResultsheader to{{?numberOfResults}}, only when the option is setretrieve.searchTypeCamelAwsBedrockAgentRuntimeSearchTypeheader; enumHYBRID,SEMANTICretrieve.'{{?x}}' != ''check thatceph-sinkuses. When neither is set, the request has an emptyvectorSearchConfiguration, as before.operationhas a default: today the template hard-codesoperation: retrieveAndGenerate. Without a default, an unset option would leave the endpoint with no operation, and every message would fail.required:modelIdandknowledgeBaseIdare no longer required, and their placeholders are now optional.invokeAgentuses neither of them, andretrievedoes not usemodelId. Their descriptions say which operation needs them. When they are set, the endpoint URI is the same as before.retrieve, it is a List of AWS SDK objects. TheCamelAwsBedrockAgentRuntimeRetrievedResultsheader holds the same List, and it is declared underdataTypes.retrievebecome{}when turned into JSON, so${body[0].content.text}is the way to read them. It also says thatinvokeAgentwithout a session ID starts a new session for each message.retrieveandinvokeAgent.aws-redshift-sourceandaws-redshift-sink, on the commons-dbcp2BasicDataSourcebean, next toconnectionPropertiesfrom #3181. The names and wording are the same as in #3215 for the other SQL Kamelets:maxTotalmaxTotal: "{{?maxTotal}}"maxIdlemaxIdle: "{{?maxIdle}}"maxWaitMillismaxWaitMillis: "{{?maxWaitMillis}}"maxTotalwarns that the source keeps one connection while it sends the rows of a poll, andconsumedQueryneeds a second one.Left out
aws-bedrock-text-sink,operation: converse: theconverseoperation of camel-aws-bedrock reads the conversation only from theCamelAwsBedrockConverseMessagesheader. That header must be aListof AWS SDKMessageobjects, and in POJO mode the body must be aConverseRequestobject. A Kamelet user cannot build either without code, and the component does not turn a text body into a message.operation: converseon a copy of the Kamelet, every message failed withConverse operation requires messages in header CamelAwsBedrockConverseMessages, and no request reached the server.converse, andconverseStream, would take a text body as the user message when the header is not set. Then the Kamelet can offerconverse, where the body is the prompt, the same for every model.guardrailIdentifier,guardrailVersion: the component applies them only toconverse,converseStreamandapplyGuardrail, not toinvokeTextModel. They come together withconverse.streamOutputMode: it only applies to the streaming operations. A sink gives one result message either way: withcompleteit is the same text, and withchunksit is a List of pieces of the text. A sink has no use for it.invokeFlow,invokeInlineAgent) and the other agent options (enableTrace,sessionId, the agentstreamOutputMode) were not part of the gap list.Verification
Tested with Camel JBang 4.24.0-SNAPSHOT.
Bedrock was not called. Bedrock has no local emulator.
uriEndpointOverridepointed at a local Python HTTP server, which recorded each request (path and JSON body) and returned canned responses in the shape of Bedrock's. ForinvokeAgent, the response was in AWS event-stream encoding, with two chunks and a citation. The test shows what the Kamelet sends and how it reads a response. It does not show what Bedrock does with the request, for example that it rejects aretrieveAndGeneraterequest without a model.Redshift: a PostgreSQL 17 container stood in for the database, reached with the Amazon Redshift JDBC driver 2.3.0 that the Kamelets use. Two things were needed for that:
md5passwords, because the driver does not do SCRAM.driver_version, and passed everything else on unchanged.The proxy also counted the open connections.
connectionProperties: ssl=falseturned off TLS, which the container did not offer.aws-bedrock-agent-runtime-sink:mainand this branch,camel get endpointoperation=retrieveAndGenerate. IdenticalPOST /retrieveAndGeneraterequests, with an emptyvectorSearchConfiguration. BodyCanned RAG answer, session header set.operation: retrieve,numberOfResults: 3,searchType: HYBRIDPOST /knowledgebases/AB12CD34EF/retrievewith"vectorSearchConfiguration": {"numberOfResults": 3, "overrideSearchType": "HYBRID"}. The body is a List of 3KnowledgeBaseRetrievalResult.${body[0].content.text}=Passage 1,${body[0].score}=0.9. The...RetrievedResultsheader has 3 entries.marshal: json)[{},{},{}]operation: retrieve, nonumberOfResultsorsearchType"vectorSearchConfiguration": {}: no header was setoperation: retrieve, noknowledgeBaseIdretrieve operation requires knowledgeBaseId in the endpoint configurationoperation: invokeAgent,agentId: KX7Q2M9WZB,agentAliasId: TSTALIASID, nomodelIdand noknowledgeBaseIdPOST /agents/KX7Q2M9WZB/agentAliases/TSTALIASID/sessions/<random UUID>/textwithinputText. The body isCanned agent answer, as a String. The session header holds the new UUID, and the citations header has 1 entry.CamelAwsBedrockAgentRuntimeSessionId: my-session-42header.../sessions/my-session-42/text, and the header keepsmy-session-42operation: invokeAgent, noagentIdinvokeAgent operation requires agentId in configuration or header CamelAwsBedrockAgentRuntimeAgentIdmodelIdmodelArn. Real Bedrock was not tried.aws-bedrock-text-sink, not changed, on a scratch copy of the Kamelet:operation: converse,guardrailIdentifier,guardrailVersionConverse operation requires messages in header CamelAwsBedrockConverseMessagesaws-redshift-sourceandaws-redshift-sink:mainand this branch,camel get endpoint, source and sinkconsumedQuerymarks them, sink inserts a row (mainand this branch)CamelSqlUpdateCount1maxTotal: 1,maxWaitMillis: 1000, the same 4 messagesFailed to obtain JDBC Connection, and 1 is OKmaxTotal: 4,maxIdle: 1, the same 4 messagesmaxTotal: 1,maxWaitMillis: 2000,consumedQueryconsumedQuerygives up withTimeout waiting for idle object, maxWaitDuration=PT1.99998S. No row is marked.maxTotal: 1, nomaxWaitMillis,consumedQuerymaxTotal: 2,maxWaitMillis: 2000,consumedQuery./mvnw clean verify -DskipTestsand then./mvnw clean verifypassed. No test counts needed changing.Claude Code on behalf of Claus Ibsen
🤖 Generated with Claude Code