How agent-network-protocol/agentconnect works
Project type and purpose
• AgentConnect is an open-source, cross-language (Python + Java) library implementing the Agent Network Protocol (ANP).
• Its goal is to provide three core capabilities—DID-based authentication & end-to-end encryption, meta-protocol negotiation (via LLMs), and an application-layer protocol integration framework—so that autonomous “agents” can discover, authenticate, negotiate and communicate with each other over HTTP or WebSockets.
Main components (three layers + supporting modules)
A. Authentication & E2E Encryption Layer
• DID management (generation, verification, resolvers)
• Authentication headers (did:wba, DIDAll)
• Crypto primitives (ECDHE, Ed25519, Secp256k1)
B. Meta-Protocol Layer
• Protocol negotiator (uses Azure OpenAI under the hood)
• Code generators (provider/requester)
• Protocol container and runner
C. Application-Layer Protocol Framework
• Protocol definitions (JSON, Markdown)
• Loader/unloader/config manager
• Base classes for providers/requesters
D. Simple Node & Transport
• WebSocket client/server wrappers (wss_message_sdk, simple_node)
• Message generation & short-term key exchange
E. Utilities & Tooling
• CryptoTool, DIDGenerator, DIDVerifier
• LLM output processor
• Logging base classes
F. Language SDKs & Examples
• Python package (agent_connect/python/…)
• Java package (agent_connect/java/…)
• CLI tool: DID document generator (tools/did_generater)
• Demos (examples/*) and tests (tests/*)
G. External Dependencies
• Azure OpenAI API (for meta-protocol negotiation)
• DID:wba test server (for HTTP-based DID authentication)
Relationships & data flows
• Agent SDK ⇄ DID Server: fetch/store DID documents (HTTP)
• Agent SDK (auth module) ⇄ Peer Agent SDK: authenticate requests over HTTP or WSS
• Auth module ⇒ produces secure channel for Meta-Protocol negotiation
• Meta-Protocol negotiator ⇄ Azure OpenAI: exchange prompts & get code snippets
• Generated code loaded by App-Protocol framework ⇒ drives protocol-specific messaging
• Simple Node transports messages (WebSocket/WSS) using agreed protocol
Architectural Patterns & Principles
• Layered architecture: clear separation of auth, meta-protocol and application layers
• Plugin/loader pattern in App-Protocol: runtime loading/unloading of protocol modules
• Generator pattern in meta-protocol: code generation via LLMs
• Adapter pattern in multiple SDKs: unify Python and Java interfaces to core modules
• Use of standard DID and crypto specs (W3C DID, ECDHE, Ed25519)
Key technologies & frameworks
• Python: asyncio, websockets, requests, cryptography, openai SDK
• Java: Maven, logback, okhttp (in tests), JUnit
• DID standards: did:wba, DIDAll
• E2E crypto: ECDHE, Ed25519, Secp256k1
• JSON/Markdown for protocol specs
• Azure OpenAI for meta-protocol negotiation