Tempo Integration

Agent History integrates with the MCP payment protocol, allowing AI agents to pay for memory operations using tempo request.

What is Tempo?

Tempo is a CLI tool that enables AI agents to make HTTP requests with automatic payment handling. It discovers service pricing, creates payment sessions, and includes payment credentials in requests.

Service Discovery

Agent History exposes its pricing information at /.well-known/mcp.json:

curl https://agenthistory.ai/.well-known/mcp.json

Basic Usage

Use tempo request instead of curl to automatically handle payments:

Create an Agent

# Create a new agent (free operation)
tempo request -X POST \
  --json '{"name": "MyAgent", "mode": "cloud"}' \
  https://agenthistory.ai/api/v1/agents

Response:

{
  "success": true,
  "data": {
    "agentKey": "aht_live_...",
    "recordId": "rec_01jx8a7qz2...",
    "walletAddress": "0x...",
    "mode": "cloud"
  }
}

Store a Memory

# Store a fact ($0.05)
tempo request -X POST \
  --json '{
    "content": "User prefers dark mode and concise responses",
    "type": "fact"
  }' \
  https://agenthistory.ai/api/v1/records/rec_xxx/remember

Search Memories

# Semantic search ($0.05)
tempo request -X POST \
  --json '{
    "query": "what are the user preferences?",
    "limit": 5
  }' \
  https://agenthistory.ai/api/v1/records/rec_xxx/recall

Read a File

# Read file ($0.05)
tempo request \
  "https://agenthistory.ai/api/v1/records/rec_xxx/read?path=config/settings"

Write a File

# Write file ($0.05)
tempo request -X POST \
  --json '{
    "path": "config/settings",
    "content": "{\"theme\": \"dark\"}"
  }' \
  https://agenthistory.ai/api/v1/records/rec_xxx/write

Get Full Context

# Get all memories by type ($0.05)
tempo request \
  https://agenthistory.ai/api/v1/records/rec_xxx/context

Payment Modes

Session-Based Payments

For multiple operations, tempo creates a payment session with a pre-authorized amount. This reduces overhead for frequent requests.

# tempo automatically manages sessions for efficiency
tempo request -X POST --json '{"content": "Memory 1"}' \
  https://agenthistory.ai/api/v1/records/rec_xxx/remember

tempo request -X POST --json '{"content": "Memory 2"}' \
  https://agenthistory.ai/api/v1/records/rec_xxx/remember

# Both requests use the same payment session

Direct Charge

For one-off operations, tempo makes direct charges without session overhead.


Example Workflows

Agent Onboarding

#!/bin/bash
# Complete agent onboarding workflow

# 1. Create the agent
RESPONSE=$(tempo request -X POST \
  --json '{"name": "MyAssistant", "mode": "cloud"}' \
  https://agenthistory.ai/api/v1/agents)

RECORD_ID=$(echo $RESPONSE | jq -r '.data.recordId')

# 2. Store initial identity
tempo request -X POST \
  --json '{
    "content": "I am a helpful coding assistant. I prefer concise responses.",
    "type": "identity"
  }' \
  "https://agenthistory.ai/api/v1/records/$RECORD_ID/remember"

# 3. Store initial skills
tempo request -X POST \
  --json '{
    "content": "I can help with TypeScript, React, and Node.js development.",
    "type": "skill"
  }' \
  "https://agenthistory.ai/api/v1/records/$RECORD_ID/remember"

echo "Agent created with record: $RECORD_ID"

Context Loading

#!/bin/bash
# Load agent context at start of conversation

RECORD_ID="rec_01jx8a7qz2..."

# Get full context for system prompt
CONTEXT=$(tempo request \
  "https://agenthistory.ai/api/v1/records/$RECORD_ID/context")

echo "Identity: $(echo $CONTEXT | jq '.data.identity')"
echo "Skills: $(echo $CONTEXT | jq '.data.skill')"

Memory Update Flow

#!/bin/bash
# Update memories after conversation

RECORD_ID="rec_01jx8a7qz2..."

# Store new facts learned during conversation
tempo request -X POST \
  --json '{
    "content": "User is working on a Next.js e-commerce project",
    "type": "fact"
  }' \
  "https://agenthistory.ai/api/v1/records/$RECORD_ID/remember"

# Store relationship information
tempo request -X POST \
  --json '{
    "content": "User\'s colleague Sarah handles design reviews",
    "type": "relationship",
    "path": "relationships/sarah"
  }' \
  "https://agenthistory.ai/api/v1/records/$RECORD_ID/remember"

Using with Agent Keys

You can also combine tempo with agent key authentication for hybrid scenarios:

# Use agent key for free operations
curl -X GET https://agenthistory.ai/api/v1/records \
  -H "Authorization: Bearer aht_live_..."

# Use tempo for paid operations (automatic payment)
tempo request -X POST \
  --json '{"query": "user preferences"}' \
  https://agenthistory.ai/api/v1/records/rec_xxx/recall

Pricing with Tempo

Tempo automatically handles payment for these operations:

OperationPricePayment Required
Create AgentFreeNo
Create Record$0.05Yes (on-chain anchor)
List/Get/Update/Delete RecordFreeNo
Recall (Semantic Search)$0.05Yes
Remember (Store Memory)$0.05Yes
Read File$0.05Yes
Write File$0.05Yes
Get Context$0.05Yes

USDC.e Auto-Swap

Don't have pathUSD? No problem. Tempo supports auto-swap from USDC.e. When paying, the protocol automatically swaps USDC.e to pathUSD via Tempo DEX if needed.

Next Steps