agent-uri
Parser and validator for the agent:// URI scheme, providing topology-independent identity for agents in multi-agent systems.
Overview
Multi-agent systems need a standard way to identify agents that works regardless of where they're deployed. agent-uri solves this by encoding identity, authority, and capabilities into a single URI.
Each URI contains a trust root (who issued it), a capability path (what it can do), and an agent ID using TypeID format (who it is, when it was created). The typestate builder catches construction errors at compile time, and all components validate against the specification on parse.
URI Format
agent://example.com/assistant/chat/llm_chat_01h455vb4pex5vsknk084sn02q?version=1.0#task
└─ trust root ─┘└─ capability path ─┘└───────── agent id ────────┘└─ query ─┘└frag┘
| Component | Description |
|---|---|
| Trust Root | Domain or IP identifying the issuing authority |
| Capability Path | Hierarchical path describing agent capabilities |
| Agent ID | TypeID with semantic prefix + UUIDv7 suffix |
| Query | Optional metadata (version, ttl, attestation) |
| Fragment | Optional semantic annotation |
Installation
[]
= "0.3"
For JSON serialization support:
[]
= { = "0.3", = ["serde"] }
Quick Start
use *;
// Parse an existing URI
let uri = parse.unwrap;
// Access components
println!; // anthropic.com
println!; // assistant/chat
println!; // llm_chat_01h455vb4pex5vsknk084sn02q
println!; // llm_chat
Building URIs
The typestate builder enforces correct construction order at compile time:
use *;
let uri = new
.try_trust_root?
.try_capability_path?
.agent_id // generates fresh UUIDv7
.try_query?
.try_fragment?
.build?;
println!;
// agent://openai.com/tool/code/code_assist_01jj0t8yv4ex3vsknk084sn92a?version=2.0#streaming
The builder requires trust root, capability path, and agent ID in order. Query and fragment are optional at any stage.
Working with Components
Trust Root
let root = parse?;
assert_eq!;
assert_eq!;
// Modify port
let without_port = root.without_port;
Capability Path
let path = parse?;
assert_eq!;
assert!;
// Navigate hierarchy
for segment in path.iter
Agent ID
Agent IDs use TypeID format: a semantic prefix plus a base32-encoded UUIDv7.
// Create new ID (generates UUIDv7 automatically)
let id = new;
println!; // llm_chat_01h455vb4pex5vsknk084sn02q
// Parse existing
let parsed = parse?;
println!; // task_runner
println!; // extracts the UUIDv7
Query and Fragment
let uri = parse?;
// Access query parameters
if let Some = uri.query.version
// Access fragment
if let Some = uri.fragment
// Create modified URI
let updated = uri.with_query;
Features
| Feature | Description |
|---|---|
default |
Core parsing and validation |
serde |
Serialize/deserialize all types |
License
MIT OR Apache-2.0