Skip to content

Retrievers (experimental)

Experimental

Retrievers are experimental. The YAML shape and the built-in retriever types may change in a minor release.

You want the agent to have access to relevant information beyond what's in its system prompt — but you don't know exactly what information is relevant until you see the actual question. That's when you use a retriever: a standalone retrievers/*.yaml resource that queries a search backend (web, Confluence, Jira, Slack, or your own) using the user's message, then injects the results before the agent runs.

Think of it as dynamic context: context is compiled in at build time, retrievers are looked up at run time based on the query.

Declaring and referencing a retriever

Like transformers:, a retriever is defined once as a standalone catalog file, then referenced by name from any agent that wants it — the shared skeleton (type, config) lives in the file; per-agent binding (if any) happens at the ref site:

# retrievers/web_context.yaml
name: web_context
type: web_search
config:
  max_results: 5

Save this as agents/investigator.md:

---
name: investigator
description: Investigates a support ticket
retrievers: [web_context]     # bare ref — no extra binding needed here
---
Investigate the ticket, using web search for anything you don't already know.

Execution flow

sources → compose user message → expand retriever query: (optional) → prompt_transform (optional) → retrieve → enrich message → agent → transformers (optional) → exposures

This flow runs under abt dispatch. abt run -s <agent> skips retrievers.

Optional transformers: reshape or guard the agent's text after the run; see Transformers.

By default each retriever uses the full composed message as its search query. Override it with query: in the retriever file. Inside query::

  • {{ task() }} — the task text the agent runs with, before retrieval (the default query).
  • {{ var('x') }} — a template variable.
  • {{ source('name') }} and {{ upstream('name') }} — the output of a predecessor node.

These are plain text substitutions, not a Jinja render. See Jinja variables — Not templated.

Optional prompt_transform / prompt_transform_config run an LLM step to rewrite or multiply queries before retrieve() — useful for noisy user text or structured backends (e.g. Confluence / Jira-style search strings). See Prompt transforms, including when to use transforms with Confluence / Jira–style search.

After retrievers run, the framework appends each result inside a <retrieved name="…"> block after the composed user message.

Referencing an upstream agent's output

Inside a retriever's query:, {{ upstream('agent_name') }} substitutes the named agent's output (its structured result if any, else its raw text), resolved from whichever workflow predecessor node has already completed — see Workflows. A name that isn't actually a predecessor is left as literal text, like an unmatched {{ source('name') }}.

# retrievers/kb_lookup.yaml
name: kb_lookup
type: confluence_search          # or any registered retriever type
query: "Find docs related to: {{ upstream('triage') }}"

When to use what

Mechanism When it runs Typical use
source nodes (workflow edges:) Before composition Fetch Slack threads, tickets, webhooks — raw context, read via {{ upstream() }} in a prompt node
context ({{ context.local(...) }}) Compile time Static snippets embedded in the agent body
retrievers: After composition Search driven by the actual user message text

Built-in retrievers

Uses the ddgs client (DuckDuckGo-backed, no API key).

uv pip install 'abt-core[web-search]'
# retrievers/web_context.yaml
name: web_context
type: web_search
config:
  max_results: 5        # default: 5, max meaningful: ~25

Prompt transforms: llm_rewrite is optional — DuckDuckGo tolerates natural language. Use [llm_rewrite, multi_query] for higher recall on incident-response agents (llm_rewrite compresses to keywords first).


Full-text search over Confluence pages using the atlassian-python-api CQL endpoint. Works with Confluence Cloud and Confluence Server/Data Center.

uv pip install 'abt-core[confluence]'

Add an atlassian credentials namespace in profiles.yaml (shared with jira_search):

outputs:
  dev:
    model_id: bedrock_converse:eu.anthropic.claude-haiku-5-5    # ...
    credentials:
      atlassian:
        url: https://your-org.atlassian.net
        username: your@email.com
        api_token: "{{ env_var('ATLASSIAN_API_TOKEN') }}"
# retrievers/confluence_docs.yaml
name: confluence_docs
type: confluence_search
credentials: atlassian           # shared with jira_search
config:
  max_results: 5                 # default: 5, hard-capped at 25
  spaces: "ENG,OPS"             # optional: restrict to specific space keys
  include_body: true            # default: true; false returns title+URL only
  cql_extra: "ancestor=12345"   # optional: appended with AND to the CQL
  cloud: true                   # default: true; set to false for Server/Data Center

Each result includes the page title, URL, space key, and a body excerpt (HTML stripped).

