Skip to content

RFC-013: Inter-Gandalf Delegation Protocol (IMDP) — 6. Protocol Messages

AIGP SpecificationRFC-013: Inter-Gandalf Delegation Protocol (IMDP) › 6. Protocol Messages

← 5. Delegation Flow · Section index · 7. Governance →

6. Protocol Messages

All IMDP messages use HMAC-SHA256 authentication (RFC-010 4) and carry standard AIGP headers.

6.1 CAPABILITY_QUERY

Sent by the originator to discover a delegate’s capabilities before delegating.

GET /imdp/v1/capabilities
Headers:
X-AIGP-Signature: hmac-sha256={signature}
X-AIGP-Timestamp: {iso_timestamp}
X-AIGP-App-Id: {originator_app_id}
X-IMDP-Request-Id: {delegation_request_id}

Response: Capability manifest (4.2).

The originator MAY query multiple candidates and select the best match.

6.2 DELEGATE

Sent by the originator to request task execution from a delegate.

POST /imdp/v1/delegate
Headers:
X-AIGP-Signature: hmac-sha256={signature}
X-AIGP-Timestamp: {iso_timestamp}
X-AIGP-App-Id: {originator_app_id}
X-IMDP-Request-Id: {delegation_request_id}
X-IMDP-Delegation-Depth: {current_depth}
Content-Type: application/json
Body:
{
"protocol_version": "1",
"message_type": "DELEGATE",
"delegation_id": "del-1714900000000-abc",
"originator": "identity-service",
"delegate": "analytics-service",
"capability_id": "policy_conversion",
"delegation_depth": 1,
"max_execution_seconds": 120,
"context": {
"assembled_by": "identity-service",
"acp_sources": [
{
"provider": "identity-service",
"context_type": "source_policies",
"schema_version": "1.0"
}
],
"payload": { ... }
},
"callback_url": "https://scim-prj.your-identity-service.com/imdp/v1/result",
"timeout_seconds": 120
}

Key fields:

Field Description
delegation_id Unique identifier for this delegation chain
originator The Gandalf that owns the user interaction
delegate The Gandalf being asked to execute
capability_id The specific capability being invoked
delegation_depth Current depth (1 = first delegation, 2 = sub-delegation)
context ACP-assembled context payload
callback_url Where to send the result (async pattern)
timeout_seconds Max time before the originator considers the delegation failed

6.3 DELEGATE_RESULT

Sent by the delegate back to the originator upon completion.

POST {callback_url}
Headers:
X-AIGP-Signature: hmac-sha256={signature}
X-AIGP-Timestamp: {iso_timestamp}
X-AIGP-App-Id: {delegate_app_id}
X-IMDP-Request-Id: {delegation_request_id}
Content-Type: application/json
Body:
{
"protocol_version": "1",
"message_type": "DELEGATE_RESULT",
"delegation_id": "del-1714900000000-abc",
"delegate": "analytics-service",
"originator": "identity-service",
"capability_id": "policy_conversion",
"status": "SUCCESS",
"duration_ms": 45200,
"result": {
"context_type": "conversion_state",
"schema_version": "1.0",
"data": {
"conversion_id": "conv-20260504-001",
"total_policies": 47,
"converted": 42,
"gaps": 3,
"manual_review": 2,
"confidence_score": 0.89
}
},
"sub_delegations": [],
"tokens": {
"input_tokens": 12400,
"output_tokens": 3200,
"total_tokens": 15600
}
}

Status values:

Status Meaning
SUCCESS Task completed successfully
PARTIAL Task partially completed result contains what was achieved
FAILED Task failed error field contains details
TIMEOUT Delegate did not complete within timeout_seconds
REJECTED Delegate rejected the delegation (capability mismatch, overloaded)

Error response:

{
"protocol_version": "1",
"message_type": "DELEGATE_RESULT",
"delegation_id": "del-1714900000000-abc",
"status": "FAILED",
"error": {
"code": "CAPABILITY_UNAVAILABLE",
"message": "policy_conversion is temporarily unavailable due to upstream dependency",
"retryable": true,
"retry_after_seconds": 60
}
}

← 5. Delegation Flow · Section index · 7. Governance →