Skip to content

Is it possible to have a customized lambda for advanced prompt collaborator routing?

0

I am creating a multi-agent service system using bedrock agents. I would like my main agent to send a brief message of service transfer before routing to a sub-agent, something like "Transferring your call to the service team."

I have already managed to send personalized messages before and after the agent's action, using the models in the AWS documentation, but I didn't find any example model for collaborator routing.

Does such a model exist? If not, what is the best way to achieve this?

2 Answers
0

Yes, you can implement a customized Lambda function to handle advanced prompt collaborator routing between your Bedrock agents with personalized messages.

There are a few approaches to achieve this:

  1. Custom Parser Lambda Function: You can write a custom parser Lambda function to override the default parser function in Amazon Bedrock Agents. This Lambda function can process the input from your main agent and format the output to include your transfer message before routing to a sub-agent.

  2. Orchestration with Lambda: Use AWS Lambda to orchestrate between multiple Bedrock agents. Your Lambda function can determine which agent to invoke based on the task type, and insert your "Transferring your call to the service team" message during the transition.

  3. Step Functions for Workflow: AWS Step Functions can be used to create a workflow that coordinates between different Bedrock agents, with Lambda functions handling the transitions and inserting your custom messages.

For implementation, your Lambda function would need to:

  • Process the input from the main agent
  • Insert your custom transfer message
  • Route the request to the appropriate sub-agent
  • Handle the response from the sub-agent

The Lambda function would expect an input event with fields like agent information, raw model output, and prompt type, and would return a properly formatted response that includes your transfer message.

This approach gives you the flexibility to format the output exactly as needed for your multi-agent service system while leveraging the power of Bedrock Agents.
Sources
How to get a specific formatted output from a Bedrock Agent that uses a KB? | AWS re:Post
Write a custom parser Lambda function in Amazon Bedrock Agents - Amazon Bedrock
Using Multiple bedrock agents | AWS re:Post

answered a year ago

0

To send a custom message before transfer, you need to use the main agent’s logic (via Lambda function or action group logic) to: Send a pre-routing message to the user ("Transferring you to the service team..."). Then trigger the collaborator routing (via API call or within agent logic). Create a Lambda-backed Action Group that: Sends a response to the user. Sets a flag (e.g., transfer_pending). On the next turn, based on the flag, performs the routing to the collaborator agent. If you're using Bedrock Agents with memory, you can store a short-term memory flag (about_to_transfer) and check that in your orchestration logic before executing the handoff. You can also manage routing and messaging in your client application: The main agent sends a "Transfer" instruction (e.g., a special message or signal). Your app intercepts it and: Displays the pre-transfer message. Connects the user to the collaborator agent (e.g., by switching contexts or agent IDs).

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.