Agentcore Search Tool plugin must covers allow list
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 64/100
Direzione di ricerca
Inizia leggendo AgentCoreToolSearchPlugin e il suo punto di ingresso search_and_filter_tools, inclusi la chiamata x_amz_bedrock_agentcore_search e il flusso _build_tools_from_search_result. Implementa il comportamento della allowlist mostrato nell’esempio, in modo che i risultati della ricerca semantica includano solo gli strumenti consentiti, mentre una allowlist vuota mantenga il comportamento attuale senza restrizioni. Verifica sia le ricerche con restrizioni sia quelle senza restrizioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
When defining McpClient for agentcoregateway we can define an allowlist , but using the semantic search using Agentcore Search Tool breaks the alowlist functionality and can introduce extra level of halucination and difficulties during agent loop and tool selection.
Describe the solution you'd like
The Plugin can apply the allowlist after semantic search call , this way , even agentcore gateway retourns Many tools form an OpenApi Spec ( etc..) this allow list validation will only return the tools that are present in allow list.
Describe alternatives you've considered
In every project we create a custom plugin to apply the solution. while this works but create a lot of repeated code for all strands agent SDK users
Additional context
A example of plugin used
import logging
from bedrock_agentcore.gateway.integrations.strands.plugins import AgentCoreToolSearchPlugin
from strands.hooks import BeforeInvocationEvent
from strands.plugins import Plugin, hook
from strands.tools.mcp import MCPClient
from .intent import _UNIFIED_INTENT_PROVIDER, UnifiedIntentProvider
logger = logging.getLogger(__name__)
class McpClientSearchPlugin(AgentCoreToolSearchPlugin):
"""Tool-search plugin scoped to one gateway's MCP client, driven by ``ParallelToolSearchPlugin``."""
def __init__(
self,
mcp_client: MCPClient,
*,
name: str,
domain: str,
allowed_tool_names: frozenset[str] = frozenset(),
):
"""
Args:
mcp_client: MCP client connected to this gateway.
name: Plugin name for each gateway.
domain: ``UnifiedIntentDecision`` field name this gateway's intent comes from.
allowed_tool_names: Drops search results not in this set; empty (default) means no restriction.
"""
self.name = name
self.domain = domain
super().__init__(mcp_client)
self._allowed_tool_names = allowed_tool_names
def search_and_filter_tools(self, intent: str) -> list:
"""Search the gateway for given intent. And filter allowed tools """
if not intent:
logger.info("%s loaded 0 tool(s): intent empty or out of scope", self.name)
return []
try:
result = self._mcp_client.call_tool_sync(
tool_use_id="intent-search",
name="x_amz_bedrock_agentcore_search",
arguments={"query": intent},
)
agent_tools = self._build_tools_from_search_result(result)
except Exception as e:
logger.error("AgentCore Gateway search failed: %s", e)
return []
if not self._allowed_tool_names:
return agent_tools
allowed, dropped = [], []
for agent_tool in agent_tools:
(allowed if agent_tool.tool_name in self._allowed_tool_names else dropped).append(agent_tool)
if dropped:
logger.warning(
"%s: dropping non-allowlisted tool(s) surfaced by search: %s",
self.name,
sorted(t.tool_name for t in dropped),
)
return allowed
def apply_tools(self, event: BeforeInvocationEvent, agent_tools: list) -> None:
"""Swap the tools this plugin registered in a previous invocation of this session for ``agent_tools``."""
for name in list(self._loaded_tool_names):
event.agent.tool_registry.registry.pop(name, None)
self._loaded_tool_names.clear()
for agent_tool in agent_tools:
event.agent.tool_registry.register_tool(agent_tool)
self._loaded_tool_names.add(agent_tool.tool_name)
logger.info(
"%s loaded %d tool(s): %s",
self.name,
len(self._loaded_tool_names),
sorted(self._loaded_tool_names),
)
- Lingua principale
- Python
- Stelle
- 786
- Fork
- 163
- Merge medio
- 4h
- PR unite (30g)
- 22
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws/bedrock-agentcore-sdk-python
-
bug high-severity
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
aws/bedrock-agentcore-sdk-python#752 ·
I maintainer di solito rispondono entro 1 giorno
-
OpenAIConverseConverter restores an empty history when one blob or text payload fails to parseApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
aws/bedrock-agentcore-sdk-python#751 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
delete_all_long_term_memories_in_namespace deletes only the first 10 recordsForse già presa @Fire162 l’ha presa 18 giorni fa. Apertabug high-severity
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
aws/bedrock-agentcore-sdk-python#727 ·
I maintainer di solito rispondono entro 1 giorno
-
MPP: credential is always sent in Authorization, ignoring header="Payment-Authorization" in the challengeForse già presa @abhiramshaji-cyber l’ha presa 24 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
aws/bedrock-agentcore-sdk-python#702 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] update_message fails with parameter validation error when SessionMessage.message_id is a Strands positional integer indexForse già presa @citizen204 l’ha presa 144 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
aws/bedrock-agentcore-sdk-python#556 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di aws/bedrock-agentcore-sdk-python
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
bug difficulty:2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
MakazhanAlpamys/Soup#3167 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
snap-stanford/Biomni#380 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
jsboige/CoursIA#27768 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Resource]: Math ParadoxesAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
rossant/awesome-math#206 ·