Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 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
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
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
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
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
d764959
fix(activity): consult the tool-name gate at report time
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
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
88 changes: 52 additions & 36 deletions src/band/adapters/claude_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
from functools import partial
from typing import TYPE_CHECKING, Any, ClassVar, Literal, NoReturn, Self, cast

from band.runtime.working_state import (
end_tool_activity,
report_tool_activity,
set_permission_wait,
)

try:
from claude_agent_sdk import ( # type: ignore[import-not-found]
AssistantMessage,
Expand Down Expand Up @@ -1406,6 +1412,7 @@ async def _on_tool_use(
# namespaces our tools mcp__band__*; see _semantic_tool_name).
tool_name = self._semantic_tool_name(block.name)
pending_tool_names[block.id] = tool_name
await report_tool_activity(tools, tool_name)
await self._narrate_tool_call(block, tool_name, room_id, tools)

async def _narrate_tool_call(
Expand Down Expand Up @@ -1555,6 +1562,7 @@ async def _on_tool_result(
Shared by both envelopes a result can arrive in: user-type messages
(the protocol shape) and assistant messages (accepted defensively).
"""
await end_tool_activity(tools)
result_tool_name = pending_tool_names.pop(block.tool_use_id, None)
await self._narrate_tool_result(block, result_tool_name, room_id, tools)

Expand Down Expand Up @@ -1858,48 +1866,56 @@ async def _resolve_manual_approval(
# so the caller isn't left waiting for a timeout nobody will see.
tools = self._room_tools.get(room_id)
mention = [requester["id"]] if requester else None
if tools:
try:
await tools.send_notice(
APPROVAL_REQUESTED_TEMPLATE.format(summary=summary, token=token),
mentions=mention,
)
except Exception: # noqa: BLE001 -- tool calls may raise any exception type; must surface to the LLM as an error string, not crash the turn
logger.warning("Room %s: Failed to send approval notification", room_id)
# A reply that claimed it meanwhile owns the answer; otherwise
# decline without a notice, so the missing-reply guard stays.
if registry.withdraw(entry):
self._clear_pending_approval(room_id, entry)
return PermissionResultDeny(
message="Could not deliver approval prompt, tool use declined"
try:
if tools:
await set_permission_wait(tools, True)
try:
await tools.send_notice(
APPROVAL_REQUESTED_TEMPLATE.format(
summary=summary, token=token
),
mentions=mention,
)
except Exception: # noqa: BLE001 -- tool calls may raise any exception type; must surface to the LLM as an error string, not crash the turn
logger.warning(
"Room %s: Failed to send approval notification", room_id
)
# A reply that claimed it meanwhile owns the answer; otherwise
# decline without a notice, so the missing-reply guard stays.
if registry.withdraw(entry):
return PermissionResultDeny(
message="Could not deliver approval prompt, tool use declined"
)

# The request has been posted (or there was nowhere to post it) --
# either way, on_message must return now so Band's room loop can
# dispatch the reply that will resolve this wait. The turn is then
# judged at its real end (see _on_turn_complete).
if tools:
tools.turn.detach()
self._release_turn(room_id)

# The request has been posted (or there was nowhere to post it) --
# either way, on_message must return now so Band's room loop can
# dispatch the reply that will resolve this wait. The turn is then
# judged at its real end (see _on_turn_complete).
if tools:
tools.turn.detach()
self._release_turn(room_id)

try:
decision = await registry.wait(
entry, pending.future, timeout_s=self._approvals.wait_timeout_s
entry,
pending.future,
timeout_s=self._approvals.wait_timeout_s,
retain_entry=True,
)
match decision:
case Timeout.TIMED_OUT:
return await self._apply_approval_timeout(
tools, room_id, token, mention, tool_use_id
)
case ApprovalReply():
return await self._apply_approval_reply(
tools, room_id, token, decision, tool_use_id
)
# Forced by eviction or room teardown: no notice names this call.
return PermissionResultDeny(message="User declined tool use")
finally:
self._clear_pending_approval(room_id, entry)

match decision:
case Timeout.TIMED_OUT:
return await self._apply_approval_timeout(
tools, room_id, token, mention, tool_use_id
)
case ApprovalReply():
return await self._apply_approval_reply(
tools, room_id, token, decision, tool_use_id
)
# Forced by eviction or room teardown: no notice names this call.
return PermissionResultDeny(message="User declined tool use")
if tools:
await set_permission_wait(tools, bool(registry))

async def _apply_approval_reply(
self,
Expand Down
Loading
Loading