Skip to navigation

Python SDK 6.0.1

Fixed

  • Python SDK:
    • Agents Staying Offline After a Clean WebSocket Close — A live agent now reconnects and catches up on its rooms after the platform closes its connection normally, instead of staying offline until restarted. An agent superseded by a newer session with the same key still stops for good.

Security

  • Python SDK:
    • WebSocket Credential Exposure — Connection diagnostics and retained error details no longer expose credentials after a connection attempt.

Python SDK 6.0.0

Added

  • Python SDK:
    • Shared Resource Cleanup — Register async callbacks with adapter.add_cleanup(client.aclose) before startup. The Agent or OneShotInvoker that runs the adapter calls them in reverse registration order when it stops, after in-progress turns and framework teardown have finished. If a callback fails, stopping again retries only the failed callbacks; callbacks that already succeeded do not run again.
    • Shared-Tool Examples — Runnable examples demonstrate a shared HTTP client, a persistent SQLite connection, and a temporary draft workspace with cleanup run by the agent. After registered resources have been disposed, create fresh resources and a new adapter and agent. Resources shared across adapters stay your application’s to close.
    • Stopped-Room Polling — Set SessionConfig.stopped_resync_seconds or STOPPED_RESYNC_SECONDS to reduce polling for paused rooms without slowing active rooms. Unset uses the base interval; longer values can delay discovery of a missed resume by that interval.
    • Turn Wind-Down Timeout — Claude SDK and ACP adapters, including OMP (oh-my-pi), Cursor, and Copilot ACP, expose turn_settle_timeout_s, how long a room’s unfinished turn has to wind down before it is cancelled when the agent leaves the room or shuts down.

Python SDK: Runtime Types Removed, SessionConfig and Extras Reworked

Python SDK 6.0.0 removes band.runtime.types, converts SessionConfig to Pydantic settings, splits framework extras across incompatible OpenAI major versions, changes NOOA custom-tool calls, and moves the Docker Sandbox kit to the v3 workload format.

What This Means

  • New applications: Use the current adapter examples. Install pydantic-ai separately from crewai, strands, and nooa, whose OpenAI requirements do not overlap.
  • Existing applications: Update band.runtime.types imports, SessionConfig usage, adapter dependency pins, and NOOA custom-tool calls. Applications that call native adapter internals directly must also update their cleanup and session-manager calls.
  • MCP and platform-tool users: Built-in Band tool arguments are unchanged. The NOOA arguments wrapper applies only to portable custom tools, not to platform tools or their MCP schemas.

Migration

Runtime imports. band.runtime.types is removed, with no compatibility aliases. Import each symbol from its owning module:

Symbol formerly in band.runtime.typesNew owning module
AgentConfigband.runtime.agentconfig
SessionConfig, PLATFORM_WORKING_STATE_TTL_SECONDSband.runtime.sessionconfig
PlatformMessageband.runtime.messages
ConversationContextband.runtime.context
ContactEventConfig, ContactEventStrategyband.runtime.contacts
MessageHandler, ContactEventCallback, ParticipantAddedCallback, ParticipantRemovedCallbackband.runtime.callbacks
normalize_handleband.runtime.handles

Existing intentional exports such as from band.runtime import SessionConfig remain available.

Session settings and native-adapter timing.

BeforeAfter
Positional field values, such as SessionConfig(False)Pass field values by name, such as SessionConfig(enable_context_cache=False). A positional argument sets an internal pydantic-settings option, not a field, and can make environment lookups case-sensitive. Always pass fields by keyword
dataclasses.asdict(config) / dataclasses.replace(config, ...)config.model_dump() / construct a new SessionConfig with the desired values
Session defaults supplied only by codeAll session fields also read case-insensitive, same-name environment variables; explicit keywords take precedence and empty environment values are ignored
Negative CodexAdapterConfig.turn_settle_timeout_s acceptedNon-negative values required; 0 requests immediate cancellation on room leave/shutdown
Generic 10-second default for native retention.transition_timeout_sACP defaults to 30 seconds; Codex and Claude SDK default to 60 seconds

Audit environment variables such as IDLE_RESYNC_SECONDS before upgrading: they can now affect SessionConfig() without a code change. Invalid values for known fields fail at construction with Pydantic validation errors. Misspelled keyword names are silently ignored, so verify every field name. SessionConfig(True) can ignore IDLE_RESYNC_SECONDS. turn_settle_timeout_s, the time an unfinished turn gets to wind down on room leave or shutdown, still defaults to 10 seconds. retention.transition_timeout_s separately limits how long a caller waits for a room’s startup or cleanup to report its result; an unfinished one keeps running.

Framework dependencies. Update direct pins and regenerate your application’s lock file.

