Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
d1419b7
fix: Keep working-state reporting alive through provider turns
AlexanderZ-Band Oct 18, 2026
8ec26b3
fix: Preserve standalone worker binding across tool wrappers
AlexanderZ-Band Oct 18, 2026
1476457
test: Avoid the E2E peer fixture reservation in runtime tests
AlexanderZ-Band Oct 18, 2026
8bfeac0
style: Format the renamed activity platform fixture
AlexanderZ-Band Oct 18, 2026
a397d8c
test: Use real time for randomized scheduler grace controls
AlexanderZ-Band Oct 18, 2026
0342d96
feat: Deliver compatible activity detail through the working-state re…
AlexanderZ-Band Oct 18, 2026
d76f571
style: Format detail ownership fixture parameters
AlexanderZ-Band Oct 18, 2026
1842638
test: Avoid reserved peer fixtures in activity wire tests
AlexanderZ-Band Oct 18, 2026
06d8124
test: Preserve backlog ordering across valid recovery retries
AlexanderZ-Band Oct 18, 2026
2d69703
feat: Map provider and Band tool progress to room activity
AlexanderZ-Band Oct 18, 2026
64de362
test: Validate activity producers through real execution boundaries
AlexanderZ-Band Oct 18, 2026
831b851
refactor: Consolidate activity reset and streaming usage ownership
AlexanderZ-Band Oct 18, 2026
9d7fc64
test: Register live activity cells and disambiguate runtime fixtures
AlexanderZ-Band Oct 18, 2026
eb7326e
fix: Fence housekeeping activity and clean up cancelled tool starts
AlexanderZ-Band Oct 18, 2026
a674b67
refactor: Share activity observation records and assertions
AlexanderZ-Band Oct 18, 2026
1249060
Merge remote-tracking branch 'origin/main' into feat/python-sdk-repor…
AlexanderZ-Band Oct 20, 2026
1ff4c54
Merge remote-tracking branch 'origin/feat/python-sdk-report-activity-…
AlexanderZ-Band Oct 20, 2026
c139bc2
Merge remote-tracking branch 'origin/feat/python-sdk-report-activity-…
AlexanderZ-Band Oct 20, 2026
2d8c903
test: give the Strands/NOOA job coverage guard a longer timeout
AlexanderZ-Band Oct 20, 2026
f2ff776
Merge remote-tracking branch 'origin/main' into feat/python-sdk-repor…
AlexanderZ-Band Oct 20, 2026
2f4082e
Merge remote-tracking branch 'origin/feat/python-sdk-report-activity-…
AlexanderZ-Band Oct 20, 2026
36ba9a1
Merge remote-tracking branch 'origin/feat/python-sdk-report-activity-…
AlexanderZ-Band Oct 20, 2026
3d52a13
feat: gate activity tool names on the tool-call emit choice
bandzalkin Oct 20, 2026
9511b0f
feat(core): own host harness probes and share catalog metadata
bandzalkin Oct 18, 2026
926fe70
fix(core): keep cancelled probe diagnostics credential-safe
bandzalkin Oct 18, 2026
88a0c6f
fix(core): enroll probes before eager execution
bandzalkin Oct 18, 2026
53be62c
feat(acp): preflight an owned roomless ACP runtime
bandzalkin Oct 18, 2026
5feeef1
test(acp): align roomless preflight regression gates
bandzalkin Oct 18, 2026
0a5326c
Preserve ACP stop caller context during aggregated cleanup
bandzalkin Oct 18, 2026
e60da15
test(integrations): use virtual time for cancellation deadlines
bandzalkin Oct 18, 2026
9f9bd0d
fix(tests): isolate ACP virtual deadlines and peer startup
bandzalkin Oct 18, 2026
e9b1aef
fix(codex): await physical Windows job member exit
bandzalkin Oct 18, 2026
650f8d7
Merge remote-tracking branch 'origin/main' into feat/python-sdk-repor…
AlexanderZ-Band Oct 20, 2026
6a62878
refactor: Flatten the activity compatibility retry
AlexanderZ-Band Oct 20, 2026
4a04046
fix: Learn activity detail support from response headers
AlexanderZ-Band Oct 20, 2026
eac1fdd
fix: Forward activity detail through the baseline ControlLink
AlexanderZ-Band Oct 20, 2026
9a1430b
refactor: Keep one detail reset and one ownership recheck in the repo…
AlexanderZ-Band Oct 20, 2026
435ae73
test: Scope the recovery-jitter patch to resync's random reference
AlexanderZ-Band Oct 20, 2026
90bc52a
fix: Log a content-free cause when activity detail is downgraded
AlexanderZ-Band Oct 20, 2026
3c665de
refactor: Drop the unreachable cycle token and pin reporter guards
AlexanderZ-Band Oct 20, 2026
2c4a9f7
test: Share one activity-support isolation helper
AlexanderZ-Band Oct 20, 2026
cd3c6aa
sim840
Oct 20, 2026
11420ba
Merge upstream main (815 settlement details, 839 squash, websocket te…
bandzalkin Oct 20, 2026
f7c6416
Merge #841 head carrying upstream main (activity stack re-merge)
Oct 20, 2026
d9e9134
Merge upstream main through #877 so stacked preflights compose
Oct 20, 2026
098ebe9
Merge #844 rebased onto current main
Oct 20, 2026
eb8fc7d
Merge #874 (activity stack) so preflight diffs stay their own
Oct 20, 2026
3b9fe79
Merge #844 carrying #874
Oct 20, 2026
f4576ab
Merge upstream main into the activity producers branch
bandzalkin Oct 20, 2026
04c259b
Merge prerequisite head (activity stack re-merged with current main)
Oct 20, 2026
823eeca
Merge upstream main through #838 into the activity delivery branch
Oct 20, 2026
2bc0340
Merge #840 delivery head (main through #838 + X-API-Version and Contr…
bandzalkin Oct 20, 2026
fdaecf6
Merge #841 carrying #840's X-API-Version learning and ControlLink fix
Oct 20, 2026
ef5d6b9
fix(activity): clip over-long tool names before the platform rejects …
bandzalkin Oct 20, 2026
bc5a294
Merge simulation commit landed on this branch; content already supers…
bandzalkin Oct 20, 2026
8f1f1d0
Merge updated prerequisite (final activity stack lineage)
Oct 20, 2026
571efac
Merge updated prerequisite (final activity stack lineage)
Oct 20, 2026
a476c3a
test: Accept room event posts in the activity peer
bandzalkin Oct 20, 2026
0d8cbd0
Merge #841 fix: running-room event echo in the activity peer
bandzalkin Oct 20, 2026
60db6dc
Merge #874 (event-echo fix on the activity stack)
bandzalkin Oct 20, 2026
e9f0e57
Merge #844 (event-echo fix through the host stack)
bandzalkin Oct 20, 2026
d697f43
style: drop merge-seam blank lines from the reporter files
bandzalkin Oct 20, 2026
89dab59
Merge #841 (format fix on the activity stack)
bandzalkin Oct 20, 2026
b470206
Merge #874 (format fix on the activity stack)
bandzalkin Oct 20, 2026
d5c7c60
Merge #844 (format fix through the host stack)
bandzalkin Oct 20, 2026
d764959
fix(activity): consult the tool-name gate at report time
bandzalkin Oct 21, 2026
df3d2bc
Merge #874 (live tool-name gate) into #845
bandzalkin Oct 21, 2026
5f3910a
Merge #874 (live tool-name gate) into #844
bandzalkin Oct 21, 2026
35750ab
Merge #0 #845 (chain)
bandzalkin Oct 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ jobs:
BAND_ALLOW_MISSING_FRAMEWORKS: "1"
run: uv run --all-packages pytest tests/e2e/baseline/ --collect-only -q --no-cov

- name: Run CrewAI activity tests
env:
BAND_ALLOW_MISSING_FRAMEWORKS: "1"
run: uv run --all-packages pytest tests/integrations/crewai/activity/

- name: Run crewai tests
env:
# dev-crewai venv lacks langgraph/anthropic/parlant/pydantic-ai/etc.;
Expand All @@ -171,7 +176,7 @@ jobs:
# Only the tests that *need* this venv. Every other crewai test fakes the
# package through sys.modules, so the `test` job above already runs it and
# a second pass here would add no signal — just a path to forget.
# tests/framework_conformance/test_crewai_job_coverage.py keeps this honest.
# tests/framework_conformance/crewaicoverage/ keeps this honest.
run: |
uv run --all-packages pytest \
tests/adapters/test_crewai_flow_phase3.py \
Expand Down Expand Up @@ -233,6 +238,12 @@ jobs:
BAND_TEST_EXTRA: "dev-strands-nooa"
run: uv run --all-packages pytest tests/e2e/baseline/ --collect-only -q --no-cov

- name: Run Strands activity tests
env:
BAND_ALLOW_MISSING_FRAMEWORKS: "1"
BAND_TEST_EXTRA: "dev-strands-nooa"
run: uv run --all-packages pytest tests/adapters/strands/activity/

- name: Run Strands and NOOA tests
env:
# dev-strands-nooa lacks modern framework packages;
Expand Down Expand Up @@ -302,6 +313,11 @@ jobs:
BAND_ALLOW_MISSING_FRAMEWORKS: "1"
run: uv run --all-packages pytest tests/e2e/baseline/ --collect-only -q --no-cov

- name: Run Parlant activity tests
env:
BAND_ALLOW_MISSING_FRAMEWORKS: "1"
run: uv run --all-packages pytest tests/integrations/parlant/activity/

- name: Run parlant tests
env:
# dev-parlant venv lacks langgraph/anthropic-adapter/pydantic-ai/etc.;
Expand All @@ -310,7 +326,7 @@ jobs:
# Only the tests that *need* this venv. Every other parlant test fakes the
# package through sys.modules, so the `test` job above already runs it and
# a second pass here would add no signal — just a path to forget.
# tests/framework_conformance/test_parlant_job_coverage.py keeps this honest.
# tests/framework_conformance/parlantcoverage/ keeps this honest.
run: |
uv run --all-packages pytest \
tests/integrations/parlant/test_catalog.py \
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,28 @@ adapter = GeminiAdapter(GeminiAdapterConfig(model="gemini-3.8-flash"))

Use [examples/run_agent.py](examples/run_agent.py) when you want one command that can switch between LangGraph, Pydantic AI, Anthropic, Claude SDK, Parlant, CrewAI, Codex, A2A bridge, and A2A gateway. Use the per-framework directories under [examples/](examples/) when you want the adapter-specific setup.

### Host-side Harness Probes

`await adapter.preflight(timeout_s=60)` reports a harness handshake as a
`PreflightResult` (`ok`, `reason`, `remedy`). A successful handshake does not prove
that the account can run inference. Adapters without a standalone handshake
implementation explicitly report that it is unsupported.

`await adapter.probe_models(timeout_s=60)` discovers a canonical `ModelCatalog`
without creating or selecting a Band room. Unsupported adapters raise
`BandConfigError`; an empty catalog is not a substitute for unsupported discovery.
The existing room-facing `list_models` hook remains separate.

Catalog entries preserve advertised provider and default metadata. An entry's
`efforts=None` means the harness did not report effort support; `efforts=()` means
it explicitly offers none. `current_model` is populated only when the harness
reports an actual selection.

Timeouts bound how long a caller waits, not ownership of a partially started
transport. Always call `await adapter.cleanup_all()` when disposing of an adapter.
An incomplete close raises `CleanupIncompleteError` and retains its resources for
a later cleanup attempt rather than reporting successful disposal.

### Process Signals

`agent.run()` and `agent.run_forever()` stop the agent on SIGTERM/SIGINT and restore the process's previous handlers when they return. A host that owns its process signals (a launchd/systemd service, a desktop app, a test runner) passes `install_signal_handlers=False` and calls `agent.stop()` from its own handler; `run_forever` then returns. `GracefulShutdown` is a ready-made handler that does this, and `run_with_graceful_shutdown(agent)` wraps it. Put `GracefulShutdown` outside `agent` so its handlers are registered before `start()` and a mid-initialize SIGTERM can still tear down:
Expand Down
38 changes: 38 additions & 0 deletions docs/acp.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,44 @@ adapter = ACPClientAdapter(config)
assert adapter.config.command == ("codex-acp",)
```

## Host preflight

`await adapter.preflight(timeout_s=60.0)` on `ACPClientAdapter`,
`CursorACPAdapter` or `CopilotACPAdapter` starts a throwaway ACP process,
initializes it, and closes it without a Band connection, room, room workspace,
ACP session or model turn. It uses the configured executable, backend credential
environment, client capabilities and protocol options. A configured `cwd` is
the probe's working directory itself, not a root for a fabricated room.
This ACP operation is separate from the native OMP adapter's protocol.

When `auth_method` is set, preflight also calls ACP `authenticate`. This can open
an interactive login flow or change stored authentication state; leave it unset
when a host must not request login. Even a successful initialize/authenticate
does not establish inference entitlement, MCP connectivity, session creation or
configured model/effort readiness. Session catalogs and model selection are
still checked when a real room opens a session.

The result is a `PreflightResult`: `ok`, with a safe `reason` and `remedy` on an
ordinary handshake failure. `timeout_s` bounds handshake reporting and, separately,
cleanup reporting. Cancellation propagates. `CleanupIncompleteError` is not a
failed handshake result: the adapter still owns a process or late startup.
Call `await adapter.cleanup_all()` again to settle it before discarding the
adapter. Probe stderr diagnostics report line lengths and process exit metadata,
not raw child output or configured command arguments. Third-party protocol
libraries can emit their own diagnostics.

```python notest
from band.adapters.copilot_acp import CopilotACPAdapter

adapter = CopilotACPAdapter()
try:
result = await adapter.preflight(timeout_s=15.0)
if not result.ok:
raise RuntimeError(f"{result.reason} {result.remedy}")
finally:
await adapter.cleanup_all()
```

## Band tools

- **Injected tools are bound to the room.** With `inject_band_tools` on (the
Expand Down
8 changes: 5 additions & 3 deletions docs/adapters/codex.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ For existing integrations, follow the [SDK 4.x to 5.x migration](../acp.md#upgra
On Windows, the client owns the helper and its process-tree job from startup
through cleanup. It starts the interpreter image directly so a virtual-environment
launcher cannot hide another helper process. Cleanup confirms the helper has
exited before terminating and draining the job; an empty job alone does not
establish helper exit.
Failed cleanup retains that same owner and job for retry.
exited, seals the job against new children, and retains member process handles
before requesting termination. It waits for those handles to signal physical
exit as well as empty job accounting; accounting alone does not prove directory
and file handles were released. Failed cleanup retains that same owner, job,
and any pending process handles for retry.
- **Leaving is final.** Leaving a room stops it admitting work at once. A
leave that fails or runs over keeps the process, thread and workspace claim,
and the room refuses work until a retried leave succeeds; a later rejoin
Expand Down
12 changes: 12 additions & 0 deletions docs/turn-outcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,15 @@ once. It does not rewrite the original delivery's settled acknowledgement.
Explicit interruption invalidates its activity; leave and shutdown clear the
indicator while adapter residency retains responsibility for released workers.
The authoritative idle report finishes before a replacement reports working.

`SessionConfig.enable_working_state` controls both the indicator and activity
detail, independently of chat narration and tool capabilities. Changes and
keep-alives share one serialized reporter. The duration cap stops both kinds
of refresh without cancelling provider work; actual completion still clears.

Detail compatibility is learned from the `X-API-Version` header the platform
puts on every activity response. Reports stay boolean until a response in the
process advertises agent API 1.25.0 or later; a missing or older version keeps
boolean reporting. A detail-bearing HTTP 422 permanently disables detail across
all links in the process and retries that report once without detail, within
its original deadline.
36 changes: 18 additions & 18 deletions src/band/adapters/agno.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
is_image_passthrough_result,
redact_tool_call_args,
)
from band.runtime.working_state import end_tool_activity, report_tool_activity

try:
from agno.models.message import Message
Expand Down Expand Up @@ -451,10 +452,7 @@ async def _run_agent(
) -> RunOutput | None:
"""Run the Agno agent with the room's tools bound for this call.

When ``Emit.TOOL_CALLS`` is enabled the run is streamed so tool_call /
tool_result events are emitted *as each tool runs* (see
:meth:`_run_streamed`), matching the other adapters' live reporting.
Otherwise it runs non-streaming, exactly as before.
Consume provider progress as it happens, independently of chat narration.
"""
try:
agent = self._agent
Expand All @@ -469,17 +467,14 @@ async def _run_agent(
session_id,
)
with _bind_room_tools(tools):
if Emit.TOOL_CALLS in self.features.emit:
response = await self._run_streamed(
agent,
messages,
tools,
session_id=session_id,
room_id=room_id,
msg_id=msg_id,
)
else:
response = await agent.arun(input=messages, session_id=session_id)
response = await self._run_streamed(
agent,
messages,
tools,
session_id=session_id,
room_id=room_id,
msg_id=msg_id,
)
# Agno swallows run exceptions into a normal-looking return value
# (status=error); surface it so the shared except path below treats
# the turn as failed rather than as a silent empty reply.
Expand Down Expand Up @@ -532,9 +527,14 @@ async def _run_streamed(
# None, which would read as a successful turn with no output.
raise AgnoRunError(_error_summary(item.content))
else:
await self._emit_stream_event(
item, tools, room_id=room_id, msg_id=msg_id
)
if isinstance(item, ToolCallStartedEvent) and item.tool is not None:
await report_tool_activity(tools, item.tool.tool_name or "")
elif isinstance(item, ToolCallCompletedEvent):
await end_tool_activity(tools)
if Emit.TOOL_CALLS in self.features.emit:
await self._emit_stream_event(
item, tools, room_id=room_id, msg_id=msg_id
)
return final

def _persist_turn(self, room_id: str, response: RunOutput) -> None:
Expand Down
106 changes: 54 additions & 52 deletions src/band/adapters/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
redact_tool_call_args,
)
from band.runtime.tools.schema import is_failed_tool_output
from band.runtime.working_state import tool_activity

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -478,61 +479,62 @@ async def _process_tool_calls(

logger.debug("Executing tool: %s with input: %s", tool_name, tool_input)

# Report tool call if enabled (JSON format with tool_call_id for linking)
# Best-effort: event reporting must never crash tool execution
if Emit.TOOL_CALLS in self.features.emit:
async with tool_activity(tools, tool_name):
# Report tool call if enabled (JSON format with tool_call_id for linking)
# Best-effort: event reporting must never crash tool execution
if Emit.TOOL_CALLS in self.features.emit:
try:
await tools.send_event(
content=json.dumps(
{
ToolEventKey.NAME: tool_name,
ToolEventKey.ARGS: redact_tool_call_args(
tool_name, tool_input
),
ToolEventKey.TOOL_CALL_ID: tool_use_id,
}
),
message_type="tool_call",
)
except Exception as e: # noqa: BLE001 -- tool calls may raise any exception type; must surface to the LLM as an error string, not crash the turn
logger.warning(
"Failed to send tool_call event: %s",
e,
)

# Execute tool (check custom tools first, then platform tools)
try:
await tools.send_event(
content=json.dumps(
{
ToolEventKey.NAME: tool_name,
ToolEventKey.ARGS: redact_tool_call_args(
tool_name, tool_input
),
ToolEventKey.TOOL_CALL_ID: tool_use_id,
}
),
message_type="tool_call",
)
custom_tool = find_custom_tool(self._custom_tools, tool_name)
if custom_tool:
result = await execute_custom_tool(
custom_tool, tool_input, turn=tools.turn
)
succeeded = not is_failed_tool_output(result)
else:
outcome = await tools.execute_tool_call_structured(
tool_name, tool_input
)
result = outcome.value
succeeded = outcome.ok
if succeeded and tool_name == BandTool.NO_REPLY:
declined = True
if not succeeded:
failed = True
if is_image_passthrough_result(tool_name, result):
content = _image_tool_result_content(result)
result_str = image_block_placeholder(len(content))
else:
content = result_str = (
json.dumps(result, default=str)
if not isinstance(result, str)
else result
)
is_error = False
except Exception as e: # noqa: BLE001 -- tool calls may raise any exception type; must surface to the LLM as an error string, not crash the turn
logger.warning(
"Failed to send tool_call event: %s",
e,
)

# Execute tool (check custom tools first, then platform tools)
try:
custom_tool = find_custom_tool(self._custom_tools, tool_name)
if custom_tool:
result = await execute_custom_tool(
custom_tool, tool_input, turn=tools.turn
)
succeeded = not is_failed_tool_output(result)
else:
outcome = await tools.execute_tool_call_structured(
tool_name, tool_input
)
result = outcome.value
succeeded = outcome.ok
if succeeded and tool_name == BandTool.NO_REPLY:
declined = True
if not succeeded:
failed = True
if is_image_passthrough_result(tool_name, result):
content = _image_tool_result_content(result)
result_str = image_block_placeholder(len(content))
else:
content = result_str = (
json.dumps(result, default=str)
if not isinstance(result, str)
else result
)
is_error = False
except Exception as e: # noqa: BLE001 -- tool calls may raise any exception type; must surface to the LLM as an error string, not crash the turn
failed = True
content = result_str = f"Error: {e}"
is_error = True
logger.error("Tool %s failed: %s", tool_name, e)
content = result_str = f"Error: {e}"
is_error = True
logger.error("Tool %s failed: %s", tool_name, e)

# Report tool result if enabled (JSON format with tool_call_id for linking)
# Best-effort: event reporting must never crash tool execution
Expand Down
Loading
Loading