AS AgentScopeAPI 手册 / API Reference
类class agentscope.tool

TaskUpdate

class TaskUpdate(_TaskToolBase)
源码Source agentscope/tool/_task/_update_task.py:54–298

工具到更新智能体任务。位于 agentscope.tool 包,继承自 _TaskToolBase。核心成员包括 call。

The tool to update the agent task. Declared in agentscope.tool. Extends _TaskToolBase.

属性摘要Attribute Summary

属性Attribute类型Type说明Description值Value
namestr
名称字段。
'TaskUpdate'
descriptionstr
`description` 字段。
'Use this tool to update a task in the task list.\n\n## When to Use This Tool\n\n**Mark tasks as resolved:**\n- When you have completed the work described in a task\n- When a task is no longer needed or has been superseded\n- IMPORTANT: Always mark your assigned tasks as resolved when you finish them\n- After resolving, call TaskList to find your next task\n\n- ONLY mark a task as completed when you have FULLY accomplished it\n- If you encounter errors, blockers, or cannot finish, keep the task as in_progress\n- When blocked, create a new task describing what needs to be resolved\n- Never mark a task as completed if:\n - Tests are failing\n - Implementation is partial\n - You encountered unresolved errors\n - You couldn\'t find necessary files or dependencies\n\n**Delete tasks:**\n- When a task is no longer relevant or was created in error\n- Setting status to `deleted` permanently removes the task\n\n**Update task details:**\n- When requirements change or become clearer\n- When establishing dependencies between tasks\n\n## Fields You Can Update\n\n- **status**: The task status (see Status Workflow below)\n- **subject**: Change the task title (imperative form, e.g., "Run tests")\n- **description**: Change the task description\n- **owner**: Change the task owner (agent name)\n- **metadata**: Merge metadata keys into the task (set a key to null to delete it)\n- **add_blocks**: Mark tasks that cannot start until this one completes\n- **add_blocked_by**: Mark tasks that must complete before this one can start\n\n## Status Workflow\n\nStatus progresses: `pending` → `in_progress` → `completed`\n\nUse `deleted` to permanently remove a task.\n\n## Staleness\n\nMake sure to read a task\'s latest state using `TaskGet` before updating it.\n\n## Examples\n\nMark task as in progress when starting work:\n```json\n{"task_id": "1", "status": "in_progress"}\n```\n\nMark task as completed after finishing work:\n```json\n{"task_id": "1", "status": "completed"}\n```\n\nDelete a task:\n```json\n{"task_id": "1", "status": "deleted"}\n```\n\nClaim a task by setting owner:\n```json\n{"task_id": "1", "owner": "my-name"}\n```\n\nSet up task dependencies:\n```json\n{"task_id": "2", "add_blocked_by": ["1"]}\n```'
input_schemadict
输入模式字段。
_TaskUpdateParams.model_json_schema()

方法摘要Method Summary

方法Method说明Description
async def call(_agent_state: AgentState, task_id: str, subject: str | None = None, description: str | None = None, add_…async
向智能体发送输入并返回最终回复。
Update the agent task.

属性详情Attribute Detail

name

str = 'TaskUpdate'

名称字段。声明为 str。

The name field.

源码Source agentscope/tool/_task/_update_task.py:57

description

str = 'Use this tool to update a task in the task list.\n\n## When to Use This Tool\n\n**Mark tasks as resolved:**\n- When you have completed the work described in a task\n- When a task is no longer needed or has been superseded\n- IMPORTANT: Always mark your assigned tasks as resolved when you finish them\n- After resolving, call TaskList to find your next task\n\n- ONLY mark a task as completed when you have FULLY accomplished it\n- If you encounter errors, blockers, or cannot finish, keep the task as in_progress\n- When blocked, create a new task describing what needs to be resolved\n- Never mark a task as completed if:\n  - Tests are failing\n  - Implementation is partial\n  - You encountered unresolved errors\n  - You couldn\'t find necessary files or dependencies\n\n**Delete tasks:**\n- When a task is no longer relevant or was created in error\n- Setting status to `deleted` permanently removes the task\n\n**Update task details:**\n- When requirements change or become clearer\n- When establishing dependencies between tasks\n\n## Fields You Can Update\n\n- **status**: The task status (see Status Workflow below)\n- **subject**: Change the task title (imperative form, e.g., "Run tests")\n- **description**: Change the task description\n- **owner**: Change the task owner (agent name)\n- **metadata**: Merge metadata keys into the task (set a key to null to delete it)\n- **add_blocks**: Mark tasks that cannot start until this one completes\n- **add_blocked_by**: Mark tasks that must complete before this one can start\n\n## Status Workflow\n\nStatus progresses: `pending` → `in_progress` → `completed`\n\nUse `deleted` to permanently remove a task.\n\n## Staleness\n\nMake sure to read a task\'s latest state using `TaskGet` before updating it.\n\n## Examples\n\nMark task as in progress when starting work:\n```json\n{"task_id": "1", "status": "in_progress"}\n```\n\nMark task as completed after finishing work:\n```json\n{"task_id": "1", "status": "completed"}\n```\n\nDelete a task:\n```json\n{"task_id": "1", "status": "deleted"}\n```\n\nClaim a task by setting owner:\n```json\n{"task_id": "1", "owner": "my-name"}\n```\n\nSet up task dependencies:\n```json\n{"task_id": "2", "add_blocked_by": ["1"]}\n```'

description 字段。声明为 str。

The description field.

源码Source agentscope/tool/_task/_update_task.py:59

input_schema

dict = _TaskUpdateParams.model_json_schema()

输入模式字段。声明为 dict。

The input schema field.

源码Source agentscope/tool/_task/_update_task.py:133

方法详情Method Detail

call

async def call(_agent_state: AgentState, task_id: str, subject: str | None = None, description: str | None = None, add_blocks: list[str] | None = None, status: Literal['pending', 'completed', 'in_progress', 'deleted'] | None = None, add_blocked_by: list[str] | None = None, owner: str | None = None, metadata: dict | None = None) -> ToolChunk
async

向智能体发送输入并返回最终回复。

Update the agent task.

参数Parameters
名称Name类型Type说明Description
_agent_stateAgentState智能体状态(类型 `AgentState`)。The agent state.
task_idstr任务标识(类型 `str`)。The task id.
subject默认default Nonestr | None主题(类型 `str | None`)。The subject.
description默认default Nonestr | None描述(类型 `str | None`)。The description.
add_blocks默认default Nonelist[str] | None添加 blocks(类型 `list[str] | None`)。The add blocks.
status默认default NoneLiteral['pending', 'completed', 'in_progress', 'deleted'] | None状态(类型 `Literal['pending', 'completed', 'in_progress', 'deleted'] | None`)。The status.
add_blocked_by默认default Nonelist[str] | None添加 blocked 通过(类型 `list[str] | None`)。The add blocked by.
owner默认default Nonestr | None所有者(类型 `str | None`)。The owner.
metadata默认default Nonedict | None元数据(类型 `dict | None`)。The metadata.
返回Returns ToolChunk
返回ToolChunk。Returns tool chunk.
源码Source agentscope/tool/_task/_update_task.py:135–274
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.