Extra5.1.0 requirements6.0.0 requirements
pydantic-aipydantic-ai-slim[anthropic]>=2.18.0; OpenAI >=2.0.0pydantic-ai-slim[anthropic,openai]>=2.55.0; OpenAI >=3.26.0,<4
crewaiCrewAI ==1.15.22; OpenAI >=2.0.0CrewAI ==1.15.27; OpenAI >=2.0.0,<3
strandsstrands-agents[openai]>=1.40,<2strands-agents[openai]>=1.50.1,<2; OpenAI >=2.0.0,<3
nooaNOOA >=0.0.10,<0.1 on supported platformsSame NOOA range; OpenAI >=2.0.0,<3 on those platforms
langgraph, a2a_gateway_demolangchain-openai>=0.3.0langchain-openai>=1.5.0

Run Pydantic AI separately from CrewAI, Strands, and NOOA/LiteLLM because their OpenAI requirements do not overlap. Agents in separate processes can still collaborate in the same Band rooms. LangGraph accepts either OpenAI major, including OpenAI 2 when installed with Strands. NOOA’s platform support is unchanged: Python 3.12–3.13 on Linux and macOS, not Windows.

NOOA custom tools. Portable custom-tool calls now take one keyword-only arguments dictionary. The old signature is not supported.

BeforeAfter
await self.room.lookup(order_id="A1")await self.room.lookup(arguments={"order_id": "A1"}) for an alias-free model
Direct field kwargs for a no-input custom toolarguments={}
The SDK rebuilt arguments from the input model’s field namesPass the original input exactly as the model defines it, including alias names and nested AliasPath structures
room_call("lookup", payload) in custom-tool test scriptscustom_room_call("lookup", payload) from band.testing.nooa
Custom tool_call.args derived from field kwargsargs contains the original payload, without an extra arguments envelope

For order_id = Field(validation_alias="orderId"), pass arguments={"orderId": "A1"}. Input models, validators, handlers, and additional_tools=[(InputModel, handler)] registration remain unchanged. Built-in calls such as self.room.band_send_message(content=..., mentions=...) keep their named arguments. Update handwritten NOOA scripts, prompts, and test helpers.

Direct native integrations. Ordinary adapter users do not need to manage these internals. Applications calling them directly must follow the new per-room lifecycle contract:

BeforeAfter
ACP cleanup_all(final=True/False)cleanup_all(); restart the Agent (or runtime) that owns the adapter before it accepts new messages
ClaudeSessionManager.start()Session startup occurs inside async with manager.room(room_id).using()
get_or_create_session(room_id, resume_session_id=...)Get the room’s ClaudeRoomSession with manager.room(room_id). To continue a persisted conversation, call session.adopt(session_id) before the room’s CLI starts; it has no effect once a CLI is live. Adoption is best-effort on the initial start: if Claude refuses the saved session, the SDK logs a warning, starts a new conversation, and clears session_id. Strict resumes of a retained session fail instead. Run the turn inside async with session.using() as client: (async), and read output inside with session.listening() as stream: (sync, nested inside using()). session.session_id shows the conversation the next CLI process resumes
Manager invalidate_session(room_id)session.recover("reason", forget_session=True) on the room’s ClaudeRoomSession; the next process starts a new Claude conversation. Omit forget_session to resume the same session
cleanup_session(room_id, release_workspace=...)cleanup_session(room_id) performs final room cleanup and releases its workspace
Manager cleanup_all()stop(); a stopped manager is final, so create a new manager to restart
can_use_tool_factory(room_id)can_use_tool_factory(room_session, generation)

Docker Sandbox workloads. The SDK’s Docker Sandbox tooling now targets workload format v3 for the Docker Sandboxes CLI (sbx). Use either published 6.0.0 workload:

  • docker.io/bandhq/band-python-kit:6.0.0
  • ghcr.io/band-ai/band-python-kit:6.0.0
BeforeAfter
Separate v2 kit and -image / /image artifactsOne v3 workload image per registry; existing immutable v2 tags are unchanged
Direct sbx create --name NAME --kit REF band-python-kit WORKSPACEsbx create --name NAME WORKLOAD_REF WORKSPACE; the 6.0.0 support baseline is sbx 0.47.0
Older global/positional secret setupProvision sandbox-scoped secrets before creation with sbx secret set-custom --sandbox NAME ...
Band provisioning --kit REFOption name preserved; supply a v3 workload reference
Customer band.yaml with schemaVersion: "1"Unchanged; do not change the application manifest to schema 3

For custom kit descriptors and build pipelines, follow the v3 build and release guide. Removing/recreating a sandbox deletes its scoped secrets: preserve access to credentials, restore bindings, and reapply network grants. Workspace-only edits can use stop/start instead.

