Skip to content

Commit 80aabc8

Browse files
declan-scaleclaude
andcommitted
fix(claude-code): use create_task RPC in async live tests
The async 130/140 live tests called client.tasks.create, which does not exist on TasksResource (AttributeError) — it was previously masked by the test_utils ModuleNotFoundError. Switch to client.agents.create_task(...).result, the same create-task + send_event + poll pattern the langgraph async tutorials use. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 50d90b1 commit 80aabc8

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

examples/tutorials/10_async/00_base/130_claude_code/tests/test_agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,13 @@ def agent_id(self, client, agent_name):
213213
def test_send_simple_message(self, client, agent_id: str):
214214
"""Create a task, send a message, and poll until a response appears."""
215215
import time
216+
import uuid
216217

217218
from agentex.types import TextContentParam
218-
from agentex.types.agent_rpc_params import ParamsSendEventRequest
219+
from agentex.types.agent_rpc_params import ParamsSendEventRequest, ParamsCreateTaskRequest
219220

220-
task = client.tasks.create(agent_id=agent_id)
221+
task = client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)).result
222+
assert task is not None
221223
task_id = task.id
222224

223225
client.agents.send_event(

examples/tutorials/10_async/10_temporal/140_claude_code/tests/test_agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,13 @@ def agent_id(self, client, agent_name):
211211
def test_send_simple_message(self, client, agent_id: str):
212212
"""Create a task, send a message, and poll until a response appears."""
213213
import time
214+
import uuid
214215

215216
from agentex.types import TextContentParam
216-
from agentex.types.agent_rpc_params import ParamsSendEventRequest
217+
from agentex.types.agent_rpc_params import ParamsSendEventRequest, ParamsCreateTaskRequest
217218

218-
task = client.tasks.create(agent_id=agent_id)
219+
task = client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)).result
220+
assert task is not None
219221
task_id = task.id
220222

221223
client.agents.send_event(

0 commit comments

Comments
 (0)