Tools
Tools are Python functions the model can call. In abt they are discovered automatically from your project’s tools/ directory—no manual registry list in library code.
1. Write a tool
Import tool from abt and use its @tool decorator so the object is a BaseTool:
# tools/weather.py
from abt import tool
@tool
def get_weather(city: str) -> str:
"""Return a short weather summary for the city."""
return f"It is sunny in {city}."
2. List it on the agent
In an agent markdown file under agents/**/*.md frontmatter:
tools:
- get_weather
The string must match the tool’s name (for @tool, that is the function name by default). abt compile and abt doctor fail on a name that matches no tool (E_UNKNOWN_TOOL_REF, naming the agent, with a "Did you mean" hint).
Built-in filesystem tools
Agents that declare subagents: also get read_file, ls and glob without listing them under tools:, which is why a run summary can show Tools used: read_file for an agent whose tools: only names word_count. On a vague prompt such an agent may browse the workspace and spend extra tokens. Set expose_fs_tools: false in its frontmatter to hide them (see expose_fs_tools).
No agent gets a shell tool: abt's workspace backends cannot run commands, so deepagents' execute is never offered. For repository history, use the git__git_log tool from abt-git-tools (see git-tools).
How discovery works
For each *.py file in the configured tools directory (see abt.yaml → paths.tools):
- Files whose names start with
_are skipped. - The module is loaded; every top-level attribute that is a
BaseToolinstance is registered by its.name.
Compile imports the tool modules once and records each tool in manifest.tools (name, description, argument schema, and the module that exposes it). At run time abt imports only the modules behind the tools an agent lists.
Plain functions are not registered—only @tool tools (LangChain BaseTool objects).
A module that fails to import (a missing dependency, a syntax error) is skipped with a warning in abt.log and recorded in manifest.tool_import_errors. Agents that never use its tools are unaffected. An agent that lists a tool the failed module declares fails when it is built, and the error carries the import failure. abt reads the declared names from the module source, since the import did not complete; when it cannot (the file does not parse), any missing tool is attributed to the failure:
ERROR: Agent 'bad-agent' lists tool 'broken_tool', which is not loaded: a tool module failed to import.
Failed to import tool module 'tools/broken_tool.py'. ... Original error: No module named 'module_that_does_not_exist'
Build tools programmatically
@tool fits one function with one implementation. When it does not, build the tool with StructuredTool.from_function, which @tool calls underneath. Discovery registers every tool object a module exposes under a module-level name.
Several similar tools come from one factory function:
# tools/lookup.py
from pydantic import BaseModel
from abt import StructuredTool
class LookupArgs(BaseModel):
key: str
def make_lookup(source: str) -> StructuredTool:
def lookup(key: str) -> str:
return f"{source}:{key}"
return StructuredTool.from_function(
func=lookup,
name=f"lookup_{source}",
description=f"Look up a key in {source}.",
args_schema=LookupArgs,
)
lookup_alpha = make_lookup("alpha")
lookup_beta = make_lookup("beta")
List them under tools: by name, as with @tool: lookup_alpha and lookup_beta.
A tool with both a sync and an async implementation passes both:
# tools/fetch.py
from abt import StructuredTool
def fetch(url: str) -> str:
...
async def afetch(url: str) -> str:
...
fetch_tool = StructuredTool.from_function(func=fetch, coroutine=afetch, name="fetch", description="Fetch a URL.")
Use project config and credentials
Non-secret settings belong in abt.yaml under config: and are read with get_project_config(). config: is validated strictly: it accepts only the keys in Configuration — config, and a custom key such as config.my_bucket fails abt compile with unknown key.
The confluence block holds the default space:
# abt.yaml
config:
confluence:
space: DOCS
A tool reads it as a flat attribute of the object get_project_config() returns (confluence_space):
from abt import tool
from abt.runtime_context import get_project_config
@tool
def fetch_page(title: str) -> str:
"""Fetch a Confluence page from the configured space."""
space = get_project_config().confluence_space
...
Secrets and tokens belong in profiles.yaml under credentials.<namespace> and are read with get_profile().get_credentials(...):
from abt import tool
from abt.runtime_context import get_profile, get_project_config
@tool
def search_docs(query: str) -> dict:
"""Example pattern: space from project, credentials from profile."""
space = get_project_config().confluence_space
creds = get_profile().get_credentials("atlassian")
url = creds.get("url", "")
token = creds.get("api_token", "")
...
Do not hardcode API keys in tool source. Keep them in profiles.yaml and read them through the credentials accessor shown above.
Isolated tools
Most tools can use the libraries in your project's main dependencies. For a package that is rare, conflicts with abt's own dependencies, or only one tool needs, use @isolated_tool in place of @tool, and abt runs that tool in its own virtualenv:
# tools/sizes.py
from abt import isolated_tool
@isolated_tool(requires=["humanize>=4"])
def file_size(num_bytes: int) -> str:
"""Format a byte count as a human-readable size."""
import humanize # imported inside: abt's own environment does not have it
return humanize.naturalsize(num_bytes)
List file_size under tools: as usual and run the agent with abt run -s <agent>.
@isolated_tool requires uv on PATH (pip install uv or brew install uv). abt has no venv/pip fallback: without uv, an agent that lists an @isolated_tool tool stops before any model call and says so. uv builds the environment on the tool's first call in a run and deletes it when the run ends (the agents of one workflow share it until the command finishes), so every call sees the same versions. That first call pays for the build: seconds for small packages, minutes for heavy ones, with no progress shown. Each build step (uv venv, uv pip install) is stopped after 15 minutes and fails the call with an error that names the step, so a stalled package index cannot hold a worker for good. Each later call starts a fresh process that imports the package, so keep these tools light. Pin versions (==) when you need repeatable runs.
| Option | Meaning |
|---|---|
requires |
PEP 508 requirements (required): PyPI names, or GitHub pins name @ git+https://github.com/org/repo.git@<tag-or-commit>. |
python |
major.minor of the interpreter. Default: the one abt runs on. |
env |
Host environment variables the tool may read. |
credentials |
credentials.<namespace> blocks the tool may read with isolated_tool.credentials("<namespace>"). |
name_or_callable, description, args_schema, return_direct, parse_docstring, … |
Passed to LangChain's tool unchanged, so @isolated_tool takes the same options as @tool. |
- Import inside the function. A top-level import fails when abt loads the module, because the package is not installed in abt's own environment.
- GitHub packages. Pin a tag or commit after
@(a branch moves). Add#subdirectory=pathfor a monorepo. Private repos usegit+ssh://git@github.com/...with your ssh agent or git credential helper; a token in the URL is rejected, since requirements are written tomanifest.json. - Arguments and results are JSON. Dates, enums and models are rebuilt inside; a result comes back as plain data.
- When it fails. A package that cannot be installed fails only that tool call, with uv's message (also in the run log); the run goes on. That includes a requirement that conflicts with the
langchain-coreabt adds to every environment, such aspydantic<2.abt compilerejects (E_ISOLATED_TOOL) tools that cannot run out of process:ToolRuntime,config, callbacks and injected arguments,*args/**kwargs,content_and_artifact, a package's__init__.py, Windows. Inside,get_profile()andget_project_config()are unavailable; useenvandcredentials. - Not a sandbox. Same user, filesystem and network; only the packages differ. The tool's
os.environholds just the variables it declares plus a fixed set:PATH,HOME, locale and timezone,TMPDIR, XDG directories, and proxy and TLS settings. - Private indexes and proxies are configured with uv's own settings (
UV_DEFAULT_INDEX,UV_INDEX).
Retry safety
tool_retry re-runs a failed tool call only when repeating it cannot act twice.
A tool you write is treated as a write: after a timeout or a dropped connection the call fails once
instead of being retried. If your tool only reads, or repeating it is harmless, declare it:
from abt import tool
@tool
def fetch_logs(dag_id: str) -> str:
"""Fetch Airflow logs."""
...
fetch_logs.metadata = {"idempotent": True}
Only set it when a second call with the same arguments has no additional effect. Connection-refused, DNS and connect-timeout failures are retried for every tool, since the request never left.
Best practices
- Write a clear docstring—the model uses it to choose when to call the tool.
- Prefer typed arguments and stable return types (string or
dict). - Keep each tool focused on one task.
Sharing tools across projects — packages
For tools that multiple projects need, use abt packages instead of copy-pasting tool files:
# abt_packages.yml
packages:
- git: https://github.com/getyourguide/abt-core.git
revision: main
subdirectory: packages/abt-git-tools
abt deps # installs to .abt_packages/
abt deps clones each git: source with your local git, so the machine that runs it needs network access and read access to that repository. A repository you cannot clone fails with git clone ... exited with 128 and remote: Repository not found. A local: source links a folder on disk instead.
Tools from installed packages are auto-discovered alongside your project's own tools/. See Packages for the full guide to installing and authoring packages.
Package tool specs (shorthand)
Installed packages declare a shorthand in abt_package.yaml (for example git, databricks, atlassian, slack). Reference them with the same source__tool grammar as MCP:
tools:
- git__git_clone
- git__git_log
- gh__gh_run_view
Package wildcards (git__*, databricks__*, …) expand to all enabled tools in that package. Write tools are included only when effective allow_writes is true for their component; blocked writes are silently omitted from wildcards. An explicit write spec (git__git_push) that is blocked fails abt compile (lists write package tool spec(s) blocked by config.packages: git__git_push).
The shorthand is also the required profiles.yaml credentials namespace. A scoped -s/selector compile, an abt run, or an abt dispatch requires credentials.<shorthand> for every package-shorthand tool the selected/dispatched agent uses — git__*/gh__* tools need credentials.git/credentials.gh specifically, not a semantic alias like credentials.github, even if that alias holds the same token. A missing namespace fails with E_PROFILE_MISSING_NAMESPACE.
List an installed package's tools with abt docs package <shorthand>. The package must be installed first (abt deps); otherwise it fails with ERROR: Unknown package shorthand 'databricks'. Installed: (none):
abt docs package git --project-root .
abt config show --agent my-agent --project-root . prints that agent's guardrails (timeouts, call and token limits, recursion limit). It does not list tools.
Full grammar and precedence: Packages — tool spec syntax and Configuration — config.packages.
First-party packages:
- abt-git-tools — local git tools (
git__*) - abt-gh-tools — GitHub CLI tools (
gh__*) - abt-atlassian-tools — Jira and Confluence search and read tools plus gated Jira write tools (Atlassian MCP replacement, SDK-backed)
- abt-slack-tools —
slack_search,slack_thread_view,slack_channel_historyandslack_post_message(write, gated) - abt-databricks-tools — Databricks cluster, job, run output, warehouse, query history, and notebook tools (SDK-backed)
See also
- Packages — installing and authoring reusable tool packages
- git-tools — local git tools reference
- gh-tools — GitHub CLI tools reference
- atlassian-tools — Jira and Confluence tools reference
- slack-tools —
slack_search,slack_thread_view,slack_channel_historyandslack_post_messagereference - databricks-tools — Databricks discovery tools reference
- Configuration —
ProjectConfigfields andprofiles.yamllayout