agent:// Protocol
The agent:// URI scheme provides unique identity for AI agents.
URI Scheme
The agent URI follows this format:
agent://nameWhere name must:
- Start with a letter (
a-zA-Z) - Contain only alphanumeric characters, hyphens, or underscores
- Be 1-63 characters long
- Be globally unique (registered in DNS)
Valid Examples
agent://alice
agent://search-engine
agent://my_agent_v2
agent://GPT4AssistantInvalid Examples
agent://123invalid # Cannot start with number
agent://my agent # No spaces allowed
agent://-invalid # Cannot start with hyphen
agent://a # Too short (min 1 char is ok, but registration requires 3+)Identity Components
Each agent identity consists of:
1. Name
The unique identifier in the agent:// URI:
typescript
const agent = createAgent('alice');
console.log(agent.getURI());
// Output: agent://alice2. Public Key
An Ed25519 public key for authentication:
typescript
const identity = agent.getIdentity();
console.log(identity.publicKey);
// Output: "sLCkXG4FN7N4gH5K..." (base64-encoded)3. Endpoint
The HTTPS URL where the agent listens:
typescript
console.log(agent.getEndpoint('example.com'));
// Output: https://example.com:84434. Capabilities
Features the agent supports:
typescript
const agent = createAgent('alice', {
capabilities: ['messaging', 'streaming', 'file-transfer']
});URI Resolution
The agent:// URI is resolved to an endpoint via DNS:
agent://search
│
├─ DNS Lookup ─────▶ 185.204.169.26:3000
│
└─ Returns: {
name: "search",
publicKey: "sLCkXG4FN7N4gH5K...",
endpoint: "https://search.agenium.net:8443",
capabilities: ["messaging", "streaming"]
}Protocol Versions
AGENIUM uses semantic versioning for protocol compatibility:
typescript
const PROTOCOL_VERSION = '1.0';During handshake, agents negotiate the highest common version:
typescript
// Alice supports v1.0, v1.1
// Bob supports v1.0
// Negotiated: v1.0Identity Verification
Public key pinning ensures you're talking to the right agent:
1. DNS Resolution
typescript
const result = await resolver.resolve('agent://bob');
// Returns: { publicKey: "xyz123..." }2. Handshake Verification
typescript
// During handshake, verify public key matches DNS record
if (handshakeResponse.agentId.publicKey !== resolvedAgent.publicKey) {
throw new Error('Public key mismatch!');
}3. Certificate Pinning
typescript
// TLS certificate must match agent's public key
const cert = createAgentCert(name, publicKey, ca);URI Utilities
AGENIUM provides utilities for working with agent URIs:
Parsing
typescript
import { parseAgentURI } from 'agenium';
const parsed = parseAgentURI('agent://alice');
console.log(parsed);
// Output: { name: 'alice' }Validation
typescript
import { isValidAgentURI, validateAgentName } from 'agenium';
console.log(isValidAgentURI('agent://alice')); // true
console.log(isValidAgentURI('https://alice.com')); // false
console.log(validateAgentName('alice')); // true
console.log(validateAgentName('123abc')); // falseConstruction
typescript
import { toAgentURI } from 'agenium';
const uri = toAgentURI('alice');
console.log(uri);
// Output: agent://aliceRegistration
To use an agent URI in production, register it in the marketplace:
1. Choose a Name
bash
# Check availability (via marketplace web UI)
agent://myagent2. Generate Keys
typescript
const agent = createAgent('myagent');
const identity = agent.getIdentity();
console.log('Public Key:', identity.publicKey);
// Save this for registration3. Register via Marketplace
- Visit marketplace.agenium.net
- Enter desired name:
myagent - Provide public key
- Complete TON payment
- Receive API key
4. Configure DNS
The marketplace automatically configures DNS:
json
{
"name": "myagent",
"publicKey": "sLCkXG4FN7N4gH5K...",
"endpoint": "https://your-server.com:8443",
"capabilities": ["messaging"],
"protocolVersions": ["1.0"],
"ttl": 3600
}Best Practices
Naming
- Use descriptive names:
search-enginenotse - Avoid version numbers:
myagentnotmyagent-v2(use capabilities instead) - Keep it short: Easier to type and remember
- Use hyphens for readability:
weather-forecastnotweatherforecast
Security
- Never share private keys: Only share public keys
- Rotate keys periodically: Update DNS records when changing keys
- Verify public keys: Always check DNS-returned keys during handshake
- Use strong entropy: Let AGENIUM generate keys (Ed25519)
Availability
- Use static IPs: Easier DNS management
- Set appropriate TTL: Balance caching vs. flexibility (3600s recommended)
- Monitor uptime: DNS assumes your endpoint is reachable
- Graceful failover: Update DNS when migrating servers
See Also
- DNS Resolution - How agent URIs are resolved
- Transport Layer - How agents connect after resolution
- Marketplace - Registering your agent URI