Skip to content

AxmeAI/durable-agent-handoff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Durable Agent Handoff

Agent A hands off to Agent B. Agent B crashes. With AXME, Agent B restarts and picks up exactly where it left off.

Agent handoff is simple when both agents run in the same process. But in production, agents run on different machines, crash independently, and lose state on restart. AXME makes every handoff durable - the task survives crashes, network failures, and process restarts.

Alpha - Built with AXME (AXP Intent Protocol). cloud.axme.ai - hello@axme.ai


The Problem

Agent A finishes analysis, hands off to Agent B:

  In-memory handoff (same process):
    result = agent_a.run(data)
    agent_b.run(result)        # works... until it doesn't

  What breaks in production:
    - Agent B is on a different machine (no shared memory)
    - Agent B crashes mid-processing (result lost)
    - Network glitch during handoff (data lost)
    - Agent A finishes at 3 AM, Agent B starts at 9 AM (state lost)
    - No retry, no timeout, no audit trail

The Solution

# Agent A sends result to Agent B via AXME intent
intent_id = client.send_intent({
    "intent_type": "intent.handoff.process.v1",
    "to_agent": "agent://myorg/production/processor",
    "payload": {"analysis_result": result, "handoff_id": "HO-2026-0033"},
})

# AXME guarantees delivery:
# - At-least-once delivery (retries on failure)
# - Durable state (survives crashes)
# - Cross-machine (agents can be anywhere)
# - Audit trail (who handed off what, when)
result = client.wait_for(intent_id)

Quick Start

pip install axme
export AXME_API_KEY="your-key"   # Get one: axme login
from axme import AxmeClient, AxmeClientConfig
import os

client = AxmeClient(AxmeClientConfig(api_key=os.environ["AXME_API_KEY"]))

intent_id = client.send_intent({
    "intent_type": "intent.handoff.analyze.v1",
    "to_agent": "agent://myorg/production/handoff-analyzer",
    "payload": {
        "handoff_id": "HO-2026-0033",
        "data_type": "customer_feedback",
        "records": 1200,
        "target_agent": "processor",
    },
})

print(f"Handoff submitted: {intent_id}")
result = client.wait_for(intent_id)
print(f"Done: {result['status']}")

Before / After

Before: DIY Handoff (fragile)

# Option 1: HTTP call (no retry, no durability)
requests.post("http://agent-b:8000/process", json=result)

# Option 2: Message queue (infrastructure overhead)
celery_app = Celery('agents', broker='redis://...')
@celery_app.task(bind=True, max_retries=3)
def handoff_to_b(self, data):
    try:
        agent_b.process(data)
    except Exception as exc:
        self.retry(exc=exc)

# Either way: no lifecycle tracking, no human checkpoint option,
# no timeout, no audit trail

After: AXME Durable Handoff (4 lines)

intent_id = client.send_intent({
    "intent_type": "intent.handoff.process.v1",
    "to_agent": "agent://myorg/production/processor",
    "payload": result,
})
outcome = client.wait_for(intent_id)

How It Works

+-----------+  send_intent()   +----------------+  deliver    +-----------+
|           | ---------------> |                | ---------> |           |
|  Agent A  |                  |   AXME Cloud   |            |  Agent B  |
|           | <- wait_for() -- |   (platform)   | <- resume  |           |
|           |  gets result     |                |            | processes |
|           |                  | crash? retry!  |            | handoff   |
|           |                  | durable state  |            |           |
+-----------+                  +----------------+            +-----------+

Run the Full Example

Prerequisites

curl -fsSL https://raw.githubusercontent.com/AxmeAI/axme-cli/main/install.sh | sh
axme login
pip install axme

Terminal 1

axme scenarios apply scenario.json

Terminal 2

cat ~/.config/axme/scenario-agents.json | grep -A2 handoff-analyzer-demo
AXME_API_KEY=<agent-key> python agent.py

Verify

axme intents get <intent_id>
# lifecycle_status: COMPLETED

Related


Built with AXME (AXP Intent Protocol).

About

Agent A hands off to Agent B. Agent B crashes. With AXME, Agent B restarts and picks up exactly where it left off.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages