Skip to main content

An SDK that enables agents to connect with each other, allowing them to perform identity authentication, end-to-end encrypted communication, automatic protocol negotiation based on LLMs, and efficient data exchange.

Project description

AgentConnect

What is AgentConnect

AgentConnect is an open-source SDK implementation of the Agent Network Protocol (ANP).

The goal of Agent Network Protocol (ANP) is to become the HTTP of the Intelligent Agent Internet Era, building an open, secure, and efficient collaborative network for billions of intelligent agents.

Agentic Web

Core Modules

Authentication

Agent identity authentication system based on DID-WBA (Decentralized Identifier - Web-Based Authentication):

  • Identity Management: Create and manage agent DID documents
  • Identity Verification: Provide end-to-end identity authentication and authorization
  • Secure Communication: Ensure security and trustworthiness of inter-agent communication

ANP Crawler (Agent Discovery & Interaction)

Discovery and interaction tools for the agent network:

  • Agent Discovery: Automatically discover and parse agent description documents
  • Interface Parsing: Parse JSON-RPC interfaces and convert them to callable tools
  • Protocol Interaction: Support communication with agents that comply with ANP protocol
  • Direct JSON-RPC: Execute JSON-RPC requests directly without interface discovery

FastANP (Fast Development Framework)

Plugin-based framework for building ANP agents with FastAPI:

  • Plugin Architecture: FastAPI as main framework, FastANP as helper plugin
  • Automatic OpenRPC: Generate OpenRPC documents from Python functions
  • Context Injection: Automatic session and Request object injection
  • DID WBA Authentication: Built-in authentication middleware with wildcard path exemption
  • Flexible Routing: Full control over all routes including ad.json
  • Session Management: Built-in session management based on DID

For complete documentation, see FastANP README

Usage

Option 1: Install via pip

pip install agent-connect

Option 2: Source Installation (Recommended for Developers)

# 下载源码
git clone https://github.com/agent-network-protocol/AgentConnect.git
cd AgentConnect

# 使用UV配置环境
uv sync

# 运行示例
uv run python examples/python/did_wba_examples/create_did_document.py

Example Demonstration

DID-WBA Authentication Example

Location: examples/python/did_wba_examples/

Main Examples

  • Create DID Document (create_did_document.py)
    Demonstrate how to generate DID documents and key pairs for agents

  • Authenticate and Verify (authenticate_and_verify.py)
    Demonstrate the complete DID-WBA authentication and verification process

Running Examples

# Create DID Document
uv run python examples/python/did_wba_examples/create_did_document.py

# Authentication Demonstration
uv run python examples/python/did_wba_examples/authenticate_and_verify.py

Detailed Documentation: DID-WBA Example

ANP Crawler Agent Interaction Example

Location: examples/python/anp_crawler_examples/

Main Examples

  • Simple Example (simple_amap_example.py)
    Quick Start: Connect to AMAP service and call the map search interface

  • Complete Example (amap_crawler_example.py)
    Complete Demonstration: Agent discovery, interface parsing, and tool calling

Running Examples

# Quick Experience
uv run python examples/python/anp_crawler_examples/simple_amap_example.py

# Complete Function Demonstration
uv run python examples/python/anp_crawler_examples/amap_crawler_example.py

Detailed Documentation: ANP Crawler Example

FastANP Agent Development Example

Location: examples/python/fastanp_examples/

Main Examples

  • Simple Agent (simple_agent.py) Minimal FastANP setup with single interface method

  • Hotel Booking Agent (hotel_booking_agent.py) Complete example with multiple interfaces, Pydantic models, and session management

Running Examples

# Simple Agent
uv run python examples/python/fastanp_examples/simple_agent.py

# Hotel Booking Agent
uv run python examples/python/fastanp_examples/hotel_booking_agent.py

Testing Examples

# Test with Python client
uv run python examples/python/fastanp_examples/test_hotel_booking_client.py

# Or test manually with curl
# Get Agent Description
curl http://localhost:8000/ad.json | jq

# Call JSON-RPC method
curl -X POST http://localhost:8000/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "search_rooms", "params": {"query": {"check_in_date": "2025-01-01", "check_out_date": "2025-01-05", "guest_count": 2, "room_type": "deluxe"}}}'

Detailed Documentation: FastANP Examples

Tool Recommendations

ANP Network Explorer Tool

Use the web interface to explore the agent network using natural language: ANP Network Explorer Tool

DID Document Generator Tool

Command line tool to quickly generate DID documents:

uv run python tools/did_generater/generate_did_doc.py <did> [--agent-description-url URL]

Contact Us

License

This project is open-sourced under the MIT License. Detailed information please refer to LICENSE file.


Copyright (c) 2024 GaoWei Chang

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anp-0.4.3.tar.gz (19.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anp-0.4.3-py3-none-any.whl (155.6 kB view details)

Uploaded Python 3

File details

Details for the file anp-0.4.3.tar.gz.

File metadata

  • Download URL: anp-0.4.3.tar.gz
  • Upload date:
  • Size: 19.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.4

File hashes

Hashes for anp-0.4.3.tar.gz
Algorithm Hash digest
SHA256 9f943577d89c8a937a659e5d8dd402df8e2ef6de7cf3aa8d82c486a882f7b01c
MD5 e181fe8f4848693f1097c8470c46e0a1
BLAKE2b-256 6b073a0a98bf284dd0398a82612f88dca260f5ca1c9f8067ac87403ea46c8b92

See more details on using hashes here.

File details

Details for the file anp-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: anp-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 155.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.4

File hashes

Hashes for anp-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 11b917066e767f04448f0ce6008c78841390ff80b84bec5f929edd629627a74e
MD5 b71cdb63066633f645218097b6f2ff9e
BLAKE2b-256 cc737ffbff85a2cbbf17ea3426d95477e9c85ee334747bd1014a9e5237bf88a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page