feat: AgentCore tool search plugin for Strands Agents#494
feat: AgentCore tool search plugin for Strands Agents#494senthilkumarmohan wants to merge 3 commits into
Conversation
notgitika
left a comment
There was a problem hiding this comment.
thanks for contributing! added some comments
| INTENT_SYSTEM_PROMPT = ( | ||
| "You are an intent classifier. Given the recent conversation messages, " | ||
| "produce a concise one-sentence description of what the user is trying to accomplish. " | ||
| "Focus on the type of task, not the specific details. " | ||
| "Reply with ONLY the intent description, nothing else." | ||
| ) |
There was a problem hiding this comment.
could this be prone to user manipulation? like ignore all previous instructions and... is there a way we can validate that?
There was a problem hiding this comment.
DefaultIntentProvider uses the agent's model (which can be configured with Bedrock Guardrails). Users can also pass a custom BedrockModel with guardrails attached via the constructor. Additionally, the intent classifier has a constrained system prompt, no tools, and only receives user-typed messages — so the worst case of prompt injection is a poor search query, not code execution or data leakage.
Open to recommendations if you think we should add additional hardening here.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #494 +/- ##
=======================================
Coverage ? 89.47%
=======================================
Files ? 89
Lines ? 7745
Branches ? 1157
=======================================
Hits ? 6930
Misses ? 517
Partials ? 298
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8165cda to
287ed95
Compare
| ) | ||
|
|
||
|
|
||
| class DefaultIntentProvider(IntentProvider): |
There was a problem hiding this comment.
Can we rename this to StrandsIntentProvider to indicate we are using a Strands Agent to derive intent?
| class DefaultIntentProvider(IntentProvider): | ||
| """LLM-based intent provider that classifies the last N messages.""" | ||
|
|
||
| def __init__(self, message_window: int = 5, model=None): |
There was a problem hiding this comment.
I think we should allow customers to configure the system prompt. Set the default to INTENT_SYSTEM_PROMPT.
| @@ -0,0 +1,5 @@ | |||
| """Gateway Strands plugins.""" | |||
|
|
|||
There was a problem hiding this comment.
Missing __init__.py at gateway/integrations/ and gateway/integrations/strands/. Without those, this won't be importable from an installed wheel since pyproject.toml uses packages = ["src/bedrock_agentcore"].
| import logging | ||
|
|
||
| from mcp.types import Tool as MCPTool | ||
| from strands.hooks import BeforeInvocationEvent |
There was a problem hiding this comment.
mcp isn't declared as a dependency in pyproject.toml — you're relying on it being pulled in transitively by strands-agents. If that ever changes, this breaks with no clear error. Worth adding it explicitly.
|
|
||
| ```bash | ||
| pip install agentcore-tool-search-plugin | ||
| ``` |
There was a problem hiding this comment.
This package doesn't exist — it's part of bedrock-agentcore. Same issue on line 25 with the import path. The examples further down (line 90+) have the correct import; these first ones will confuse people.
Description of changes:
This pull request introduces the AgentCore Tool Search Plugin for Strands Agents, enabling dynamic semantic tool discovery from AgentCore Gateway based on conversation intent.
AgentCore Tool Search Plugin:
AgentCoreToolSearchPluginthat hooks intobefore_invocationto derive user intent from conversation history, search the gateway viax_amz_bedrock_agentcore_search, and dynamically register matching tools into the agent. (src/bedrock_agentcore/gateway/integrations/strands/plugins/agentcore_tool_search/plugin.py)IntentProviderabstract interface for pluggable intent derivation strategies. (src/bedrock_agentcore/gateway/integrations/strands/plugins/agentcore_tool_search/intent_providers/intent_provider.py)DefaultIntentProviderwhich uses an LLM to classify the last N messages into a concise intent string, with support for explicit model override or automatic reuse of the agent's model. (src/bedrock_agentcore/gateway/integrations/strands/plugins/agentcore_tool_search/intent_providers/default_intent_provider.py)Documentation and Examples:
src/bedrock_agentcore/gateway/integrations/strands/plugins/agentcore_tool_search/README.md)Testing and Validation:
tests/bedrock_agentcore/gateway/integrations/strands/test_agentcore_tool_search_plugin.py,tests/bedrock_agentcore/gateway/integrations/strands/test_intent_providers.py)tests_integ/gateway/integrations/test_agentcore_tool_search_plugin.py,tests_integ/gateway/integrations/lambda_function/lambda_function.py)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.