Changed

  • Python SDK:
    • Room Startup and Cleanup Isolation — Slow startup or cleanup in one Codex, Claude SDK, or ACP room no longer holds up unrelated rooms. If a room’s cleanup does not finish, the SDK keeps that room’s old session and does not start a replacement for it until cleanup completes or is retried. Codex process recovery resumes the same thread and fails the turn if resume is refused rather than silently discarding private context. Automatic idle suspension is not enabled.
    • Breaking: SessionConfig Is Now Pydantic Settings — Pass fields by keyword, replace dataclasses.asdict and replace with model_dump() and a new SessionConfig, and audit same-name environment variables such as IDLE_RESYNC_SECONDS, which now apply to SessionConfig(). Negative turn_settle_timeout_s is rejected. See Migration.
    • Breaking: Pydantic AI Extra Cannot Share an Environment — The pydantic-ai extra now needs OpenAI 3 and cannot co-install with crewai, strands or nooa. Run it separately and update your pins; see Migration.
    • Breaking: NOOA Custom Tools Take arguments — Portable custom-tool calls pass one keyword-only arguments dictionary. See Migration.
    • Breaking: Native Adapter Lifecycle Calls Changed — Applications that call ACP or ClaudeSessionManager lifecycle methods directly must use the per-room contract in Migration.
    • Breaking: Docker Sandbox Kit Uses Workload Format v3 — Create sandboxes from the published v3 workload with sbx 0.47.0. See Migration.

Removed

  • Python SDK:
    • band.runtime.types Module — The module is removed with no compatibility aliases. Import each symbol from the module that owns it; the Migration section lists every new location.
    • Claude Session Manager Methods — ClaudeSessionManager.start(), get_or_create_session(), invalidate_session() and cleanup_all(), the release_workspace argument of cleanup_session(), and ACP cleanup_all(final=...) are removed. Applications that call them directly follow the Direct native integrations table in Migration.

Fixed

  • Python SDK:
    • Stopped-Room Responsiveness — Stopping an agent while it handles a contact event no longer freezes the agent. Before, a stopped contact-hub room spun in a loop and froze every room. A stop that arrives while a contact-hub turn is starting is no longer lost, and queued messages are replayed in the order received when the room is resumed.
    • Backend Cancellation — STOP, INTERRUPT, and cancelled turns now ask the backend (such as the ACP agent, Codex or Claude) to cancel the work it is already doing, and the next turn waits for that cancellation to finish before it starts. This covers native adapters and remote adapters; Parlant also stops session processing and preamble generation. This does not guarantee termination of an unreachable remote backend, and it does not cover a stop that arrives before the backend has started the work. For example, an A2A task without streaming cannot be cancelled before its first event.
    • Shutdown Ordering — CrewAI native workers and Flow branches, ACP prompt children, A2A gateway executors, and Slack ingress handlers finish their in-flight work before the shared resources they use are closed.
    • Pydantic AI Turn Recovery — A turn that already completed through tools no longer fails only because Pydantic AI exhausts its output retry budget. The adapter preserves the turn history and the original retry diagnostic.
    • Terminal Declines — Successful band_no_reply calls end Anthropic and Strands turns without another model call. SDK-owned LangGraph loops and Pydantic AI completion hooks also avoid redundant requests after successful decline batches; failed tool batches still permit recovery. Caller-owned LangGraph routing is unchanged.
    • Strands Tool Calls and Follow-Up History — OpenAI-backed Strands examples use the Responses provider so supported function tools can execute, and follow-up turns preserve valid tool-result ordering for Responses and Bedrock.
    • Google ADK Retry Budgets — max_retries now bounds extra generation attempts: the default is two retries, while zero means one attempt. Transient generation failures can recover without replaying completed tools or the runner.
    • Unconsumed Context — If converting room history or setting up a NOOA agent fails, the room history and pending participant and contact updates are kept and delivered on the retry instead of being dropped. A NOOA agent that failed to be replaced no longer reuses the previous session’s memory. Original failures still propagate and use the normal retry budget.
    • Parlant Identity and Tool Selection — Mentions of the agent, in live messages and in replayed history, now use the agent name Parlant shows in its prompt, so Parlant no longer treats a message addressed to it as addressed to someone else. Parlant now explicitly checks whether the reply, decline and state-changing Band tools apply before it runs them.
    • Message-Post Diagnostics — Recipient parsing failures after a successful delivery report MessagePostError kind unconfirmed_recipient, explicitly stating that the message was delivered and must not be resent. Missing-room mentions report mentioned_participant_not_in_room; MCP preserves the classification without suggesting an unsafe resend.
    • Windows Codex Teardown — Stdio process descendants are reaped before room workspaces are released, including failed startup and declined/timed-out approvals. If cleanup does not finish, the room workspace is kept so cleanup can be retried.
    • Control Signal Handling — A slow agent-wide STOP, which waits for each room’s turn to wind down, no longer delays handling of a takeover notice (supersede) from a newer connection of the same agent. Interrupt, stop and resume signals still apply one at a time, in the order received.

Security

  • Python SDK:
    • Sandbox Credential Handling — Provisioning failures no longer print the one-time agent key when credential persistence fails, and sandbox command timeout errors are sanitized.