Skip to content

Bedrock agent using claude sonnet response taking too long

1

I have a Bedrock agent, that is provided with multiple sql database schemas for sql query generation and database query. The response will be in html format for better representation (tables and charts) in UI. I am using Claude Sonnet model for more accurate sql query generation. Every agent response takes around 15-50 seconds. Is it possible to reduce the agent response time to within 15 seconds using the same model and if possible how can i achieve this?

asked 2 years ago3.4K views
2 Answers
2

Hi,

Are you using advanced prompts? Something like post-processing prompt can delay the response. When you check the trace, which step takes the most? If you enable orchestration template, that also has a hit in performance.

Here are more checks to consider for the performance: https://docs.aws.amazon.com/bedrock/latest/userguide/agents-optimize-performance.html The more template and more instructions, it can also slow it down. Analyzing the traces can help you understand at which step the agent takes the most so you can target that for optimization.

AWS
EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
  • Hi, In advanced prompts I am only using orchestration prompt where i am providing the sql database schemas and the response formatting instructions with examples. In the trace most of the time is taken by orchestration prompt itself. Even my database query lambda tool hardly takes 1-3 seconds for response.

  • Can you move the Orchestration example to the Agent instruction box and disable Orchestration template?

  • I am getting this error "Validation failed for quota max-instruction-size. The maximum number of resources is 4000, but account requested 7951 resources. Retry the request with fewer resources." I also noticed that without the orchestration prompt my agent group is not invoked and the database query lambda tool is not getting called. I am also providing the sql database schemas in orchestration prompt which i can't provide in instructions because of the 4000 character limit

  • Understood. First take a look at the description field for each action item. Ensure the schema description is used as well to make your agent aware what these API are and what used for. Sometimes the instructions in the instructions box are built up over-time. Try to re-sort and optimize the duplicate instructions. Finally, for text2sql prompt engineering, you are int he right track. Check this blog if the construct of the orchestration in this example helps optimizing it: https://github.com/build-on-aws/bedrock-agent-txt2sql

  • Let me know if these instructions helped with your agent performance.

0

i'm having same problem, i wonder if u solved the case ?

answered 2 years 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.