Skip to content

AgentCore Gateway sources

A Gateway source reaches one connector target of an Amazon Bedrock AgentCore Gateway. You use it to give your agent your company knowledge, the web, or a knowledge graph, through one governed endpoint. The Gateway keeps its inbound auth, its policies, and its logs. Stash turns each answer into files.

A Gateway source is query-driven: its folder is empty until the agent searches it. Each search writes its hits as files, and prints a short preview of each one.

KindGateway toolEach search writes
gateway.bedrock-knowledge-basesRetrieveOne file for each passage, named after its document: 2026-11-22__checkout-runbook-pdf.md.
gateway.web-searchWebSearchOne file for each page that the results cite, at <host>/<path>.md.
gateway.aws-contextAgenticRetrieveOne file for each search, at <date>/<query>.md.

The source shows at gateway/CONNECTOR/NAME/. For example, [sources.runbooks] with kind = "gateway.bedrock-knowledge-bases" is at /tmp/ops-context/gateway/bedrock-knowledge-bases/runbooks/.

A Bedrock knowledge base source searches your documents. It has no keys of its own: the Gateway target names the knowledge base and sets the number of results.

A search previews each passage by rank. The top 5 passages show about 1,200 characters, up to the next 10 show about 150, and the rest about 100. Each preview keeps the sentences that match the query best. The agent opens a file only when the preview lacks what it needs.

A web search source searches the web. With fetch_pages = true, the default, Stash also fetches each cited https page and writes it as Markdown. When a fetch fails, the file holds the passages that the search returned.

The preview of each hit is its title, then the sentences of the result that match the query best. Passages from one page merge into one hit.

An AWS Context source asks a knowledge graph a question in natural language. It needs context_graph_id. Each search is one file with five parts:

  1. # Agentic answer: the answer.
  2. # Retrieved Context: the summary of each node or edge that the answer used.
  3. # Citation: the citations of the answer.
  4. # Request: the arguments that the search sent.
  5. After ---: the tool, partial when the service sends it, and the seconds it took.

The preview is the whole answer. The same query on the same day replaces the same file. The _sources/NAME.md page tells the agent to ask one complete question for each search.

[sources.runbooks]
kind = "gateway.bedrock-knowledge-bases"
description = "Team runbooks and postmortems"
gateway_url = "https://ops-gw.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp"
target = "runbooks-kb"
auth = { sigv4 = {} }
[sources.web]
kind = "gateway.web-search"
gateway_url = "https://ops-gw.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp"
target = "web-search-tool"
auth = { sigv4 = {} }
[sources.graph]
kind = "gateway.aws-context"
gateway_url = "https://ops-gw.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp"
target = "enterprise-graph"
context_graph_id = "REPLACE-ME"
auth = { sigv4 = {} }
KeyDefaultWhat it does
gateway_urlrequiredThe Gateway URL. It must have a path, such as /mcp.
targetrequiredThe connector target.
authnonesigv4, bearer (from env or file), or none.
regionfrom the hostnameThe SigV4 signing region. A custom hostname needs it.
headers{}More headers for each request, each from env or file.
protocol_version2025-11-25The MCP version that the client sends.
fetch_pagestruegateway.web-search only.
context_graph_idrequiredgateway.aws-context only.

With no auth, a source sends no credential, and a Gateway with AWS_IAM or CUSTOM_JWT inbound auth refuses each request. SigV4 needs bedrock-agentcore:InvokeGateway. See Gateway endpoint for each rule.

When a Gateway source starts, Stash lists the tools of its target. Each one is a schema file under _tools/, and stash tool call calls it:

Terminal window
stash tool list ops --source graph

The tool that the source searches with, such as WebSearch, doesn’t show in the list. Use stash search for it.

A Gateway can also front an AgentCore Memory with its agentcore-memory connector. That source is the agentcore-memory kind with an endpoint, not a Gateway kind. See AgentCore Memory source.