Terminal-based agent registration and deregistration workflows
Self Agent ID includes a cross-language CLI for registering and deregistering agents from the terminal. Available in TypeScript, Python, and Rust with identical command surfaces.
Install
npminstall-g@selfxyz/agent-sdk# or use npx:npx@selfxyz/agent-sdkregisterinit...
pipinstallselfxyz-agent-sdk# Then use:self-agentregisterinit...
cargoinstallself-agent-sdk# Then use:self-agentregisterinit...
Registration Flow
The CLI uses a browser handoff pattern: the terminal creates a session, generates a URL, and the user completes the Self proof in their browser.
The default network is mainnet, which requires a real passport scanned via the Self app. Use --network testnet for development — testnet also requires the Self app, but you can generate mock documents within the app instead of using a real passport.
Step 2: Open Browser Handoff
Opens the handoff URL in the default browser. The user scans the QR code with the Self app.
Step 3: Wait for Completion
Polls the registration status until the Hub V2 callback confirms verification.
Step 4: Check Status
Returns the current session state (pending, verified, failed).
Step 5: Export Credentials
Outputs the agent address, agent key (bytes32), agent ID, and private key for use in your agent's environment.
Deregistration Flow
Ed25519 Registration
For agents that use Ed25519 keys instead of Ethereum wallets. Two modes are available:
Standalone Ed25519
Register an agent identified solely by its Ed25519 public key:
Ed25519 Linked to Human
Register an Ed25519 agent linked to a human's Ethereum address:
The --ed25519-signature is a hex-encoded signature over the session challenge, proving ownership of the Ed25519 private key. The --ed25519-pubkey is the hex-encoded 32-byte public key.
After init, the remaining steps (open, wait, status, export) are identical to the standard registration flow.
Agent-Guided Flow (Recommended)
For automated onboarding, your backend or agent runtime orchestrates the CLI commands and sends the handoff URL to the user:
Backend calls register init and stores session state
Backend calls register open and forwards URL to user UI
User completes browser proof flow
Backend runs register wait and records the returned lifecycle state
The agent-guided flow is the recommended integration pattern for services that onboard users programmatically. The CLI handles all the complexity of session management and proof verification.