Use Cases
Let agents trade any asset. On any chain.
AI agents need to move value across chains — rebalance portfolios, execute DeFi strategies, settle payments, access yield. Hypermid's REST API gives agents the tools to quote, execute, and track cross-chain swaps programmatically across 90+ blockchains.
The problem
AI agents operating in DeFi need to move tokens between chains. Yield optimization requires rebalancing across 5+ chains. Arbitrage opportunities span multiple DEXes on different networks. Portfolio management means consolidating positions across ecosystems.
- SDK sprawl: Current solutions require integrating multiple bridge SDKs, each with different data formats, authentication schemes, and status APIs. That means more dependencies and more bug surface area for autonomous systems.
- Non-deterministic responses: Many bridge APIs return inconsistent response shapes depending on the route. Agents need predictable, parseable responses to make autonomous decisions.
- Failure handling: When a bridge transaction fails, the agent needs to know immediately and have a clear fallback path. Most bridge APIs lack standardized error handling.
- Chain coverage gaps: No single bridge covers all chains. Agents that need to reach PulseChain, newer L2s, or niche chains are stuck building custom integrations for each.
How Hypermid solves it
A single REST API designed for programmatic access. Deterministic responses, standardized errors, and 90+ chains including PulseChain.
Quote, execute, and track swaps across 90+ blockchains with a single REST endpoint. No chain-specific logic required in your agent code.
Every API response follows the same schema regardless of route or chain. Agents can parse responses reliably without conditional logic per bridge.
Access chains that other aggregators miss. PulseChain, emerging L2s, and niche ecosystems are all reachable through the same API.
Poll a single status endpoint for any transaction. Get deterministic state transitions: PENDING, EXECUTING, COMPLETED, or FAILED.
When a route fails, the API returns structured error data with alternative routes. Agents can automatically retry with a different path without human intervention.
Agent integration pattern
A typical agent integration follows four steps: get a quote, evaluate parameters, execute the swap, and track completion. The example below shows the full flow in Python.
import requests
HYPERMID_API = "https://api.hypermid.io/v1"
API_KEY = os.environ["HYPERMID_API_KEY"]
def cross_chain_swap(
from_chain: str,
to_chain: str,
from_token: str,
to_token: str,
amount: str,
wallet: str,
) -> dict:
"""Execute a cross-chain swap with quote evaluation and status tracking."""
# Step 1: Get a quote
quote = requests.post(
f"{HYPERMID_API}/quote",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"fromChain": from_chain,
"toChain": to_chain,
"fromToken": from_token,
"toToken": to_token,
"amount": amount,
"fromAddress": wallet,
},
).json()
# Step 2: Evaluate the quote
slippage = float(quote["slippage"])
if slippage > 0.03:
return {"status": "rejected", "reason": f"Slippage too high: {slippage}"}
# Step 3: Execute the swap
execution = requests.post(
f"{HYPERMID_API}/execute",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"quoteId": quote["id"], "signer": wallet},
).json()
# Step 4: Track until completion
while True:
status = requests.get(
f"{HYPERMID_API}/status/{execution['txId']}",
headers={"Authorization": f"Bearer {API_KEY}"},
).json()
if status["state"] in ("COMPLETED", "FAILED"):
return status
time.sleep(5)Use cases for agents
- Yield farming: Agents monitor yield rates across chains and move funds to the highest-return opportunities automatically. Rebalance positions as rates shift.
- Arbitrage: Detect price discrepancies across DEXes on different chains. Execute cross-chain swaps to capture spreads before they close.
- Portfolio rebalancing: Maintain target allocations across chains. When positions drift, agents rebalance by swapping assets cross-chain to restore targets.
- Dollar-cost averaging: Schedule recurring cross-chain swaps to build positions over time. Buy ETH on the cheapest chain automatically on a set schedule.
- Payment agents: Process payments on behalf of merchants. Accept any token on any chain and settle in the merchant's preferred currency and chain.
- Liquidation bots: Monitor lending positions across chains. When liquidation thresholds are hit, move capital cross-chain to execute liquidations where they are most profitable.
Why REST over SDK
AI agents benefit from REST APIs over native SDKs. Here is why Hypermid chose REST-first for agent integrations.
- Stateless: Every request is self-contained. No connection state, no session management, no socket lifecycle to handle. Agents can retry any request without side effects.
- Idempotent: Quote and status endpoints are safe to call repeatedly. Execution endpoints use idempotency keys to prevent duplicate transactions when agents retry.
- Language-agnostic: Python, TypeScript, Rust, Go — any language with an HTTP client can integrate Hypermid. No SDK dependency means no version conflicts and no supply-chain risk.
- Rate-limit friendly: Standard HTTP rate limiting with clear headers. Agents can implement backoff strategies using standard HTTP semantics without SDK-specific throttling logic.
Ready to integrate?
Start building with Hypermid's cross-chain infrastructure today.