anp


Nameanp JSON
Version 0.4.5 PyPI version JSON
download
home_pageNone
SummaryAn 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.
upload_time2025-10-27 13:40:50
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords agent authentication communication encryption protocol
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  
[English](README.md) | [中文](README.cn.md)

</div>

# AgentConnect

## What is AgentConnect

AgentConnect is an open-source SDK implementation of the [Agent Network Protocol (ANP)](https://github.com/agent-network-protocol/AgentNetworkProtocol).

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.

<p align="center">
  <img src="/images/agentic-web.png" width="50%" alt="Agentic Web"/>
</p>

## 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](anp/fastanp/README.md)

## Usage

### Option 1: Install via pip
```bash
pip install agent-connect
```

### Option 2: Source Installation (Recommended for Developers)

```bash
# 下载源码
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
```bash
# 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](examples/python/did_wba_examples/README.md)

### 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
```bash
# 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](examples/python/anp_crawler_examples/README.md)

### 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
```bash
# 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
```bash
# 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](examples/python/fastanp_examples/README.md)

## Tool Recommendations

### ANP Network Explorer Tool
Use the web interface to explore the agent network using natural language: [ANP Network Explorer Tool](https://service.agent-network-protocol.com/anp-explorer/)

### DID Document Generator Tool
Command line tool to quickly generate DID documents:
```bash
uv run python tools/did_generater/generate_did_doc.py <did> [--agent-description-url URL]
```

## Contact Us

- **Author**:GaoWei Chang  
- **Email**:chgaowei@gmail.com  
- **Website**:[https://agent-network-protocol.com/](https://agent-network-protocol.com/)  
- **Discord**:[https://discord.gg/sFjBKTY7sB](https://discord.gg/sFjBKTY7sB)  
- **GitHub**:[https://github.com/agent-network-protocol/AgentNetworkProtocol](https://github.com/agent-network-protocol/AgentNetworkProtocol)
- **WeChat**:flow10240

## License

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

---

**Copyright (c) 2024 GaoWei Chang**

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "anp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "agent, authentication, communication, encryption, protocol",
    "author": null,
    "author_email": "changshan <chgaowei@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/fc/32/a9894c9a904c21cc3e691f35f0249b45fe6ff62f8ecb81d234b7ccba74c4/anp-0.4.5.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  \n[English](README.md) | [\u4e2d\u6587](README.cn.md)\n\n</div>\n\n# AgentConnect\n\n## What is AgentConnect\n\nAgentConnect is an open-source SDK implementation of the [Agent Network Protocol (ANP)](https://github.com/agent-network-protocol/AgentNetworkProtocol).\n\nThe 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.\n\n<p align=\"center\">\n  <img src=\"/images/agentic-web.png\" width=\"50%\" alt=\"Agentic Web\"/>\n</p>\n\n## Core Modules\n\n### Authentication\nAgent identity authentication system based on DID-WBA (Decentralized Identifier - Web-Based Authentication):\n- **Identity Management**: Create and manage agent DID documents\n- **Identity Verification**: Provide end-to-end identity authentication and authorization\n- **Secure Communication**: Ensure security and trustworthiness of inter-agent communication\n\n### ANP Crawler (Agent Discovery & Interaction)\nDiscovery and interaction tools for the agent network:\n- **Agent Discovery**: Automatically discover and parse agent description documents\n- **Interface Parsing**: Parse JSON-RPC interfaces and convert them to callable tools\n- **Protocol Interaction**: Support communication with agents that comply with ANP protocol\n- **Direct JSON-RPC**: Execute JSON-RPC requests directly without interface discovery\n\n### FastANP (Fast Development Framework)\nPlugin-based framework for building ANP agents with FastAPI:\n- **Plugin Architecture**: FastAPI as main framework, FastANP as helper plugin\n- **Automatic OpenRPC**: Generate OpenRPC documents from Python functions\n- **Context Injection**: Automatic session and Request object injection\n- **DID WBA Authentication**: Built-in authentication middleware with wildcard path exemption\n- **Flexible Routing**: Full control over all routes including ad.json\n- **Session Management**: Built-in session management based on DID\n\nFor complete documentation, see [FastANP README](anp/fastanp/README.md)\n\n## Usage\n\n### Option 1: Install via pip\n```bash\npip install agent-connect\n```\n\n### Option 2: Source Installation (Recommended for Developers)\n\n```bash\n# \u4e0b\u8f7d\u6e90\u7801\ngit clone https://github.com/agent-network-protocol/AgentConnect.git\ncd AgentConnect\n\n# \u4f7f\u7528UV\u914d\u7f6e\u73af\u5883\nuv sync\n\n# \u8fd0\u884c\u793a\u4f8b\nuv run python examples/python/did_wba_examples/create_did_document.py\n```\n\n## Example Demonstration\n\n### DID-WBA Authentication Example\nLocation: `examples/python/did_wba_examples/`\n\n#### Main Examples\n- **Create DID Document** (`create_did_document.py`)  \n  Demonstrate how to generate DID documents and key pairs for agents\n  \n- **Authenticate and Verify** (`authenticate_and_verify.py`)  \n  Demonstrate the complete DID-WBA authentication and verification process\n\n#### Running Examples\n```bash\n# Create DID Document\nuv run python examples/python/did_wba_examples/create_did_document.py\n\n# Authentication Demonstration\nuv run python examples/python/did_wba_examples/authenticate_and_verify.py\n```\n\n**Detailed Documentation**: [DID-WBA Example](examples/python/did_wba_examples/README.md)\n\n### ANP Crawler Agent Interaction Example\nLocation: `examples/python/anp_crawler_examples/`\n\n#### Main Examples\n- **Simple Example** (`simple_amap_example.py`)  \n  Quick Start: Connect to AMAP service and call the map search interface\n  \n- **Complete Example** (`amap_crawler_example.py`)  \n  Complete Demonstration: Agent discovery, interface parsing, and tool calling\n\n#### Running Examples\n```bash\n# Quick Experience\nuv run python examples/python/anp_crawler_examples/simple_amap_example.py\n\n# Complete Function Demonstration\nuv run python examples/python/anp_crawler_examples/amap_crawler_example.py\n```\n\n**Detailed Documentation**: [ANP Crawler Example](examples/python/anp_crawler_examples/README.md)\n\n### FastANP Agent Development Example\nLocation: `examples/python/fastanp_examples/`\n\n#### Main Examples\n- **Simple Agent** (`simple_agent.py`)\n  Minimal FastANP setup with single interface method\n\n- **Hotel Booking Agent** (`hotel_booking_agent.py`)\n  Complete example with multiple interfaces, Pydantic models, and session management\n\n#### Running Examples\n```bash\n# Simple Agent\nuv run python examples/python/fastanp_examples/simple_agent.py\n\n# Hotel Booking Agent\nuv run python examples/python/fastanp_examples/hotel_booking_agent.py\n```\n\n#### Testing Examples\n```bash\n# Test with Python client\nuv run python examples/python/fastanp_examples/test_hotel_booking_client.py\n\n# Or test manually with curl\n# Get Agent Description\ncurl http://localhost:8000/ad.json | jq\n\n# Call JSON-RPC method\ncurl -X POST http://localhost:8000/rpc \\\n  -H \"Content-Type: application/json\" \\\n  -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\"}}}'\n```\n\n**Detailed Documentation**: [FastANP Examples](examples/python/fastanp_examples/README.md)\n\n## Tool Recommendations\n\n### ANP Network Explorer Tool\nUse the web interface to explore the agent network using natural language: [ANP Network Explorer Tool](https://service.agent-network-protocol.com/anp-explorer/)\n\n### DID Document Generator Tool\nCommand line tool to quickly generate DID documents:\n```bash\nuv run python tools/did_generater/generate_did_doc.py <did> [--agent-description-url URL]\n```\n\n## Contact Us\n\n- **Author**\uff1aGaoWei Chang  \n- **Email**\uff1achgaowei@gmail.com  \n- **Website**\uff1a[https://agent-network-protocol.com/](https://agent-network-protocol.com/)  \n- **Discord**\uff1a[https://discord.gg/sFjBKTY7sB](https://discord.gg/sFjBKTY7sB)  \n- **GitHub**\uff1a[https://github.com/agent-network-protocol/AgentNetworkProtocol](https://github.com/agent-network-protocol/AgentNetworkProtocol)\n- **WeChat**\uff1aflow10240\n\n## License\n\nThis project is open-sourced under the MIT License. Detailed information please refer to [LICENSE](LICENSE) file.\n\n---\n\n**Copyright (c) 2024 GaoWei Chang**\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "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.",
    "version": "0.4.5",
    "project_urls": {
        "Documentation": "https://github.com/agent-network-protocol/AgentNetworkProtocol",
        "Homepage": "https://agent-network-protocol.com/",
        "Repository": "https://github.com/agent-network-protocol/AgentConnect"
    },
    "split_keywords": [
        "agent",
        " authentication",
        " communication",
        " encryption",
        " protocol"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b2b34e07f79ed0588549cc893c8df07561a5c5289455d4bcd69fba3f44a2c0d9",
                "md5": "08a45f02f17db8d83187c7f2b956defc",
                "sha256": "cf6a6bc7bb0fce60719a11595e58415f69cf2f2084f348986cb7d3591f833223"
            },
            "downloads": -1,
            "filename": "anp-0.4.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08a45f02f17db8d83187c7f2b956defc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 170807,
            "upload_time": "2025-10-27T13:38:20",
            "upload_time_iso_8601": "2025-10-27T13:38:20.621192Z",
            "url": "https://files.pythonhosted.org/packages/b2/b3/4e07f79ed0588549cc893c8df07561a5c5289455d4bcd69fba3f44a2c0d9/anp-0.4.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fc32a9894c9a904c21cc3e691f35f0249b45fe6ff62f8ecb81d234b7ccba74c4",
                "md5": "19f4c2790dccf83d5aac355693f358f9",
                "sha256": "413ae1dfb21e36de8587c4f809e83c42d771cc157b57d03143f509f9a9fe304d"
            },
            "downloads": -1,
            "filename": "anp-0.4.5.tar.gz",
            "has_sig": false,
            "md5_digest": "19f4c2790dccf83d5aac355693f358f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 19364963,
            "upload_time": "2025-10-27T13:40:50",
            "upload_time_iso_8601": "2025-10-27T13:40:50.733926Z",
            "url": "https://files.pythonhosted.org/packages/fc/32/a9894c9a904c21cc3e691f35f0249b45fe6ff62f8ecb81d234b7ccba74c4/anp-0.4.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-27 13:40:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "agent-network-protocol",
    "github_project": "AgentNetworkProtocol",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "anp"
}
        
Elapsed time: 1.12744s