Skip to content

Feat/agentcore adapter#18

Open
rkmaws wants to merge 8 commits into
IABTechLab:mainfrom
rkmaws:feat/agentcore-adapter
Open

Feat/agentcore adapter#18
rkmaws wants to merge 8 commits into
IABTechLab:mainfrom
rkmaws:feat/agentcore-adapter

Conversation

@rkmaws

@rkmaws rkmaws commented Jun 3, 2026

Copy link
Copy Markdown

Amazon Bedrock Agentcore integration

Ranjith Krishnamoorthy added 8 commits April 24, 2026 23:15
Minimal changes to existing community code to support the AgentCore
deployment interface. All changes are additive and backwards-compatible
with the existing ECS/Docker deployment.

- .gitignore: add AgentCore artifacts (.bedrock_agentcore/, Dockerfile,
  *.db, .unique-id-*)
- pyproject.toml: register agentcore pytest marker, add test deps
- product_setup_flow.py: add CSV adapter fallback for loading products
  when MCP server is not available (AgentCore runs FastAPI+MCP in-process)
- chat/main.py: add storage parameter to ChatInterface constructor for
  external storage backend injection (AgentCore uses SQLite in-memory)
Add Amazon Bedrock AgentCore deployment interface for the seller agent.
Wraps the existing PublisherCrew and ChatInterface without modifying
community-maintained agent/crew code — all new files live in
src/ad_seller/interfaces/agentcore/ and patches/.

Runtime architecture:
- HTTP mode: BedrockAgentCoreApp entrypoint with two routing paths
  - crew: CrewAI PublisherCrew with native Bedrock Converse LLM
  - chat: existing ChatInterface keyword router
- MCP mode: FastMCP server exposing all 41 tools via Streamable HTTP
- Background FastAPI+MCP server on localhost for CrewAI tool callbacks

Key components:
- http_main.py: AgentCore entrypoint, routing, crew setup
- crew_tools.py: BaseTool subclasses for inventory, pricing, deals
- mcp_main.py: MCP-only entrypoint for tool serving
- patches/crewai_bedrock_fix.py: Bedrock Converse API compatibility
  (orphaned toolUse/toolResult sanitization, arg extraction fix)
- deploy.sh: Build and deploy via agentcore CLI with CodeBuild
- Workshop demo data: synthetic Meridian Media Group inventory (CSV)

Tests:
- 209 unit tests (tools, routing,community-maintained agent/crew code — all new files live in
src/mesrc/ad_seller/interfaces/agentcore/ and patches/.

Runtime arnt
Runtime architecture:
- HTTP mode: BedrockAgentnit- HTTP mode: Bedrockcr  - crew: CrewAI PublisherCrew with native Bedrock Converse LLM
  - chat: existing ChatInterface keyword router
- MCP mode: FastMCP server exposing all 41 tools via Streamable HTTP
- Background FastAPI+MCP server on localhost for CrewAI tool callbacks

Key components:
- http_main.py: AgentCore entrypoint, routing, crew setup
- crew_tools.py: BaseTool subclasses for inventory, pricing, deals
- mcp_main.py: MCP-only entrypoint for tool serving
- patches/crewai_bedrock_fix.py: Bedrock Converse API compatibility
  (orphaned toolUse/toolResult sanitization, arg extraction fix)
- deploy.sh: Build and deploy via agentcore CLI with CodeBuild
- Workshop demo data: synthetic Meridian Media Group inventory (CSV)

Tests:
- 209 unit tests (tools, routing, patches, deploy artifacts, data)
- 9 integration tests (live runtime invocation via agentcore CLI)

All changes in interfaces/agentcore/ and patches/ — no modifications
to community-maintained agent, crew, or flow code.
- Memory patch: replace StorageBackend with AgentCoreStorageBackend
- Set _read_only=True to prevent RememberTool injection
- Apply patch in http_main.py when CREW_MEMORY_ENABLED=true
- Memory LLM: Nova Lite, Crew LLM: Nova Pro (unchanged)
- Deploy script: CREW_MEMORY_ENABLED=true + MEMORY_LLM_MODEL
- crew_tools.py: CreateDealTool fallback now initializes chat
  interface to access CSV-loaded products (fixes 'Product not found'
  when REST static catalog doesn't have CSV products)
- mcp_server.py: Accept int|None on limit/days params to handle
  Bedrock Converse sending null for optional tool arguments
- docs/PRODUCTION_DATA_INTEGRATION.md: Guide for replacing demo
  CSV/SQLite with production ad server + database backends
- New: s3_csv_adapter.py — reads inventory/audiences from S3 with glob merge + 5-min cache
- New: storage-s3.yaml — CloudFormation template for seller data bucket + IAM
- New: tests/unit/clients/test_s3_csv_adapter.py — 9 unit tests (all passing)
- deploy.sh: added --inventory csv|s3|gam|freewheel flag (separated from --storage)
- deploy.sh: provision_s3_data_bucket() creates bucket + uploads CSVs
- ad_server_base.py: added S3 enum + factory case
- settings.py: added s3_data_bucket, s3_data_prefix, s3_data_region
- http_main.py: _get_chat() now uses get_ad_server_client() (respects AD_SERVER_TYPE)
- s3_csv_adapter.py: attaches raw dict (floor_price_cpm, inventory_type) to items

Note: ProductSetupFlow in the FastAPI background server still needs S3 wiring (follow-up)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant