1
- # AgentSDK.py
1
+ # ATTPs SDK
2
2
3
- This library is a simple asynchronous python wrapper around [ AI Agent SDK] ( https://github.com/APRO-com/ai-agent -sdk-python ) .
3
+ This library is a simple asynchronous python wrapper around [ ATTPs SDK] ( https://github.com/APRO-com/ATTPs -sdk-python ) .
4
4
5
5
# Installation
6
6
``` bash
7
- $ pip3 install ai-agent -sdk
7
+ $ pip3 install attps -sdk
8
8
```
9
9
10
10
# Usage
11
11
12
12
### Initialize AgentSDK
13
13
14
14
``` python
15
- from ai_agent .agent import AgentSDK
15
+ from attps.verify .agent import AgentSDK
16
16
17
- AGENT_PROXY_ADDRESS = " 0x07771A3026E60776deC8C1C61106FB9623521394"
18
- NETWORK_RPC = " https://testnet-rpc.bitlayer.org"
17
+ AGENT_PROXY_ADDRESS = " 0x07771A3026E60776deC8C1C61106FB9623521394" # ATTPs verify module agent contract deployment address (EVM)
18
+ NETWORK_RPC = " https://testnet-rpc.bitlayer.org" # ATTPs verify module agent contract deployment chain RPC address
19
19
20
20
agent = AgentSDK(endpoint_uri = NETWORK_RPC , proxy_address = AGENT_PROXY_ADDRESS )
21
21
```
22
22
23
- To create a new agent, call the createAndRegisterAgent method:
23
+ To create a new verify agent, call the createAndRegisterAgent method:
24
24
25
25
``` python
26
26
import time
27
- from ai_agent .entities import (
27
+ from attps.verify .entities import (
28
28
AgentSettings,
29
29
AgentHeader,
30
30
MessageType,
31
31
Priority
32
32
)
33
- from ai_agent .utils import (
33
+ from utils .utils import (
34
34
generate_uuid_v4
35
35
)
36
36
@@ -45,17 +45,17 @@ AGENT_SETTINGS = AgentSettings(
45
45
" 0xD4E157c36E7299bB40800e4aE7909DDcA8097f67" ,
46
46
" 0xA3866A07ABEf3fD0643BD7e1c32600520F465ca8" ,
47
47
" 0x62f642Ae0Ed7F12Bc40F2a9Bf82ccD0a3F3b7531"
48
- ],
49
- threshold = 2 ,
50
- converter_address = " 0xaB303EF87774D9D259d1098E9aA4dD6c07F69240" ,
48
+ ], # Signer list corresponding to the Agent's signed data
49
+ threshold = 2 , # Verification threshold, minimum number of correct signatures from signers
50
+ converter_address = " 0xaB303EF87774D9D259d1098E9aA4dD6c07F69240" , # Converter contract address for intermediate data processing between signed data and final signed data
51
51
agent_header = AgentHeader(
52
- version = " 1.0" ,
53
- message_id = " d4d0813f-ceb7-4ce1-8988-12899b26c4b6" ,
54
- source_agent_id = " da70f6b3-e580-470f-b88b-caa5369e7778" ,
55
- source_agent_name = " APRO Pull Mode Agent" ,
56
- target_agent_id = " " ,
57
- timestamp = int (time.time()),
58
- message_type = MessageType.Event,
52
+ version = " 1.0" , # agent version
53
+ message_id = " d4d0813f-ceb7-4ce1-8988-12899b26c4b6" , # Agent‘s Message ID, Used for target agent uniqueness verification
54
+ source_agent_id = " da70f6b3-e580-470f-b88b-caa5369e7778" , # Source Agent ID, globally unique in the system
55
+ source_agent_name = " APRO Pull Mode Agent" , # Source agent name
56
+ target_agent_id = " " , # Target Agent ID
57
+ timestamp = int (time.time()), # Agent registration time
58
+ message_type = MessageType.Event, # Agent data transmission type, currently only supports Event
59
59
priority = Priority.Low,
60
60
ttl = 60 * 60
61
61
)
@@ -67,7 +67,7 @@ dynamic_setting.agent_header.target_agent_id = generate_uuid_v4()
67
67
dynamic_setting.agent_header.message_id = generate_uuid_v4()
68
68
user_owner = agent.add_account(" 0x_user_private_key" )
69
69
result = agent.create_and_register_agent(
70
- transmitter = " " ,
70
+ transmitter = " " ,
71
71
nonce = None ,
72
72
settings = AGENT_SETTINGS )
73
73
print (" created agent:" , result)
@@ -76,17 +76,17 @@ print("created agent:", result)
76
76
To verify the data integrity, call the verify method:
77
77
78
78
``` python
79
- from ai_agent .entities import (
79
+ from attps.verify .entities import (
80
80
AgentMessagePayload,
81
81
Proofs,
82
82
AgentMetadata,
83
83
)
84
84
85
- AGENT_CONTRACT = " 0xA1903361Ee8Ec35acC7c8951b4008dbE8D12C155"
86
- AGENT_SETTING_DIGEST = " 0x010038164dba6abffb84eb5cb538850d9bc5d8f815149a371069b3255fd177a4"
85
+ AGENT_CONTRACT = " 0xA1903361Ee8Ec35acC7c8951b4008dbE8D12C155" # Verification contract corresponding to the agent
86
+ AGENT_SETTING_DIGEST = " 0x010038164dba6abffb84eb5cb538850d9bc5d8f815149a371069b3255fd177a4" # Agent's configuration information identifier, returned in the blockchain event during registration or modification
87
87
AGENT_PAYLOAD = AgentMessagePayload(
88
88
data="0x0006e706cf7ab41fa599311eb3de68be869198ce62aef1cd079475ca50e5b3f60000000000000000000000000000000000000000000000000000000002b1bf0e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200003665949c883f9e0f6f002eac32e00bd59dfe6c34e92a91c37d6a8322d6489000000000000000000000000000000000000000000000000000000006762677d000000000000000000000000000000000000000000000000000000006762677d000000000000000000000000000000000000000000000000000003128629ec0800000000000000000000000000000000000000000000000004db732547630000000000000000000000000000000000000000000000000000000000006763b8fd0000000000000000000000000000000000000000000015f0f60671beb95cc0000000000000000000000000000000000000000000000015f083baa654a7b900000000000000000000000000000000000000000000000015f103ec7cb057ea80000000000000000000000000000000000000000000000000000000000000000003b64f7e72208147bb898e8b215d0997967bef0219263726c76995d8a19107d6ba5306a176474f9ccdb1bc5841f97e0592013e404e15b0de0839b81d0efb26179f222e0191269a8560ebd9096707d225bc606d61466b85d8568d7620a3b59a73e800000000000000000000000000000000000000000000000000000000000000037cae0f05c1bf8353eb5db27635f02b40a534d4192099de445764891198231c597a303cd15f302dafbb1263eb6e8e19cbacea985c66c6fed3231fd84a84ebe0276f69f481fe7808c339a04ceb905bb49980846c8ceb89a27b1c09713cb356f773",
89
- data_hash = " 0x53d9f133f1265bd4391fcdf89b63424cbcfd316c8448f76cc515647267ac0a8e" ,
89
+ data_hash = " 0x53d9f133f1265bd4391fcdf89b63424cbcfd316c8448f76cc515647267ac0a8e" , # Hash of the corresponding data
90
90
proofs = Proofs(
91
91
zk_proof = " 0x" ,
92
92
merkle_proof = " 0x" ,
0 commit comments