Skip to content

AgentCore loads and looks up only the first 100 inventory items #124

Open

Description

@Sirajmx

The AgentCore runtime (interfaces/agentcore/) reads inventory through AdServerClient.list_inventory() with no limit. That uses the adapter default of 100, so a CSV or S3 inventory with more than 100 rows is cut off without any error. #117 fixed the same default on the sync and the CSV-mode REST catalog (limit=None). These two AgentCore call sites were not part of that change. Both date from the original AgentCore adapter (#18).

Where

  1. Startup product load: interfaces/agentcore/http_main.py:276, in _get_chat(). This fills ChatInterface._products, the product set the AgentCore chat agent works from. With more than 100 rows, the agent only knows the first 100, and the log line Loaded 100 products from csv adapter is the only sign of it.
  2. Deal lookup fallback: interfaces/agentcore/crew_tools.py:341, in create_deal_direct. When a product isn't in the cache or the REST catalog, this last-resort lookup scans list_inventory() for the id. It only scans the first 100 items, so a product past row 100 returns {"error": "Product not found: <id>"}.

Impact: AgentCore deployments with more than 100 inventory items (CSV or S3) can't see or book anything past item 100. The REST/MCP catalog (GET /products) is not affected after #117.

Suggested fix

  • Pass limit=None at both call sites, matching fix: real, storage-backed catalog for synced ad servers (AI-6) #117.
  • For the lookup in create_deal_direct, scanning the whole inventory for one id is O(n) per deal. Using the already-loaded product set (or the shared catalog) first and keeping the scan as the fallback would avoid that.
  • Add a test with a 150-row CSV inventory for each path. The AgentCore runtime import needs bedrock_agentcore stubbed in tests.

Not verified live

I confirmed this from the code and from #117's 150-row CSV repro of the same adapter default. I couldn't run the AgentCore runtime locally: bedrock_agentcore isn't installed in the dev environment, and with it stubbed, importing http_main doesn't return.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions