Skip to content

Commit 226789c

Browse files
declan-scaleclaude
andcommitted
refactor(adk): use generated tasks.interrupt now that it's in the SDK (AGX1-391)
scale-agentex#365 merged and Stainless regenerated client.tasks.interrupt, so drop the interim generic POST in the adk interrupt service and call the typed method (matches cancel_task). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 96bfc57 commit 226789c

2 files changed

Lines changed: 1 addition & 17 deletions

File tree

src/agentex/lib/core/services/adk/tasks.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,7 @@ async def interrupt_task(
112112
input={"task_id": task_id, "reason": reason},
113113
) as span:
114114
heartbeat_if_in_workflow("interrupt task")
115-
# TODO(AGX1-391): switch to self._agentex_client.tasks.interrupt(...) once the
116-
# POST /tasks/{id}/interrupt endpoint is added to the Stainless config and
117-
# regenerated. Using the generic post keeps this working before regeneration.
118-
task_model = await self._agentex_client.post(
119-
f"/tasks/{task_id}/interrupt",
120-
cast_to=Task,
121-
body={"reason": reason},
122-
)
115+
task_model = await self._agentex_client.tasks.interrupt(task_id=task_id, reason=reason)
123116
if span:
124117
span.output = task_model.model_dump()
125118
return task_model

src/agentex/protocol/acp.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,3 @@ class InterruptTaskParams(BaseModel):
138138
RPCMethod.TASK_CREATE: CreateTaskParams,
139139
RPCMethod.TASK_INTERRUPT: InterruptTaskParams,
140140
}
141-
142-
# TODO(interrupt): the client-facing REST method ``client.tasks.interrupt(task_id,
143-
# reason=...)`` plus its param/response types (``task_interrupt_params.py``) and the
144-
# ``AgentRPCMethod`` union additions are Stainless-GENERATED. They regenerate from the
145-
# upstream OpenAPI change in scale-agentex (design doc sections 9.1 / 9.2) once
146-
# ``TASK_INTERRUPT`` and the ``POST /tasks/{task_id}/interrupt`` route land there. Do NOT
147-
# hand-write them under ``src/agentex/resources/**`` or ``src/agentex/types/**``. The
148-
# hand-editable protocol shapes above (and the agent-side hook in ``agentex.lib.**``)
149-
# survive regeneration and are what agents rely on today.

0 commit comments

Comments
 (0)