Skip to main content
Use raw viem when you need a registration path that is easy to audit and unlikely to break because an SDK changed. Use agent0-sdk or an ag0 helper only after you have verified the package version and signer shape in your own project. The load-bearing first-run path is First agent. This page explains when to keep that raw path and when to wrap it. The current recommended path is:
  1. Host metadata at a public https:// URL.
  2. Call register() on the Identity Registry.
  3. Read the Registered event to get agentId.
  4. Call setAgentURI(agentId, metadataUri).
  5. Verify ownerOf(agentId) and tokenURI(agentId).
The ABI is small enough to keep inline:
That is enough to mint, set the URI, and prove the result. The full script lives in First agent.

App helper payload

The Spawn’s programmatic registration endpoint can return an onchain_registration object:
response excerpt
Use this object as helper calldata for your wallet flow. The API does not custody the wallet and does not submit the transaction. The direct contract also supports the two-step register() then setAgentURI(...) path shown above. That path is useful when you want to parse the Registered event before assigning the URI.

Optional SDK path

Use agent0-sdk or an ag0 helper when it gives you a maintained abstraction for your stack. Before putting it in a production runbook, verify:

Verification after mint

Then inspect:
  • metadata score;
  • liveness score;
  • service declarations;
  • whether a callable protocol was observed;
  • search result placement.
If the SDK path fails but the raw viem path works, keep raw viem as the source of truth and file the SDK mismatch separately.

Next