A Gateway source reaches one connector target of an [Amazon Bedrock AgentCore Gateway](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway.html). 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.

## The three connectors

| Kind | Gateway tool | Each search writes |
| --- | --- | --- |
| `gateway.bedrock-knowledge-bases` | `Retrieve` | One file for each passage, named after its document: `2026-11-22__checkout-runbook-pdf.md`. |
| `gateway.web-search` | `WebSearch` | One file for each page that the results cite, at `<host>/<path>.md`. |
| `gateway.aws-context` | `AgenticRetrieve` | One 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/`.

### Knowledge bases

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.

### Web search

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.

### AWS Context

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.

## Configure it

```toml
[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 = {} }
```

| Key | Default | What it does |
| --- | --- | --- |
| `gateway_url` | required | The Gateway URL. It must have a path, such as `/mcp`. |
| `target` | required | The connector target. |
| `auth` | `none` | `sigv4`, `bearer` (from `env` or `file`), or `none`. |
| `region` | from the hostname | The SigV4 signing region. A custom hostname needs it. |
| `headers` | `{}` | More headers for each request, each from `env` or `file`. |
| `protocol_version` | `2025-11-25` | The MCP version that the client sends. |
| `fetch_pages` | `true` | `gateway.web-search` only. |
| `context_graph_id` | required | `gateway.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](/docs/user-guide/stash/reference/configuration/index.md#gateway-endpoint) for each rule.

## Tools

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:

```sh
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 memory through a Gateway

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](/docs/user-guide/stash/sources/agentcore-memory/index.md#through-a-gateway).

## Related

-   [Connect sources](/docs/user-guide/stash/guides/connect-sources/index.md)
-   [Progressive disclosure](/docs/user-guide/stash/capabilities/progressive-disclosure/index.md)
-   [Command reference: `stash search`](/docs/user-guide/stash/reference/cli/index.md#stash-search)