Skip to main content

AgentSDK.py

This library is a simple asynchronous python wrapper around AI Agent SDK.

Installation

$ pip3 install ai-agent-sdk

Usage

Initialize AgentSDK

from ai_agent.agent import AgentSDK

AGENT_PROXY_ADDRESS = "0x07771A3026E60776deC8C1C61106FB9623521394"
NETWORK_RPC = "https://testnet-rpc.bitlayer.org"

agent = AgentSDK(endpoint_uri=NETWORK_RPC, proxy_address=AGENT_PROXY_ADDRESS)

To create a new agent, call the createAndRegisterAgent method:

import time
from ai_agent.entities import (
    AgentSettings,
    AgentHeader,
    MessageType,
    Priority
)
from ai_agent.utils import (
    generate_uuid_v4
)

AGENT_SETTINGS = AgentSettings(
    signers=[
        "0x4b1056f504f32c678227b5Ae812936249c40AfBF",
        "0xB973476e0cF88a3693014b99f230CEB5A01ac686",
        "0x6cF0803D049a4e8DC01da726A5a212BCB9FAC1a1",
        "0x9D46daa26342e9E9e586A6AdCEDaD667f985567B",
        "0x33AF673aBcE193E20Ee94D6fBEb30fEf0cA7015b",
        "0x868D2dE4a0378450BC62A7596463b30Dc4e3897E",
        "0xD4E157c36E7299bB40800e4aE7909DDcA8097f67",
        "0xA3866A07ABEf3fD0643BD7e1c32600520F465ca8",
        "0x62f642Ae0Ed7F12Bc40F2a9Bf82ccD0a3F3b7531"
    ],
    threshold=2,
    converter_address="0xaB303EF87774D9D259d1098E9aA4dD6c07F69240",
    agent_header=AgentHeader(
        version="1.0",
        message_id="d4d0813f-ceb7-4ce1-8988-12899b26c4b6",
        source_agent_id="da70f6b3-e580-470f-b88b-caa5369e7778",
        source_agent_name="APRO Pull Mode Agent",
        target_agent_id="",
        timestamp=int(time.time()),
        message_type=MessageType.Event,
        priority=Priority.Low,
        ttl=60 * 60
    )
)

dynamic_setting = AGENT_SETTINGS
dynamic_setting.agent_header.source_agent_id = generate_uuid_v4()
dynamic_setting.agent_header.target_agent_id = generate_uuid_v4()
dynamic_setting.agent_header.message_id = generate_uuid_v4()
user_owner = agent.add_account("0x_user_private_key")
result = agent.create_and_register_agent(
    transmitter="",
    nonce=None,
    settings=AGENT_SETTINGS)
print("created agent:", result)

To verify the data integrity, call the verify method:

from ai_agent.entities import (
    AgentMessagePayload,
    Proofs,
    AgentMetadata,
)

AGENT_CONTRACT = "0xA1903361Ee8Ec35acC7c8951b4008dbE8D12C155"
AGENT_SETTING_DIGEST = "0x010038164dba6abffb84eb5cb538850d9bc5d8f815149a371069b3255fd177a4"
AGENT_PAYLOAD = AgentMessagePayload(
    data="0x0006e706cf7ab41fa599311eb3de68be869198ce62aef1cd079475ca50e5b3f60000000000000000000000000000000000000000000000000000000002b1bf0e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200003665949c883f9e0f6f002eac32e00bd59dfe6c34e92a91c37d6a8322d6489000000000000000000000000000000000000000000000000000000006762677d000000000000000000000000000000000000000000000000000000006762677d000000000000000000000000000000000000000000000000000003128629ec0800000000000000000000000000000000000000000000000004db732547630000000000000000000000000000000000000000000000000000000000006763b8fd0000000000000000000000000000000000000000000015f0f60671beb95cc0000000000000000000000000000000000000000000000015f083baa654a7b900000000000000000000000000000000000000000000000015f103ec7cb057ea80000000000000000000000000000000000000000000000000000000000000000003b64f7e72208147bb898e8b215d0997967bef0219263726c76995d8a19107d6ba5306a176474f9ccdb1bc5841f97e0592013e404e15b0de0839b81d0efb26179f222e0191269a8560ebd9096707d225bc606d61466b85d8568d7620a3b59a73e800000000000000000000000000000000000000000000000000000000000000037cae0f05c1bf8353eb5db27635f02b40a534d4192099de445764891198231c597a303cd15f302dafbb1263eb6e8e19cbacea985c66c6fed3231fd84a84ebe0276f69f481fe7808c339a04ceb905bb49980846c8ceb89a27b1c09713cb356f773",
    data_hash="0x53d9f133f1265bd4391fcdf89b63424cbcfd316c8448f76cc515647267ac0a8e",
    proofs=Proofs(
        zk_proof="0x",
        merkle_proof="0x",
        signature_proof="0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000003b64f7e72208147bb898e8b215d0997967bef0219263726c76995d8a19107d6ba5306a176474f9ccdb1bc5841f97e0592013e404e15b0de0839b81d0efb26179f222e0191269a8560ebd9096707d225bc606d61466b85d8568d7620a3b59a73e800000000000000000000000000000000000000000000000000000000000000037cae0f05c1bf8353eb5db27635f02b40a534d4192099de445764891198231c597a303cd15f302dafbb1263eb6e8e19cbacea985c66c6fed3231fd84a84ebe0276f69f481fe7808c339a04ceb905bb49980846c8ceb89a27b1c09713cb356f7730000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001",
    ),
    meta_data=AgentMetadata(
        content_type="0x",
        encoding="0x",
        compression="0x"
    )
)
user_owner = agent.add_account("0x_user_private_key")
result = agent.verify(
    transmitter=user_owner,
    nonce=None,
    agent_contract=AGENT_CONTRACT,
    settings_digest=AGENT_SETTING_DIGEST,
    payload=AGENT_PAYLOAD
)
print("verify:", result)

For more examples, see the test cases.

License

This project is licensed under the Apache License 2.0. The full license text can be found in the LICENSE file.

Copyright (c) 2025 Apro.

Metadata

Release files for ai-agent-sdk 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-agent-sdk 1.0.5
File Size Uploaded Provenance Actions
ai-agent-sdk-1.0.5.tar.gz 15.0 kB Without provenance Details for ai-agent-sdk-1.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-agent-sdk 1.0.5
File Interpreter ABI Platform Actions
ai_agent_sdk-1.0.5-py3-none-any.whl Python 3 none any Details for ai_agent_sdk-1.0.5-py3-none-any.whl

Total release size: 31.9 kB

Release files / ai-agent-sdk-1.0.5.tar.gz

Download URL ai-agent-sdk-1.0.5.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
599aba25bdcf4488edec5fb290d865839e6749ce9d33dc2f654385b5d223b249
BLAKE2b-256 checksum
How to use checksums
7f9fb4a0fe24d144595e06ca6db446d85a36ed0b314e0e9626f609fba0988a09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.6

Release files / ai_agent_sdk-1.0.5-py3-none-any.whl

Download URL ai_agent_sdk-1.0.5-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fd7913f67c61149690690f9b8bd90b7c7afc1b2bb1337b50a42d21153de7529
BLAKE2b-256 checksum
How to use checksums
a53e6a63f598633643960346bca85d6e878727a03661b563fb8f9a98df0d09ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.6

Security for ai-agent-sdk 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page