Skip to content

Commit 5d63622

Browse files
agentex behaviour testing
1 parent 478d79b commit 5d63622

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/agentex/lib/testing/task_manager.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,15 @@ def create_task_sync(client: Agentex, agent_id: str, task_type: str) -> Task:
5656
logger.debug(f"Creating task: {task_name} for agent {agent_id}")
5757

5858
params = ParamsCreateTaskRequest(name=task_name, params={})
59-
task = client.agents.create_task(agent_id=agent_id, params=params)
59+
response = client.agents.create_task(agent_id=agent_id, params=params)
6060

61-
logger.debug(f"Task created successfully: {task.id}")
62-
return task
61+
# Extract task from response.result
62+
if hasattr(response, 'result') and response.result:
63+
task = response.result
64+
logger.debug(f"Task created successfully: {task.id}")
65+
return task
66+
else:
67+
raise Exception(f"Failed to create task: {response}")
6368

6469
@staticmethod
6570
async def create_task_async(client: AsyncAgentex, agent: Agent, task_type: str) -> Task:

0 commit comments

Comments
 (0)