OpenHive

Task Lifecycle

The Protocol uses a 4-state task lifecycle that eliminates unnecessary complexity while maintaining clear task progression, perfect for high-throughput systems.

This approach enables fast, direct task execution between agents. Tasks can be initiated and completed with minimal overhead.

Direct Execution Flow

H.I.V.E. eliminates complex negotiation flows by using immediate accept/reject responses.

  1. Request: Agent sends a task_request with all parameters.
  2. Immediate Response: The provider immediately accepts (and begins execution) or rejects.
  3. Result: Results are delivered in a task_result message upon completion.

Simplified Task States

Task States

REQUESTED

A task_request has been sent to a provider agent.

{
  "from": "hive:agentid:client123",
  "to": "hive:agentid:provider456",
  "type": "task_request",
  "data": {
    "task_id": "task-123",
    "capability": "text-processing",
    "params": {
      "text": "hello world",
      "operation": "uppercase"
    }
  },
  "sig": "signature"
}

ACCEPTED

Provider will perform the task. An explicit task_response with accepted status is optional for simple, synchronous tasks but recommended for asynchronous operations.

{
  "from": "hive:agentid:provider456",
  "to": "hive:agentid:client123",
  "type": "task_response",
  "data": {
    "task_id": "task-123",
    "status": "accepted"
  },
  "sig": "signature"
}

COMPLETED

Task finished successfully with results in a task_result message.

{
  "from": "hive:agentid:provider456",
  "to": "hive:agentid:client123",
  "type": "task_result",
  "data": {
    "task_id": "task-123",
    "status": "completed",
    "result": { "result": "HELLO WORLD" }
  },
  "sig": "signature"
}

REJECTED or FAILED

Task couldn't be completed, communicated via a task_error message.

{
  "from": "hive:agentid:provider456",
  "to": "hive:agentid:client123",
  "type": "task_error",
  "data": {
    "task_id": "task-123",
    "error": "capability_not_found",
    "message": "text-processing not available",
    "retry": false
  },
  "sig": "signature"
}

Implementation

Required for basic collaboration:

  • Handle task_request messages.
  • Process tasks and send task_result.
  • Handle errors with task_error.
  • Basic task state tracking (in-memory is fine for simple agents).

Optional:

  • Send explicit task_response for long-running tasks.
  • Send task_update messages with progress for long tasks.
  • Implement task timeouts.
  • Use persistent storage for task history and audit trails.

Simplicity Benefit: By removing complex state transitions, implementation becomes significantly simpler while still handling the vast majority of use cases effectively.

Task Tracking: maintain basic task state tracking to handle duplicate requests and provide status queries if needed.