SDK Reference
Reference for the Band Python SDK.
Installation
Base package
Adapter extras
Extra names are written in their normalised form, which
PEP 685 makes canonical: tools collapse
every run of -, _ and . to a single - and record only that form in
package metadata. The SDK declares several extras with underscores and its
README uses them, so band-sdk[claude_sdk] installs the same extra, because the
comparison is normalised either way. Prefer the hyphens: they are what pip and
uv print back, and PEP 685 warns that unnormalised names may stop working.
Core Agent API
The Agent class is the main entry point for creating and running Band-connected agents.
Agent.create()
Factory method that creates an Agent with platform connectivity.
Agent.create() resolves BAND_WS_URL and BAND_REST_URL itself when the matching argument is omitted or None, so a bare os.getenv("BAND_WS_URL") is safe even with the variable unset. Passing the values explicitly is still correct and takes precedence, which is what the tutorials do. The SDK reads the process environment, not .env, so call load_dotenv() first.
Agent.from_config()
Convenience factory that loads agent_id and api_key from agent_config.yaml instead of taking them as arguments. The adapter is still constructed in Python, so adapter-specific typing is unaffected.
Agent lifecycle methods
Agent properties
Example
Configuration
Logging
Logging is opt-in. Call configure_logging() once at startup.
For an embedded SDK, configure Band logs only:
For an agent, runner, or CLI that owns the process, also raise the level of every other logger:
level applies to the band logger, root_level to every other logger, so an
embedded SDK leaves the host’s logging untouched. configure_logging() applies the
configuration and returns it; build_logging_config() builds the same dictConfig
mapping without applying it. Both take the same parameters, documented in
Environment Variables.
To drive the same configuration from the environment instead of arguments, use
LogSettings, a pydantic-settings model over the BAND_LOG_* variables:
LogSettings().configure() in an embedded SDK, or
LogSettings().for_application().configure() in a process that owns its logs.
configure_logging_from_env() is shorthand for the first. The variables and their
defaults are in
Environment Variables.
The public logging types are LogLevel (an int or a level name), LogStream
(stderr, stdout), LoggingStyle (standard, rich, json), FileStyle
(standard, json), FormatStyle (%, {, $), and LoggingConfig (the
dictConfig mapping). The rich and json styles require band-sdk[logging].
AgentConfig
SessionConfig
ContactEventConfig
Controls how contact requests and updates are processed.
See Contact Management for contact tool behavior, real-time contact events, and full examples of all three strategies.
Configuration files
load_agent_config() reads agent credentials from agent_config.yaml.
Runtime URLs and model provider keys can be set in .env:
Add both agent_config.yaml and .env to your .gitignore.
load_agent_config()
Adapter Reference
Common adapter options
Several adapters expose the same Band integration options. Individual adapter sections below list only their adapter-specific parameters.
The prompt options, custom_section and system_prompt, are fields on the
configuration dataclass for the adapters that take one: Codex
(CodexAdapterConfig), CopilotACP, CopilotSDK, Letta (LettaAdapterConfig), and
Opencode. history_converter, additional_tools, and the **features keywords
stay constructor arguments on those adapters.
The **features keywords are accepted by A2A, A2A gateway, ACPClient, Agno,
Anthropic, ClaudeSDK, Codex, CopilotACP, CopilotSDK, CrewAI, CrewAI Flow, Gemini,
GoogleADK, LangGraph, Letta, Opencode, Parlant, PydanticAI, Slack, and Strands.
BandACPServerAdapter takes none of them.
Adapter features
Adapters take their Band feature settings as direct keyword arguments, typed as
**features: Unpack[FeatureKwargs]. There are five keys, all optional:
Emit and Capability members:
emit and capabilities default differently. Omitting emit resolves to every
kind the adapter declares in SUPPORTED_EMIT, so events are on unless you narrow
them; emit=() is the only way to go silent. Omitting capabilities adds
nothing, because each capability puts extra tool schemas in front of the model on
every turn. Each adapter declares what it accepts in the SUPPORTED_EMIT and
SUPPORTED_CAPABILITIES class attributes. The capabilities argument on the
schema accessors is a separate layer with its own default;
this empty default is the adapter one.
Passing an Emit or Capability member the adapter does not declare raises
BandConfigError at construction, naming the unsupported values and the
supported set. It is not a warning, and the adapter is not built.
The three tool filters narrow the platform tool schemas, in strict precedence:
include_categories, then include_tools, then exclude_tools. Each stage
narrows the result of the previous one, so include_categories=["chat"] together
with include_tools=["band_store_memory"] yields nothing, because
band_store_memory is in the memory category. Unknown names in include_tools
or exclude_tools are logged as a warning and otherwise ignored.
Memory tools are enterprise-only.
Emit.TASK_EVENTS is load-bearing, not just narration, on the Codex, Letta, and OpenCode adapters: each persists its session/thread/agent-resume mapping in task-event metadata gated by that flag. It is in the default emit set for all three, so leaving emit alone is safe. An explicit emit= replaces that default wholesale, so any set you pass must still include Emit.TASK_EVENTS, and emit=() stops resumption across restarts.
What each adapter supports
SUPPORTED_EMIT is also the default emit, so this table doubles as what the
adapter reports when you pass no emit at all. An adapter with an empty emit set
emits nothing and rejects every emit value, including Emit.TOOL_CALLS; there
is no flag that turns events on for those.
ClaudeSDKAdapter is the only adapter that declares Capability.FILES.
BandACPServerAdapter is in the table for completeness. It takes no **features
keywords at all, so there is nothing to narrow. SlackAdapter declares neither
set of its own, but it is not inert: it adopts and validates against the inner
adapter’s resolved features, so read its row off the brain you wrap. Every other
adapter with an empty SUPPORTED_EMIT rejects any emit value outright.
Adapter summary
LangGraphAdapter
Adapter for LangGraph-based agents with ReAct pattern.
Provide either llm for the simple pattern or graph_factory / graph for the advanced pattern.
Supports Emit.TOOL_CALLS and Emit.USAGE, plus Capability.MEMORY and Capability.CONTACTS.
See Common adapter options for custom_section, additional_tools, history_converter, and Adapter features for emit and capabilities.
AnthropicAdapter
Adapter for direct Anthropic SDK usage with a manual tool loop.
See Common adapter options for system_prompt, history_converter, and additional_tools, and Adapter features for emit and capabilities. This adapter supports Emit.TOOL_CALLS and Emit.USAGE, and both Capability.MEMORY and Capability.CONTACTS. Passing Emit.THOUGHTS or Emit.TASK_EVENTS raises BandConfigError.
anthropic_api_key, api_key, and custom_section are deprecated on this adapter; use provider_key and prompt. Each raises a DeprecationWarning, and passing a deprecated name together with its replacement raises BandConfigError.
PydanticAIAdapter
Adapter for Pydantic AI agents with type-safe tools.
Supports Emit.TOOL_CALLS and Emit.USAGE, plus Capability.MEMORY and Capability.CONTACTS.
See Common adapter options for system_prompt, custom_section, history_converter, and additional_tools, and Adapter features for emit and capabilities.
ClaudeSDKAdapter
Adapter for Claude Agent SDK with MCP server support.
Supports Emit.TOOL_CALLS, Emit.THOUGHTS and Emit.USAGE, so Emit.TASK_EVENTS raises BandConfigError. Supports Capability.MEMORY, Capability.CONTACTS, and Capability.FILES.
This is the only adapter wired to the room file tools, band_list_room_files, band_read_room_file, and band_send_room_file. They reach the model through capabilities={Capability.FILES}, and naming that capability on any other adapter raises BandConfigError at construction. See Room Files for the opt-in and the tool arguments.
See Common adapter options for custom_section, history_converter, and additional_tools, and Adapter features for emit and capabilities.
A2AAdapter
Adapter for connecting to remote A2A-compliant agents.
This adapter declares no supported event kinds and no capabilities, so it accepts only the tool filters; see Adapter features for emit and capabilities.
A2AGatewayAdapter
Adapter that exposes Band peers as A2A HTTP endpoints.
api_key and rest_url are not constructor parameters; passing either raises TypeError. The adapter builds its REST client at startup from the PlatformConnection the runtime injects, so the credentials given to Agent.create() are not repeated here.
This adapter declares no supported event kinds and no capabilities, so it accepts only the tool filters; see Adapter features for emit and capabilities. See A2AGatewayAdapterConfig for key configuration fields.
CrewAIAdapter
Adapter for CrewAI-based agents with role, goal, and backstory definitions.
Supports Emit.TOOL_CALLS only, so Emit.THOUGHTS, Emit.TASK_EVENTS and Emit.USAGE raise BandConfigError. Supports Capability.MEMORY and Capability.CONTACTS.
See Common adapter options for custom_section, history_converter, and additional_tools, and Adapter features for emit and capabilities.
CodexAdapter
Adapter for OpenAI Codex CLI integration via JSON-RPC.
client_factory replaces the default transport client, which is what the SDK’s own tests substitute; leave it unset for the stdio or WebSocket client the config selects.
Supports all four Emit kinds, plus Capability.MEMORY and Capability.CONTACTS.
See Common adapter options for additional_tools and history_converter, and Adapter features for emit and capabilities. See CodexAdapterConfig for key configuration fields.
LettaAdapter
Adapter for Letta agents with persistent memory.
Operating modes:
per_room(default): Each room gets its own Letta agent with isolated memory.shared: One Letta agent shared across all rooms, with per-room isolation via the Conversations API.
See Common adapter options for the custom_section option inside LettaAdapterConfig, and Adapter features for emit and capabilities. This adapter supports Emit.TOOL_CALLS, Emit.TASK_EVENTS, and Emit.USAGE, plus Capability.MEMORY and Capability.CONTACTS. See LettaAdapterConfig for key configuration fields.
Emit.TASK_EVENTS is load-bearing for LettaAdapter: the room’s Letta agent_id is persisted in task-event metadata and read back to resume the server-side agent. Narrowing emit to exclude it stops resumption, so every restart creates a fresh Letta agent instead of reattaching.
ParlantAdapter
Adapter for Parlant behavioral engine integration. Unlike the other adapters, ParlantAdapter owns the Parlant server lifecycle by default: it reserves ports and boots p.Server when the Band agent starts, and tears it down when the agent stops.
Declare guidelines before startup with adapter.add_guideline(condition=..., action=..., tools=...), which mirrors parlant.sdk.Agent.create_guideline and attaches Band’s platform tools by default. Calling it after the agent starts raises RuntimeError; use configure= for a running agent. Four argument combinations raise ValueError: parlant_agent without server, nlp_service or server_options with server, system_prompt or custom_section with parlant_agent, and a non-positive response_timeout or response_poll.
See Common adapter options for system_prompt, custom_section, and history_converter, and Adapter features for emit and capabilities. This adapter declares no supported event kinds, so passing emit raises BandConfigError. It declares Capability.MEMORY and Capability.CONTACTS, but only CONTACTS changes the Parlant tool surface: there are no memory tools on it, and the three tool filters are accepted and ignored. It takes no additional_tools.
SlackAdapter
Wraps an inner framework adapter (the brain) and bridges it into Slack. See the Slack Adapter tutorial for setup.
SlackAdapter mirrors Slack messages into Band rooms through its own REST client, which it builds from the PlatformConnection the runtime injects from the credentials you pass to Agent.create(). It takes no rest_url or api_key of its own.
Feature keywords work differently on this bridge. It declares no emitted events or capabilities of its own, so omit them all and it adopts the inner adapter’s resolved features verbatim, letting the brain’s events and capabilities flow through unchanged. Pass one and it merges over the inner adapter’s features field by field, writing the result onto the inner adapter, and validates against the brain’s supported sets rather than the bridge’s own empty ones. See Adapter features for what each brain accepts.
Adapter configuration objects
A2AGatewayAdapterConfig
CodexAdapterConfig
CodexAdapterConfig has 30+ fields for fine-grained control. Every field can be set explicitly (highest priority) or via a CODEX_-prefixed environment variable (e.g. CODEX_MODEL, CODEX_TRANSPORT, CODEX_APPROVAL_MODE); an explicit constructor kwarg always wins. The table below lists the most commonly used parameters.
See the SDK source for the full list, including approval modes, task event options, and timeout settings.
LettaAdapterConfig
Every field can be set explicitly (highest priority) or via a LETTA_-prefixed environment variable (e.g. LETTA_BASE_URL, LETTA_MODEL); provider_key additionally reads LETTA_API_KEY. Unknown field names are rejected at construction. The table below lists the most commonly used fields; the tutorial has the full set.
api_key, mcp_server_url, and mcp_server_name are deprecated aliases that emit DeprecationWarning. Use provider_key and mcp=LettaMCPConfig(...).
SlackApp
Configuration for one Slack app served by SlackAdapter. Required token combination depends on the adapter’s transport; passing the wrong combination raises ValueError at construction.
ACP integration
BandACPServerAdapter
Platform bridge for editor-facing ACP integrations.
Import BandACPServerAdapter from band.adapters. The PyPI package is band-sdk; the import module is band.
api_key and rest_url are not constructor parameters; passing either raises TypeError. The adapter builds its REST client at startup from the PlatformConnection the runtime injects, so the credentials given to Agent.create() are not repeated here. This is also the one adapter that takes no **features keywords at all.
ACPServer
ACP protocol handler used with BandACPServerAdapter.
ACPServer implements twelve ACP request methods: initialize, authenticate, new_session, load_session, resume_session, fork_session, list_sessions, close_session, prompt, cancel, set_session_mode, and set_config_option. It also exposes ext_method and ext_notification for ACP extension traffic. It does not subclass acp.Agent: the ACP router resolves handlers by name, so every handler is keyword-only.
ACPClientAdapter
Adapter for bridging Band rooms to an external ACP agent process.
command (stdio) and host plus port (TCP) are mutually exclusive, and exactly
one of them is required. Passing both, neither, or only one half of the TCP pair
raises ValueError at construction.
The rest_url constructor parameter was dead (assigned and validated, never consumed) and has been removed.
See Adapter features for emit and capabilities. This adapter declares no supported event kinds, so passing emit raises BandConfigError; it supports Capability.MEMORY and Capability.CONTACTS. Its room narration of text, thoughts, tool calls and plans follows the ACP session-update stream and is not gated by emit.
Platform Tools
AgentToolsProtocol
Platform tools available to adapters, typed as AgentToolsProtocol and implemented by band.runtime.tools.AgentTools. These tools are pre-bound to the current room unless noted otherwise.
Contact tool return shapes and contact event workflows are covered in Contact Management.
Memory tools are enterprise-only, and the room file tools reach only ClaudeSDKAdapter. Name a group in capabilities to put it in front of the model, and include Capability.CONTACTS in the same set when you still want the contact tools, because the set you pass replaces the default rather than adding to it.
The three schema accessors take one keyword-only argument:
capabilities selects which optional tool groups join the base chat tools.
None, the default, means contacts only, so a bare get_anthropic_tool_schemas()
returns the base tools plus the contact tools. An explicit set replaces that
default rather than adding to it: capabilities={Capability.MEMORY} returns the
base tools plus the memory tools and drops the contact tools, and
capabilities=frozenset() returns the base tools alone. Pass
{Capability.MEMORY, Capability.CONTACTS} to keep both. Tools bound to the hub
room always include the contact tools, whatever you pass. This contacts-only
default belongs to the accessors alone: the adapter-level capabilities keyword
in Adapter features defaults to empty instead.
Before 3.0.0 these accessors took include_memory: bool = False and
include_contacts: bool = True instead of capabilities. Both were removed,
with no back-compat shim and no deprecation period, so a 2.x call site does not
degrade quietly: passing either raises TypeError naming it as an unexpected
keyword argument.
Because include_contacts defaulted to True, the exact equivalent of
include_memory=True is capabilities={Capability.MEMORY, Capability.CONTACTS}.
Translating it to {Capability.MEMORY} alone silently drops the contact tools.
ContactTools
ContactTools exposes the contact-management subset of AgentToolsProtocol for ContactEventStrategy.CALLBACK. It is agent-scoped, not room-bound, and uses method names without the band_ prefix.
See the CALLBACK strategy example for ContactTools usage.
Types
PlatformMessage
Immutable message from the platform.
AgentInput
Bundle of everything an adapter needs to process a message.
HistoryProvider
Lazy history conversion wrapper.
PlatformConnection
Band platform coordinates, injected into adapter.platform before on_started()
fires. Import it from band.core.types; it is not re-exported at the band top
level.
The bridge adapters, A2AGatewayAdapter, SlackAdapter, and
BandACPServerAdapter, read their credentials from here instead of taking
api_key and rest_url constructor parameters for values already given to
Agent.create().
A SimpleAdapter subclass that needs its own platform access uses two helpers.
require_platform() returns the injected PlatformConnection, and raises
RuntimeError when the agent has not started yet. build_rest_client() returns
an AsyncRestClient built from that connection’s rest_url and api_key. Call
them from on_started() or on first use, and cache the client.