Skip to content

Add Brave Search web-search partner extension (aws-brave/) - #7

Open
SaRedfiche wants to merge 1 commit into
aws-samples:mainfrom
SaRedfiche:feature/brave-web-search
Open

Add Brave Search web-search partner extension (aws-brave/)#7
SaRedfiche wants to merge 1 commit into
aws-samples:mainfrom
SaRedfiche:feature/brave-web-search

Conversation

@SaRedfiche

Copy link
Copy Markdown

Summary

Adds a partner extension under aws-brave/ that gives the workshop's agents live web search via the Brave Search API, following the framework's partner-extension pattern — an AgentCore Gateway Lambda target surfaced through a Strands A2A "Research Agent." The core aws-only/ track is untouched.

What's included

  • code/web_search_lambda/ — stdlib-only Brave client + Lambda handler (anycompany_brave_web_search); reads the API key from Secrets Manager at runtime.
  • code/research_agent/web_search @tool, MCP tool schema, and the A2A server (cloned from the base Order/Refund agent pattern).
  • code/tests/ — 20 unit tests (Brave client, Lambda handler, tool-arg builder, schema) — no AWS or network needed.
  • workshop/l3-orchestration/6_web_search_agent.ipynb — end-to-end deploy lab: key entry → Lambda → Gateway target → MCP smoke test → Research Agent deploy (CodeBuild) → Registry → direct A2A invoke → cleanup.
  • README.md — architecture, a native AgentCore Web Search vs. Brave (partner) contrast, security, cost, and cleanup.

How it wires in

Research Agent (A2A, Registry-discoverable)
  └── @tool web_search → AgentCore Gateway (MCP, Cognito JWT)
        └── Lambda: anycompany_brave_web_search
              ├── Secrets Manager: brave/search-api-key
              └── Brave Web Search API

Routing through the Gateway means the tool inherits L4 PII masking and L5 tracing, consistent with the base agents.

Testing

  • cd aws-brave/code && python3 -m venv .venv && .venv/bin/python -m pip install -r requirements-test.txt && .venv/bin/python -m pytest tests/ -v20 passed.
  • Deployed and validated end-to-end in a SageMaker Studio environment (us-west-2): the raw MCP tools/call and the deployed Research Agent both return live Brave results with citations.

Security notes

  • Brave API key lives only in Secrets Manager; never in code or the notebook (the key-entry cell has a single paste target + sanity check).
  • Web results are treated as untrusted (prompt-injection guidance in the agent's system prompt; L4 Guardrail masking applies via the Gateway).
  • Lambda execution role scoped to GetSecretValue on the Brave secret only.

Adds a partner extension under aws-brave/ giving the workshop agents live
web search via the Brave Search API, wired as an AgentCore Gateway Lambda
target surfaced through a Strands A2A Research Agent.

- web_search_lambda/: stdlib-only Brave client + Lambda handler (key from Secrets Manager)
- research_agent/: web_search @tool, MCP tool schema, A2A server
- tests/: unit tests (Brave client, Lambda handler, tool/schema)
- workshop/l3-orchestration/6_web_search_agent.ipynb: end-to-end deploy lab
- README: architecture, native AgentCore Web Search vs partner contrast, security, cleanup

aws-only/ is untouched.
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