Skip to content

differences in Bedrock Agent invocation between console and API

0

We are using an Agent with several KBs using S3 Vector storage.

We built a Lambda to create an interface to query the Agent from the browser. We loaded the KB with a known set of documents.

When querying it through the browser we get completely different answer to our queries.

Here is an example:

Browser Q: do you have any reports by CB Insights

A: I've searched for CB Insights reports but I'm not finding specific reports from this company in our knowledge base. Would you like me to continue searching for other specific types of reports or information about AI chips that might be available?

The same question using the Agent Dialog inside the AWS console returns the following:

Q: <h2>CB Insights - What We Know</h2> Based on the search results, CB Insights appears to be a market intelligence and research firm that focuses on tracking technology startups, venture capital, and technology trends. The company maintains a database of technology companies and startups that can be accessed through their website (www.cbinsights.com). For example, in our search results, we can see references to company profiles such as: - www.cbinsights.com/company/nomic-ai - www.cbinsights.com/company/nous-research - www.cbinsights.com/company/number-station - www.cbinsights.com/company/mechanical-orchard - www.cbinsights.com/company/midjourney These suggest that CB Insights maintains a comprehensive database of technology startups with a particular focus on AI companies. [1] <h2>What Does CB Insights Do?</h2> While our search didn't yield a specific company description, CB Insights appears to: 1. Track and maintain data on technology startups and companies 2. Provide market intelligence on the tech sector 3. Offer reports and research on technology trends, particularly in AI 4. Monitor funding rounds and investment activity in the startup ecosystem The company seems to position itself as a source of data and insights for those following the technology industry, venture capital investments, and emerging startups. [2] <h2>Additional Information</h2> Unfortunately, our knowledge base doesn't contain comprehensive information about: - When CB Insights was founded - Who the company's leadership is - How large the company is - Their specific product offerings - Pricing for their services If you're interested in learning more about CB Insights, you might want to visit their official website directly or look for recent news articles about the company. [3] <h2>Would You Like to Know More?</h2> Would you be interested in: 1. Information about similar market intelligence companies in the tech sector? 2. More details about specific reports or research areas that CB Insights might cover? 3. Information about technology market trends that might be similar to what CB Insights tracks? 4. Specific data about any of the companies mentioned in the CB Insights database?

not only it ‘knew’ about the firm but also properly cited the documents which contained the information about the company.

1 Answer
0

The difference in responses you're experiencing between the browser interface (via Lambda) and the AWS console is likely due to how the agent is being invoked in each scenario.

When testing in the AWS console, you're working with the draft version of the agent which has full access to all configured knowledge bases and action groups. The console environment is optimized for testing and provides comprehensive access to the agent's capabilities.

When invoking the agent through your Lambda function using the API, there are several potential causes for the discrepancy:

  1. Version differences: The Lambda is likely invoking a deployed version of the agent through an alias, while the console tests the draft version. If you recently updated your knowledge base or agent configuration but didn't create a new version and update the alias, your Lambda would be using an older version.

  2. Session state handling: When using the API, you need to properly manage the session state to maintain context across interactions, which might not be happening in your Lambda implementation.

  3. File references: If your knowledge base includes file references, these need to be properly passed in the API call using the sessionState parameter with the files array.

  4. Missing permissions: Your Lambda execution role might not have all the necessary permissions to fully access the knowledge bases.

To resolve this issue:

  • Prepare a new version of your agent after making any changes
  • Update your agent alias to point to this new version
  • Ensure your Lambda has the correct permissions to invoke the agent and access all resources
  • Verify you're passing the correct parameters in your InvokeAgent API call

This approach should help align the behavior between your browser interface and the console testing environment.
Sources
BedRock Agent ignoring lambda provided to answer questions | AWS re:Post
View information about an agent - Amazon Bedrock
Bedrock Agent API Ignores inputFiles Parameter but Console Works | AWS re:Post

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.