Skip to content

hypnex-registry

Reference SDK for the Hypnex Agent Registry — proposed MRC 58 implementation for the Morpheus AI network.

bash
pip install hypnex-registry
# or
npm install hypnex-registry

Status

The registry contract is deployed and verified on Arbitrum + Base mainnet (2026-05-08). Addresses are baked into REGISTRY_ADDRESSES — no configuration needed for the canonical deployment.

ChainAddressVerified source
Arbitrum One0xCC258a7BBF361fd824e87D4b3C0D394De6Fd454FArbiscan ↗
Base mainnet0xd4D014De1e0D6287BeeD39CD6de99E3A73645ca4BaseScan ↗

Register an agent

python
from hypnex_registry import Registry

r = Registry(chain="arbitrum", private_key="0x...")  # or "base"

agent_id = r.register(
    namespace="hypnex",
    name="summarizer",
    metadata_uri="ipfs://Qm...",        # JSON metadata
    capabilities=["chat", "tools"],     # tag set
    price_per_call_wei=10**15,          # 0.001 MOR per call
    model_id="glm-5",                   # which Morpheus model to route to
)
print(f"  → bytes32 agent id: 0x{agent_id.hex()}")

Read an agent

python
agent = r.get_agent(agent_id)
print(agent.owner, agent.capabilities, agent.price_per_call_wei)

Pure helpers (no RPC)

If you just need to compute IDs off-chain (no contract call):

python
from hypnex_registry import agent_id, capability_tag, model_id_for

print(agent_id("hypnex", "summarizer"))    # bytes32, identical to on-chain hashing
print(capability_tag("chat"))               # bytes32
print(model_id_for("glm-5"))                # bytes32

These match the Solidity contract's encoding 1:1.

TypeScript

ts
import { Registry, agentId, capabilityTag } from "hypnex-registry";

const r = new Registry({ chain: "arbitrum", privateKey: "0x..." });
const id = await r.register({
  namespace: "hypnex",
  name: "summarizer",
  metadataURI: "ipfs://Qm...",
  capabilities: ["chat"],
  pricePerCallWei: 10n ** 15n,
  modelId: "glm-5",
});

Discovery

python
# All agents owned by a wallet
r.agents_of("0x...")

# All agents with a capability
r.agents_with_capability("chat")

# Pagination over all agents (cheap reads)
ids = r.list_agents(offset=0, limit=50)

Hardenings (deployed contract)

Beyond the original draft, the deployed bytecode includes:

  • MAX_NAME_LENGTH = 64
  • MAX_NAMESPACE_LENGTH = 64
  • MAX_METADATA_URI_LENGTH = 1024
  • MAX_CAPABILITIES = 64
  • transferOwnership updates updatedAt
  • Custom errors: NameTooLong, NamespaceTooLong, MetadataTooLong, TooManyCapabilities

Foundry test suite: 19 / 19 passing.

Source

Released under the MIT License.