Skip to content

Inline profiles (Python SDK)

You can pass a profile directly from Python instead of relying on a profiles.yaml file on disk. This is useful for tests, CI, embedded tools, or hosts where writing a profile file is awkward.

What to pass

A dict with the same shape as a single outputs.<target> block in profiles.yaml: model_id with a provider prefix such as openai: / anthropic: / bedrock_converse:, plus region, temperature, max_tokens, credentials, env, and so on. There is no type key; the provider comes from the model_id prefix. The dict goes through the same credential resolution as file-backed profiles, so {{ env_var(...) }} calls behave the same way (see Configuration).

  • publish_profile_env=False (on AgentBuildTool, or the publish_profile_env= flag of the abt.sdk functions) keeps the profile's env: map out of os.environ.

When profile is set, profiles_dir / target / on-disk discovery are ignored for loading the active target.

Entry points

API Parameter
abt.AbtRunner Constructor and ainvoke / invoke kwargs (profile=...) — covers list/doctor and everything else without a dedicated abt.sdk wrapper
abt.AgentBuildTool profile=...
abt.sdk.compile profile=...
abt.sdk.run profile=...
abt.sdk.dispatch profile=...
abt.sdk.test profile=...
abt.sdk.discover profile=...
abt.sdk.route profile=...

The interactive abt CLI does not add flags for inline profiles; use the Python APIs above.

Examples

import os

from abt import AbtRunner

runner = AbtRunner(
    project_root="./my_project",
    profile={
        "model_id": "openai:gpt-4.1",
        "temperature": 0.2,
        "max_tokens": 10000,
        "credentials": {"slack": {"bot_token": os.environ["SLACK_BOT_TOKEN"]}},
        "env": {"OPENAI_API_KEY": os.environ["OPENAI_API_KEY"]},
    },
)
result = runner.invoke(["run", "-s", "my-agent", "-p", "my-prompt"])

Build a tool from a compiled manifest without writing the profile's env: to os.environ:

from abt import AbtRunner, AgentBuildTool

profile = {"model_id": "openai:gpt-4.1", "temperature": 0.2, "max_tokens": 10000}
manifest = AbtRunner(project_root=".", profile=profile).invoke(["compile"]).result
tool = AgentBuildTool(
    project_root=".",
    manifest=manifest,
    profile=profile,
    publish_profile_env=False,
)

Testing inline profiles

To verify your inline profile works without a profiles.yaml on disk, pass profile= with a dict matching the outputs.<target> shape:

from abt import AbtRunner

runner = AbtRunner(
    project_root="./my_project",
    profile={"model_id": "bedrock_converse:eu.anthropic.claude-haiku-5-5"},
)
result = runner.invoke(["compile"])
assert result.success

Contributors run the integration tests for this path with ABT_INTEGRATION_TESTS=1 uv run pytest tests/integration -m integration. See Contributing.

See also