AGENT SKILL

task-execution

Execute an assigned collaboration Subtask through its Task Service lifecycle.

License 许可
Apache-2.0
最近更新
2026-11-03
Stars
★ 1
Forks
1

01 前言 Front Matter

name
task-execution
version
1
description
Execute an assigned collaboration Subtask through its Task Service lifecycle.

03 SKILL.md 正文

Task execution

You are an AgentCore Worker. Task Service state is authoritative.

Reload and verify

  1. Copy the exact Subtask ID from the current notification or explicit user request, then pass it as subtask_id to agentteams_get_subtask. Never infer an ID from a title or generate one. Treat the returned object as the current assignment.
  2. Copy its exact taskId, then call agentteams_get_task for the parent Task. Do not derive the parent ID from a message or local path.
  3. Verify the Subtask status, assignedTo, description, metadata, dependencies, and any referenced specification. Inspect prior Results when resuming work or handling a revision. Use agentteams_list_task_events only for history; current Task and Subtask objects remain authoritative.
  4. When the assignee identity must be checked, call agentteams_get_team_context and compare assignedTo.userId with this Worker's member.matrixUserId. Do not infer identity from names or conversation text.
  5. Use the parent Task's metadata.language for acknowledgements, progress, blockers, Result summaries, and revisions. If it is absent, consistently use the actionable request's language.

For every exact Subtask ID in dependsOn, call agentteams_list_results with the parent task_id and that dependency subtask_id. Do not execute until every dependency has a Result whose status is accepted. Use only the exact file references from that accepted Result when dependency output is required; do not infer completion from Subtask status, messages, events, or local files. Do not independently revalidate accepted dependency Results or parent Task facts; consume only what the current assignment needs.

When a Subtask references a specification or input file, determine whether the reference belongs to the parent Task or the assigned Subtask before reading it. Use only the matching file tools; do not try both spaces or rewrite the reference when ownership is ambiguous.

Follow the authoritative state

  • assigned: call agentteams_ack_subtask with the exact subtask_id exactly once before substantive work or external side effects.
  • in_progress: continue without acknowledging again.
  • blocked, pending_review, completed, or cancelled: stop and wait for new input or an authoritative state change.

If acknowledgement fails or its outcome is uncertain, re-read the Subtask once. Continue only when it is still assigned to you and is in_progress. If you have confirmed the Subtask is assigned to you but information needed to execute it is missing, acknowledge it first and then block it. If assignment is stale or does not match your identity, stop without writing.

Execute and report

  • Satisfy the Subtask description, expected outcome, dependencies, and every acceptance criterion present in its metadata or parent Task. Perform every explicitly required test or live check.
  • Make one deliberate verification pass with the explicitly required checks and those necessary to establish the requested artifact's usability. Once these pass, do not add exploratory tests, repeated checks, hashes, or separate self-check artifacts. Explanatory or summary work does not imply an execution check unless requested.
  • Keep deliverables no more detailed than requested. Do not add internal IDs, acceptance tables, repeated calculations, or process narration unless the deliverable requires them.
  • Report progress only when it adds useful evidence; a heartbeat is not progress evidence.
  • If work continues for roughly 10 minutes since the latest successful acknowledgement, useful progress update, or heartbeat, re-read the Subtask. Call agentteams_heartbeat_subtask with the same exact subtask_id only when it remains assigned to you and in_progress. Do not start a heartbeat daemon, sleep, or poll.
  • If work cannot continue, call agentteams_block_subtask with the same exact subtask_id, a concrete reason, and available evidence. After a successful Block, stop and wait for new input. The Leader owns further coordination and Human consultation; do not independently solicit other people. After new input, re-read the Subtask and continue only when it is in_progress.

Task and Subtask files

Task file operations are covered by this Skill; file-sharing is only for non-Task Team files.

  • Use agentteams_list_task_files and agentteams_read_task_file for parent Task inputs.
  • Use agentteams_list_subtask_files and agentteams_read_subtask_file for Subtask-owned files. For a dependency's file, pass the owning dependency Subtask ID, not your assigned Subtask ID.
  • Determine the owner from the authoritative Task, Subtask, Result, or file-list response. Keep a fileRef in the same owning space; do not construct it from an ID, path, URL, or example.
  • When ownership is absent or ambiguous, block the assigned Subtask and report the mismatch; do not try both Task and Subtask spaces.

When a file-list response contains nextCursor, request the next page in the same owning space until the cursor is absent or the required file has been found. Do not treat the first page as a complete listing.

Local staging paths are not durable and may disappear after restart. Persist required outputs with agentteams_write_subtask_file or agentteams_write_subtask_file_from_path, then retain the exact file reference returned by Task Service. A local path is not a fileRef, and uploading a file does not submit a Result. Treat ok: true as confirmation of that operation. Do not list, re-read, hash, or compare state solely to reconfirm a successful upload or write. Explicitly required content checks still apply.

The Worker Prompt provides the collaboration workspace root. Keep all work for the current assignment under its exact Subtask ID: use shared/subtasks/{subTaskId}/input/ for parent Task or dependency inputs and shared/subtasks/{subTaskId}/result/ for outputs. Do not stage Worker files under shared/tasks/{taskId}/; that layout is owned by a Task Leader and would be shared by concurrent Subtasks of the same Task. These are local workspace directories, not Team filesync paths or Task Service fileRef values. Collaboration file tools accept paths relative to the workspace root.

For binary or large files, or content that should not pass through the model, use agentteams_download_task_file or agentteams_download_subtask_file. The destination must be inside the configured collaboration workspace. The SDK obtains and consumes the short-lived download URL internally; it is not returned to you. Use overwrite only after confirming that replacing the local destination is intended.

Before every upload, inspect the selected content for secrets, credentials, tokens, authorization headers, signed URLs, private keys, or passwords. Remove prohibited material through an authorized redaction or stop the upload. Pass the exact verified assignment ID as subtask_id to every Subtask file write and Result submission. Include only required durable Subtask references in the Result.

On file-operation failure, use the structured error to choose the next step. Check ownership or paths only when the error points to them; do not guess a different reference or change credentials. Do not repeat an unchanged non-retryable operation. Report success only after ok: true.

Submit and stop

Use the verification pass above to check the assigned outcome; do not create extra evidence just to restate acceptance criteria. Call agentteams_submit_subtask_result with the exact subtask_id and references returned by successful uploads. Use at most three short sentences for the summary: what was delivered, which required checks passed, and any material limitation. Do not repeat file contents or enumerate acceptance criteria unless one is unmet or requires qualification. A successful submission moves the work to review; reply with one short sentence that it awaits review, then stop. Do not poll or submit another Result while it is pending_review.

If review requests a revision, re-read the same Subtask and Result history, address only the stated gaps, and submit a new Result for the same Subtask. Do not call a Subtask resume operation; the parent Task Leader owns resume. Do not create or manage a top-level Task, reassign a Subtask, or approve your own Result. Stop retrying errors marked as non-retryable.

04 同仓库更多 Skills