Prompt transforms: Use llm_rewrite when the agent's prompt is conversational — it compresses the message into CQL-friendly keywords. For higher recall, use [llm_rewrite, multi_query] — llm_rewrite compresses the task to keywords first, then multi_query fans out keyword variants. See Confluence, Jira, and similar backends for a full decision table.

Example with prompt_transform (same pattern works for jira_search; see below):

# retrievers/confluence_docs.yaml
name: confluence_docs
type: confluence_search
credentials: atlassian
prompt_transform: llm_rewrite
config:
  max_results: 5
  spaces: "ENG,OPS"

Text search over Jira issues using the jira client and JQL. Works with Jira Cloud and Jira Server/Data Center.

uv pip install 'abt-core[jira]'

Add an atlassian credentials namespace in profiles.yaml (shared with confluence_search):

outputs:
  dev:
    model_id: bedrock_converse:eu.anthropic.claude-haiku-5-5    # ...
    credentials:
      atlassian:
        url: https://your-org.atlassian.net
        username: your@email.com
        api_token: "{{ env_var('ATLASSIAN_API_TOKEN') }}"
# retrievers/jira_issues.yaml
name: jira_issues
type: jira_search
credentials: atlassian           # shared with confluence_search
config:
  max_results: 10                # default: 10, hard-capped at 50
  projects: "ENG,PLAT"          # optional: restrict to specific project keys
  fields: "summary,status,assignee,priority,description"   # default
  jql_extra: "sprint in openSprints()"  # optional: appended with AND to the JQL
  include_description: true     # default: true; truncated to 600 chars

Each result includes the issue key, summary, URL, status, priority, assignee, and a description excerpt.

Prompt transforms: Use llm_rewrite for general searches. For incident/alert agents, [llm_rewrite, multi_query] is the recommended default: llm_rewrite compresses the verbose task into keyword tokens, then multi_query generates keyword variants for broader recall. See Confluence, Jira, and similar backends.

Example with prompt_transform (chained strategies need llm_rewrite first so JQL gets keywords):

# retrievers/jira_issues.yaml
name: jira_issues
type: jira_search
credentials: atlassian
prompt_transform: [llm_rewrite, multi_query]
prompt_transform_config:
  num_variants: 2
  include_original: false
config:
  max_results: 10
  projects: "ENG,PLAT"

Search Slack messages via conversations.history keyword scan. Requires abt-core[slack] (slack_sdk).

uv pip install 'abt-core[slack]'
# profiles.yaml
default:
  target: dev
  outputs:
    dev:
      credentials:
        slack:
          bot_token: xoxb-…

Hard caps (not configurable): at most 3 comma-separated channels (more is an error), up to 5 pages of 200 recent messages each, and max_results between 1 and 25 (default 10). Output ends with a [Coverage] note saying how much history was scanned, so an empty result is not mistaken for "never said". A Slack failure (bot not in the channel, missing scope, rate limit with no hits) fails the retriever with the Slack code and a hint.

# retrievers/slack_history.yaml
name: slack_history
type: slack_search
credentials: slack
prompt_transform: llm_rewrite
config:
  max_results: 10
  channels: "C0MOCK00001"    # required — comma-separated conversation IDs
  match_mode: token        # optional: phrase (default) or token

Each result includes channel, permalink, author, excerpt, and channel_id / thread_ts for drill-down with the slack_thread_view tool.

Prompt transforms: Use llm_rewrite for noisy alert text (same guidance as Confluence/Jira). channels is required in retriever config (see slack-tools).


Custom retrievers

Register a class with the @retriever_provider("my_type") decorator under providers/*.py, or expose it via the abt.retriever_providers entry point group. The protocol matches retrieve(*, query, config, project_root, credentials) -> str. Decorate the instance, not the class — a bare class also passes the hasattr(cls, "retrieve") check but crashes at call time missing self:

# providers/my_retriever.py
from abt.retrievers.registry import retriever_provider

class MyRetriever:
    def retrieve(self, *, query, config, project_root, credentials) -> str:
        return f"results for: {query}"

my_retriever = retriever_provider("my_type")(MyRetriever())
# retrievers/my_lookup.yaml
name: my_lookup
type: my_type

Reference it from an agent the same way as any built-in: retrievers: [my_lookup].

Dry-run

abt run -s <agent> -p "..." --dry-run prints the execution plan without calling the LLM or any retriever, and the plan has no retriever lines. To see which retrievers an agent is wired to, run abt list --agent <agent>:

  agent  investigator
  retrievers  web_context

See also