Tasks

Tasks are the atomic units of work in APM. They represent specific things that need to be done, tracked, and potentially automated.

Task Lifecycle

  1. Unstarted - Task is created but not begun
  2. In Progress - Someone (human or AI) is actively working
  3. Complete - Task is finished

Task Properties

PropertyDescription
titleWhat needs to be done
descriptionAdditional context and requirements
assigneeWho's responsible (user or AI agent)
statusCurrent lifecycle stage
projectParent project
implementation_planAI-generated or human-written plan
created_atWhen the task was created

Working with Tasks

Creating Tasks via MCP

There are two primary ways to create tasks:

  1. From APM Interface - Using the built-in task creation UI
  2. From MCP Clients - Using the createTask tool
# Create a basic task
task = mcp_client.call_tool("createTask", {
  project_id: "proj_123",
  title: "Review customer feedback",
  description: "Analyze last week's support tickets for patterns"
})

# Create a task with an implementation plan
task = mcp_client.call_tool("createTask", {
  project_id: "proj_123",
  title: "Generate weekly report", 
  assignee_id: "user_456",
  implementation_plan: <<~PLAN
    1. Query database for last 7 days of data
    2. Calculate key metrics and trends  
    3. Format data into report template
    4. Generate PDF and upload to shared drive
  PLAN
})

Updating Tasks

Use the updateTask tool to modify task properties:

# Mark task as in progress
mcp_client.call_tool("updateTask", {
  task_id: "task_789",
  status: "in_progress"
})

# Complete a task
mcp_client.call_tool("updateTask", {
  task_id: "task_789",
  status: "complete",
  completion_notes: "Successfully generated report"
})

# Reassign a task
mcp_client.call_tool("updateTask", {
  task_id: "task_789",
  assignee_id: "user_123"
})

Querying Tasks

The getTasks tool provides powerful filtering capabilities:

# Get all tasks in a project
tasks = mcp_client.call_tool("getTasks", {
  project_id: "proj_123"
})

# Get tasks assigned to a specific user
my_tasks = mcp_client.call_tool("getTasks", {
  assignee_id: "user_456",
  status: ["unstarted", "in_progress"]
})

# Get recently created tasks
recent_tasks = mcp_client.call_tool("getTasks", {
  created_after: "2024-01-01T00:00:00Z",
  limit: 10
})

Task Events

APM broadcasts events when tasks change, allowing MCP servers to react:

  • apm_task_created - New task created with full task data

Coming Soon:

  • apm_task_updated - Task properties changed (status, assignee, etc.)
  • apm_task_completed - Task marked as complete
  • apm_task_assigned - Task assigned to user or AI agent
  • apm_task_started - Task moved from unstarted to in_progress

Task Automation Patterns

Auto-Assignment Based on Skills

def on_task_created(event)
  task = event["task"]
  
  # Auto-assign based on task title keywords
  if task["title"].downcase.include?("design")
    mcp_client.call_tool("updateTask", {
      task_id: task["id"],
      assignee_id: "designer_bot_123"
    })
  elsif task["title"].downcase.include?("code review")
    mcp_client.call_tool("updateTask", {
      task_id: task["id"],
      assignee_id: "senior_dev_456"
    })
  end
end

Task Dependencies

def on_task_completed(event)
  task = event["task"]
  
  # Create follow-up tasks automatically
  if task["title"] == "Write unit tests"
    mcp_client.call_tool("createTask", {
      project_id: task["project_id"],
      title: "Run integration tests",
      description: "Run full test suite after unit tests completed for #{task['id']}"
    })
  end
end

Best Practices

  1. Clear Titles - Task titles should be actionable and specific
  2. Implementation Plans - Include detailed plans for complex tasks
  3. Status Updates - Keep task status current for accurate project visibility
  4. Event-Driven Automation - Use task events to trigger workflows
  5. Meaningful Descriptions - Provide context that helps both humans and AI understand the task

Was this page helpful?