Extending abt with plugins
abt resolves most integration points at runtime through setuptools entry
points (declared in your distribution's pyproject.toml). That means a
third-party package can register a new source, exposure,
retriever, transformer, model provider, context provider, or singular test
without patching abt — as long as it matches the small contract
below.
Every entry-point group lives under the abt.* namespace and is discovered
by a central PluginRegistry in abt.contracts.registry. Resolution order
is project-local providers/*.py → built-ins → entry points — a
project-local plugin always wins, so you don't need to publish a package
just to override a built-in or add a one-off type for a single project.
9 of the 13 groups below support this project-local path (see the table in
Project-local plugins below); the other
4 are entry-point only.
abt.contracts is the stable plugin surface — the Protocol classes it
declares (abt.contracts.protocols) are what your plugin implements against,
not abt.sdk (which is a runner-facing convenience API for embedding abt in
another app, not an extension point). An import-linter contract forbids
abt.contracts from importing any other abt.* package (abt.cli,
abt.commands, abt.runtime, abt.sdk, abt.artifacts, and the rest of
abt's internals), so depending on it can't accidentally pull in the
framework's runtime machinery. Every first-party integration (Slack, Jira, Confluence,
Local) is registered through these same entry-point groups in
pyproject.toml — there is no separate, more-privileged internal mechanism;
the groups are the only expansion surface, no subclassing or monkey-patching
required.
The rest of this page catalogs each group, shows its contract, and gives a
minimal registration snippet. For a real, installable package with a
working example for each group except abt.source_thread_keys — not just a snippet — see
docs/build/examples/abt_plugin_examples.
How to register a plugin
Add the target under [project.entry-points."abt.<group>"] in your
package's pyproject.toml:
[project.entry-points."abt.source_providers"]
my_api = "my_pkg.sources:my_api_provider"
my_pkg.sources.my_api_provider must then satisfy the group's contract
(Protocol, dataclass, or callable — see below). Install the wheel into the
same environment as abt; abt compile / abt dispatch will pick it up
on the next run.
Project-local plugins (providers/)
Don't need to share the plugin outside this project? Skip packaging
entirely. Drop a decorated function/class in providers/*.py
(paths.providers in abt.yaml, default providers/) — every .py file
in that directory is scanned at compile time, no pyproject.toml entry, no
pip install, no restart beyond the next abt command. It wins over both
built-ins and entry points.
# providers/my_source.py
from abt.sources.registry import source_provider
@source_provider("my_api")
def my_api_source(*, credentials: dict[str, str], config: dict) -> str:
return f"fetched: {config.get('query')}"
# sources/my_source.yaml
name: my_source
type: my_api
requires_credentials: false # this example needs no credentials; see Sources
abt create / abt modify can write Python for you when a task genuinely needs a type: nothing built-in or
already registered covers. Pass --allow-python. The generated code runs during validation, so read it before you
opt in. The model is told to reuse an existing or built-in type first; see
abt create and abt modify.
Coverage — 9 of 13 groups support providers/, the rest are entry-point
only:
Supports providers/ |
Entry-point only |
|---|---|
source_providers, exposure_dispatchers, context_providers, retriever_providers, transformer_providers, checkpoint_backends, middleware, external_approvals, source_thread_keys |
model_providers, singular_tests, doctor_rules, mcp_loaders |
For the entry-point-only column, use
abt_plugin_examples
(pip-distributable) instead.
Gotcha, same shape as the bare-class one below for
doctor/MCP plugins: for groups where the contract is hasattr(obj,
"fetch"/"retrieve"/"transform") (context providers, retrievers,
transformers), decorate an instance, not a bare class — a class also
has hasattr(cls, "fetch") true (unbound methods are still attributes), so
it passes discovery but crashes at call time missing self. checkpoint_backend
and external_approval_for are the exception: decorate the class directly,
the registry instantiates it for you.
This is also how you override a built-in for a single project: a
providers/slack.py with @exposure_dispatcher("slack") on your own
function replaces the built-in Slack dispatcher project-wide, no wheel
required.
Gotchas
Three things to watch for, whichever mechanism you use:
- Sources with no credentials need
requires_credentials: false. The credential check runs for every source by default. Setrequires_credentials: falseon the source YAML to opt out (see Sources). Exposures get the same bypass only for the built-inlocaltype. If a source does use credentials, addfreshness: {on_missing_credentials: skip}and a non-empty dummy value undercredentials.<type>inprofiles.yaml.skipalone still no-ops the fetch to an empty payload. {{ context.<name>(...) }}needs a positional first arg (a cache/slot name) even if you only call it once. A kwargs-only call is silently dropped during compile-time extraction and fails at runtime with'context' is undefinedinstead of a compile error.- Third-party log lines need an
abt.*-prefixed logger name to reachlogs/abt.logunder the SDK, and to log DEBUG there at all. On CLI runs the per-run file handler sits on the root logger, soget_logger(__name__)in your own package (e.g.my_pkg.middleware) reaches the file at INFO+; its DEBUG records are dropped, as are all library DEBUG records (botocore logs signed requests there, which must not land in a file people attach to bug reports). When abt is embedded (configure_logging=False, or the host app already configured the root logger) the handler attaches to the"abt"logger only, somy_pkg.middlewarenever reaches it. Useget_logger("abt.my_pkg.middleware")to work in both.
Entry-point groups
abt.source_providers — fetch external content as prompt context
Contract: abt.contracts.protocols.SourceProvider.
from typing import Any, Protocol
class SourceProvider(Protocol):
def fetch(self, *, credentials: dict[str, str], config: dict[str, Any]) -> str: ...
A workflow's source nodes (sources/slack_thread.yaml, referenced by name from workflows/*.yaml edges; a bare name, or a single-key
mapping binding vars at the ref site) resolve against the group name.
Credentials come from profiles.yaml; config comes from the standalone
sources/*.yaml catalog file. Needs no real credentials? See the credential-free
gotcha above — every source type goes
through the same check, no exceptions.
Full working example: static_text_source in
abt_plugin_examples/sources.py.
abt.source_thread_keys — derive a checkpoint/resume key for a source type
Contract: a plain callable, (*, credentials: dict[str, str], config: dict) -> str | None.
from abt.sources.registry import source_thread_key
@source_thread_key("slack_thread")
def slack_thread_key(*, credentials, config) -> str | None:
ch = str(config.get("channel_id", "")).strip()
ts = str(config.get("thread_ts", "")).strip()
return f"slack:{ch}:{ts}" if ch and ts else None
Given a source's resolved config (and credentials, if the key needs them), return a stable string identifying "the same conversation" across runs — used to resume the correct checkpoint thread for abt watch and stateful re-dispatch. Return None when there's no natural thread boundary for this invocation (e.g. a required config field is missing) — the caller falls back to treating it as a fresh thread. Built-in keys exist for slack_thread, jira_issue, and github_pr; pair a custom source_provider with a matching source_thread_key if your source type needs checkpoint resumption too.
abt.exposure_dispatchers — post results to external sinks
Contract: abt.contracts.protocols.ExposureDispatcher.
from typing import Any, Protocol
from abt.contracts.types import RunResult
class ExposureDispatcher(Protocol):
def send(
self,
*,
result: RunResult,
config: dict[str, Any],
credentials: dict[str, str],
) -> Any: ...
A workflow's own exposure sink node (a bare name under exposures/, wired into the
workflow's own edges: after the agent whose result it delivers) resolves against the group
name; config comes from the standalone exposures/*.yaml catalog file.
Dispatchers receive the fully-rendered config and the final
RunResult (from abt.contracts.types). The return value is ignored. Same
credential-free gotcha as sources — only
the built-in local type is exempt from the credential check.
Full working example: jsonl_audit_log_dispatcher in
abt_plugin_examples/exposures.py.
abt.singular_tests — whole-file test runners for abt test
Contract: abt.contracts.protocols.SingularTestRunner (structural — no
inheritance required).
Built-ins: comparison (A/B runs) and conversation (multi-turn scripts).
from pathlib import Path
from typing import Any
from pydantic import BaseModel
class MyScenarioRunner:
top_level_key = "my_scenario" # matches the YAML file's top-level key
def parse(self, raw: dict[str, Any], path: Path) -> BaseModel: ...
async def run(
self,
spec: BaseModel,
*,
factory: Any,
run_results_dir: Path | None = None,
project_config: Any | None = None,
fail_fast: bool = False,
project_root: Path | None = None,
) -> list[Any]: ...
[project.entry-points."abt.singular_tests"]
my_scenario = "my_pkg.testing:MyScenarioRunner"
A file under tests/*.yaml whose top-level key is my_scenario is then
parsed and run by this class. See Testing
for the built-in comparison/conversation YAML shapes this same loader
mechanism drives. Entry-point only — no providers/ discovery for this
group.
Full working example: SmokeTestRunner in
abt_plugin_examples/singular_tests.py —
a one-agent, one-prompt smoke test under a smoke: top-level key.
abt.context_providers — external-content fetchers for {{ context.* }}
Contract: an instance (not a factory, not a bare class) exposing
fetch(*, ref, project_root) and source_string(ref):
class ConfluenceContextProvider:
def fetch(self, *, ref: ContextRef, project_root: Path) -> str: ...
def source_string(self, ref: ContextRef) -> str: ...
confluence_context_provider = ConfluenceContextProvider()
First-party examples: abt.adapters.confluence.context_provider:confluence_context_provider
and abt.adapters.github.context_provider:github_context_provider — both
are pre-built module-level instances, not factories.
Use it from a prompt as {{ context.<name>('slot_name', **kwargs) }} —
the first positional arg is a cache/slot name, required even if you only
have one call site. A kwargs-only call is silently dropped at compile time;
the prompt then fails at runtime with 'context' is undefined.
Full working example (no network): local_file_context_provider in
abt_plugin_examples/context_providers.py.
abt.model_providers — alternative chat-model backends
A callable that returns a LangChain chat model:
def my_provider(profile: ProfileTarget, *, model_id: str, extra_model_kwargs: dict | None = None) -> BaseChatModel: ...
The name is the provider: prefix on a model_id in profiles.yaml
(my_provider:some-model). Built-ins (bedrock_converse, openai,
anthropic, azure_openai) live in abt.llm_providers and use this same
signature. Entry-point
only — no providers/ discovery for this group.
Full working example (zero-cost, no network): fake_echo_provider in
abt_plugin_examples/model_providers.py.
abt.retriever_providers — agent-referenced retrieval
Contract: abt.contracts.protocols.RetrieverProvider.
from pathlib import Path
from typing import Any, Protocol
class RetrieverProvider(Protocol):
def retrieve(
self,
*,
query: str,
config: dict[str, Any],
project_root: Path,
credentials: dict[str, str],
) -> str: ... # formatted retrieval results as a string
Built-ins: web_search, confluence_search, jira_search, slack_search.
Full working example (no network): local_grep_retriever in
abt_plugin_examples/retrievers.py.
abt.transformer_providers — post-agent text transforms
Contract: abt.contracts.protocols.TransformerProvider.
from pathlib import Path
from typing import Any, Protocol
class TransformerProvider(Protocol):
def transform(
self,
*,
text: str,
config: dict[str, Any],
project_root: Path,
credentials: dict[str, str],
) -> str: ... # raise to block output
Built-ins: json_extract, pii_redact, llm_rewrite, llm_guard,
assert, regex_replace.
Full working example: word_replace_transformer in
abt_plugin_examples/transformers.py.
abt.checkpoint_backends — conversation-state persistence backends
Contract: an instance exposing an async-context-manager
build(*, spec_config, workspace_dir) that yields the underlying checkpoint
saver, and extra_configurable(spec_config) -> dict. Use this to plug in a
new storage backend (e.g. Postgres) for the built-in checkpoint mechanism
that persists conversation state across runs.
from abt.checkpoint import checkpoint_backend
@checkpoint_backend("postgres")
class PostgresBackend:
async def build(self, *, spec_config, workspace_dir):
...
def extra_configurable(self, spec_config):
return {}
[project.entry-points."abt.checkpoint_backends"]
postgres = "my_pkg.checkpoint:PostgresBackend"
Built-ins: memory, sqlite, bedrock_agentcore, dynamodb. A project can
also drop a @checkpoint_backend(...)-decorated class under its own
providers/ directory to register a local backend without publishing a
package — same project-overrides-entry-point precedence as every other group
on this page.
Wrapping an already-implemented checkpointer needs no class at all —
wrap_checkpointer(name, make_saver) takes a spec_config -> async context
manager callable (exactly what AsyncXSaver.from_conn_string(...)-style
factories already return):
from abt.checkpoint import wrap_checkpointer
postgres = wrap_checkpointer("postgres", lambda spec_config: AsyncPostgresSaver.from_conn_string(spec_config["dsn"]))
Full working example (using wrap_checkpointer, no new dependency):
demo_memory_backend in
abt_plugin_examples/checkpoints.py.
abt.middleware — agent execution middleware
Contract: a callable (config: dict, ctx: FactoryContext) -> list[Any]
returning middleware instances that plug into the agent's execution workflow
(retry, compaction, budget limits, loop detection, ...), or a class
implementing the same construction shape for project-local middleware (see
Middleware for the full authoring guide, including
the @middleware(name, must_precede=[...], must_follow=[...]) decorator that
declares ordering constraints against other middleware).
[project.entry-points."abt.middleware"]
rate_limiter = "my_pkg.middleware:rate_limiter_factory"
Built-ins: tool_retry, model_retry, collapse, compaction,
progress_tracker, code_interpreter, model_call_limit,
model_rate_limit, tool_call_limit, token_budget, loop_detection, run_timeout, rubric,
steering, todo_list. Ordering
constraints (e.g. collapse must run before compaction) sort every agent's
own merged project+agent middleware stack at run time; declaration order breaks
ties. abt compile checks every dispatch-time entry agent's merged stack and
fails when constraints contradict each other.
Wrapping an already-implemented middleware class needs no factory function —
wrap_middleware(name, cls, ...) builds one for you (cls(**config) by
default):
from langchain.agents.middleware import PIIMiddleware
from abt.middleware import wrap_middleware
pii_guard = wrap_middleware("pii_guard", PIIMiddleware, valid_keys=frozenset({"pii_type", "strategy"}))
Full working example: response_length_logger_factory in
abt_plugin_examples/middleware.py — logs the
character length of every model response.
abt doctor rules
Built-in rules are plain functions with the signature (resource:
AgentResource, ctx: DoctorRuleContext) -> list[DoctorFinding], registered
with abt.doctor.registry.RuleRegistry.register(); they live in
abt.doctor.static_rules / abt.doctor.extended_rules / abt.doctor.llm_rules
and run once per agent.
Third-party rules are a different, simpler shape — contract:
abt.contracts.protocols.DoctorRule, an instance (not a class) with:
from pathlib import Path
from typing import Any
class DoctorRule:
name: str
description: str
def evaluate(self, *, project_root: Path, config: Any) -> list[Any]: ... # list[DoctorFinding]
Unlike built-in rules, plugin rules run once per project, not once per
agent — they get project_root and the resolved ProjectConfig, not the
compiled manifest. Register the instance itself, not the class (an
undecorated class would pass the accept-check but crash at call time missing
self). Entry-point only — no providers/ discovery for this group:
[project.entry-points."abt.doctor_rules"]
my_rule = "my_pkg.doctor:my_rule_instance"
Full working example: profiles_yaml_gitignored_rule in
abt_plugin_examples/doctor_rules.py —
flags a profiles.yaml that exists but isn't excluded by .gitignore.
MCP tool source loading
MCP servers are configured as JSON files under mcps/ (type must be one of
the built-in transports) — see discover_and_register in
abt.mcps.json_loader. Third-party loaders contribute additional sources
dynamically, alongside those files, via abt.contracts.protocols.MCPLoader,
also an instance (not a class):
from pathlib import Path
from typing import Any
class MCPLoader:
def load(self, *, config: dict[str, Any], project_root: Path) -> Any: ...
# returns an MCPSourceConfig, a dict with matching fields, a list of
# either, or None to contribute nothing
Entry-point only — no providers/ discovery for this group.
[project.entry-points."abt.mcp_loaders"]
my_loader = "my_pkg.mcp:my_loader_instance"
Full working example: env_mcp_loader in
abt_plugin_examples/mcp_loaders.py —
registers a source from an environment variable, no JSON file needed.
abt.external_approvals — out-of-band approval providers
Contract: subclass of abt.infra.approvals.external_approval.BaseExternalApproval
that declares ConfigSchema / OptionsSchema (both pydantic.BaseModel
with extra="forbid") and implements post, fetch_decision, and
update_resolved. request_prompt, poll, mark_resolved, and
_authorize are @final and cannot be overridden — they wrap user methods
with schema validation, ACL enforcement (fail-closed), and best-effort error
handling. Credential fields (*_token / *_key / *_secret / password)
must be declared as pydantic.SecretStr so they are never persisted.
[project.entry-points."abt.external_approvals"]
pagerduty = "my_pkg.approvals:PagerDutyApproval"
Duplicate registrations (two packages claiming the same type) raise
DuplicateProviderError at startup. Full walkthrough, built-in provider
catalog (Slack, Jira), and authorization model: External approvals.
No packaging needed for a single project: put the same class in providers/<name>.py and decorate it with
@external_approval_for("<type>") (from abt.infra.approvals.registry import external_approval_for), then
reference the type from approvals.resources in abt.yaml. The class from the
local_file quick start works this way unchanged.
Full working example (no external service — approve/deny by editing a local
JSON file): LocalFileExternalApproval in
abt_plugin_examples/approvals.py.
Trigger types — abt watch event sources
Trigger types are not an entry-point group: abt watch builds an event source for a triggers/*.yaml
type: in a fixed if/elif chain, build_event_source in src/abt/watch/sources/base.py
(today slack, github, cron and jira). A project cannot add one from providers/; a new type is a change
to abt itself:
- Add
src/abt/watch/sources/<type>.pywith a class that implements theEventSourceprotocol (start(),stop()andstream(), an async iterator ofTriggerEvent). Map the source's own vocabulary ontoTriggerEvent.scope_id,thread_idandevent_id, so dedup, cooldown and{{ event.* }}bindings work the same as for the built-in types. - Add a branch for the type to
build_event_source, importing the class inside the branch, and the type to itsUnknown trigger type ... Supported: ...message. - Document the type's
config:,filter:and credentials namespace in Triggers.
An unknown type: is not caught at compile: abt watch run/produce logs failed to start source for it.
Handlers — lifecycle hooks (on_success, on_failure, ...)
Project-local only, not an entry-point group: drop a Handler subclass in
handlers/ and it's auto-discovered and registered by class name.
# handlers/slack_audit.py
from abt.sdk import Handler
class SlackAuditHandler(Handler):
def __init__(self, *, channel: str) -> None:
self.channel = channel
def run(self, **context) -> None:
context["abt"].log.info("notifying %s", self.channel)
Call it from an agent's frontmatter by class name:
---
description: Reviewer agent.
on_success:
- SlackAuditHandler: { channel: "#example-channel" }
---
Full guide (context payload, timeouts, failure handling, built-in
UploadArtifacts): Handlers.