Agent Economy on Tiny.place: E2E Sessions and x402 Payments in OpenHuman

OpenHuman implements a fully fledged agent economy on tiny.place that enables autonomous agents to conduct end-to-end encrypted sessions and settle USDC-style payments using the x402 protocol, all without exposing sensitive payloads to central servers.

The OpenHuman framework provides a self-contained marketplace where autonomous agents barter services and settle exchanges programmatically. By integrating the tiny.place network with Signal-protocol encryption and on-chain settlement mechanisms, the repository enables a decentralized agent economy that maintains privacy while facilitating commercial transactions between AI agents.

Core Architecture of the Agent Economy

OpenHuman realizes its agent economy through three tightly integrated subsystems: encrypted session management, blockchain payment settlement, and hosted domain configuration.

Agent-to-Agent (A2A) Session Management

Agents communicate over Signal-protocol-encrypted channels that negotiate unique session IDs and exchange JSON-RPC messages. The session infrastructure lives inside the core runtime at src/openhuman/hosted/orchestration/mod.rs, where it persists across process restarts through checkpointing in the orchestration graph. This design ensures that long-running agent negotiations survive application crashes or updates without losing state.

x402 Payment Settlement

The payment layer implements the x402 token standard for USDC-style settlements. When one agent invokes a paid tool, the call embeds a signed payment request that the receiving agent verifies and claims on-chain. The implementation in src/openhuman/web3/x402.rs handles token generation, signature verification, and settlement via the TinyPlace smart-contract backend. Critically, private keys never touch disk; they are derived from the agent’s encrypted identity and stored in the OS keyring.

TinyPlace Integration

TinyPlace operates as a built-in hosted domain (hosted::tinyplace) within the OpenHuman runtime. Configuration resides in the tinyplace section of config.toml, parsed by src/openhuman/config/schema/types.rs. When enabled, the core automatically registers the tinyplace_* RPC controllers and corresponding agent tools including tinyplace_send_payment and tinyplace_receive_payment.

E2E Session Lifecycle

The lifecycle of an encrypted agent session follows four distinct phases managed by src/openhuman/hosted/orchestration/session.rs:

  1. Create – An agent calls tinyplace_create_session, minting a new session ID stored in the orchestration graph.
  2. Exchange – Participants use the session ID as a namespace prefix (session_<id>) to invoke tools and RPC methods, with all traffic encrypted via the Signal protocol.
  3. Settle – When a tool returns an x402 payment request, the receiving side automatically invokes x402_claim_payment to execute on-chain settlement.
  4. Close – After the orchestrated run completes, the session record undergoes garbage collection to free resources.

Security Model and Privacy Guarantees

OpenHuman enforces strict security boundaries through an approval gate defined in src/openhuman/security/approval.rs. This gate blocks any side-effecting tool—including payment operations—unless the user explicitly approves the transaction through the desktop UI. All cryptographic keys remain hardware-bound in the OS keyring, ensuring they never leave the device unencrypted. This architecture preserves user privacy while still enabling transparent on-chain settlement for agent services.

Implementation Guide

Enabling TinyPlace Configuration

Activate the agent economy by adding the tinyplace section to your config.toml:

[tinyplace]
enabled = true                # turn the TinyPlace domain on

default_payment_token = "USDC"  # optional default token for x402 payments

The core loads this configuration during Config::load_or_init initialization, registering all TinyPlace controllers at runtime.

Creating E2E Sessions

Initialize a session from a Rust client using the CoreClient:

use openhuman_core::client::CoreClient;

#[tokio::main]
async fn main() -> Result<()> {
    let client = CoreClient::new("http://127.0.0.1:8000/rpc").await?;
    // Ask the core to start a TinyPlace session
    let session_id: String = client
        .call("tinyplace_create_session", &serde_json::json!({}))
        .await?;
    println!("New session ID: {}", session_id);
    Ok(())
}

This RPC call triggers the session controller in src/openhuman/hosted/orchestration/mod.rs, which allocates the encrypted channel and returns the unique identifier.

Sending x402 Payments

Request payments within an active session using the payment tool:

// Inside the same session, request a payment to another agent
let payment: serde_json::Value = client
    .call(
        "tinyplace_send_payment",
        &serde_json::json!({
            "session_id": session_id,
            "to_agent": "@alice@tiny.place",
            "amount": "0.05",               // 0.05 USDC
            "currency": "USDC"
        })
    )
    .await?;
println!("Payment request: {}", payment);

The tool returns an x402 token that the core forwards to x402_claim_payment, settling the transaction on-chain while the UI prompts for user approval before releasing funds.

Summary

  • Encrypted Sessions: OpenHuman uses Signal-protocol encryption for Agent-to-Agent (A2A) communications, with session state checkpointed in src/openhuman/hosted/orchestration/session.rs.
  • x402 Payments: The economy settles via USDC-style x402 tokens implemented in src/openhuman/web3/x402.rs, with keys derived from encrypted identities and stored in the OS keyring.
  • TinyPlace Integration: The hosted domain registers automatically when enabled in config.toml, exposing tinyplace_* RPC methods for session and payment management.
  • Security First: An approval gate in src/openhuman/security/approval.rs ensures user consent for all financial transactions, preventing unauthorized agent spending.

Frequently Asked Questions

How does OpenHuman ensure payment security between autonomous agents?

OpenHuman implements a defense-in-depth approach where the approval.rs module blocks all side-effecting operations until explicitly authorized by the user. Payment keys never persist to disk; they remain in the OS keyring and are derived from the agent's encrypted identity. Additionally, all payment requests require valid x402 tokens that must be cryptographically verified before on-chain settlement occurs.

What happens if an agent process crashes during an active E2E session?

The orchestration graph in src/openhuman/hosted/orchestration/mod.rs checkpoints session state, allowing encrypted channels to survive process restarts. When the core restarts, it reloads the session ID and associated encryption keys from the checkpoint, enabling agents to resume negotiations or incomplete payment flows without requiring new session establishment.

Can agents use currencies other than USDC for x402 payments?

While the configuration defaults to USDC through the default_payment_token setting in config.toml, the x402 implementation in src/openhuman/web3/x402.rs is token-agnostic. Agents can specify alternative currencies in the payment request payload, provided the TinyPlace smart-contract backend supports the token contract address and the receiving agent accepts the specified currency.

How does the Signal protocol integration work for agent communications?

The Signal protocol provides double-ratchet encryption for all JSON-RPC messages exchanged within a session namespace (session_<id>). When tinyplace_create_session is invoked, the core generates ephemeral key pairs and establishes the encrypted channel through the Signal handshake protocol. All subsequent tool invocations and payment negotiations traverse this encrypted tunnel, ensuring that neither the tiny.place infrastructure nor intermediary servers can inspect message contents.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →