Skip to main content

Python SDK for the Agent Attribution Protocol (AAP) — AI agent affiliate attribution

Project description

agent-attribution-protocol

Python SDK for the Agent Attribution Protocol (AAP)

AAP enables AI agents to discover offers, make recommendations, and earn commission when those recommendations lead to purchases.

Install

pip install agent-attribution-protocol

Quick Start

from agent_attribution_protocol import AAP

aap = AAP(api_key="your-api-key")

# Search for offers
result = aap.search(vertical="sim", max_price=10, contract_months=0)
print(f"Found {result.count} offers")

# Recommend an offer (records attribution)
rec = aap.recommend(
    session_id=result.session_id,
    offer_id=result.offers[0].id,
    context="User asked for cheap SIM with no contract",
)
print(f"Recommendation recorded: {rec.recommendation_id}")
print(f"Fallback URL: {rec.fallback_url}")

# Initiate checkout
checkout = aap.checkout(
    session_id=result.session_id,
    recommendation_id=rec.recommendation_id,
)
print(f"Transaction: {checkout.transaction_id} ({checkout.status})")

API

AAP(api_key, base_url="https://api.affili.ai")

Create a client. Can also be used as a context manager:

with AAP(api_key="your-key") as aap:
    result = aap.search(vertical="sim")

aap.search(**kwargs) → SearchResult

Parameter Type Description
vertical str sim, broadband, energy, flights, hotels, insurance
provider str Filter by provider name
max_price float Maximum price
min_data_gb int Minimum data (SIM)
contract_months int Contract length (0 = rolling)

aap.recommend(session_id, offer_id, context=None) → Recommendation

Record a recommendation. This is the attribution event.

aap.checkout(session_id, recommendation_id, user_details=None) → CheckoutResult

Initiate checkout.

aap.get_session(session_id) → Session

Get session details.

aap.verify_code(code) → dict

Verify an AAP Code is authentic.

Links

Licence

Apache 2.0

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

agent_attribution_protocol-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

agent_attribution_protocol-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file agent_attribution_protocol-0.1.0.tar.gz.

File metadata

File hashes

Hashes for agent_attribution_protocol-0.1.0.tar.gz
Algorithm Hash digest
SHA256 01da07dc1ccfd7ee4fadaeaff564221d4650f318d11d5912fddecb0ecf47b3f5
MD5 a272b14c8dc6f2d892009bfb737bfd31
BLAKE2b-256 01b4fac42ab458a697c573b44a701932f774df81d486265db430da5d5694620b

See more details on using hashes here.

File details

Details for the file agent_attribution_protocol-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_attribution_protocol-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83ffa96ce1a25a9e62b97bf6f92d07e7300e33b5b956a7f14fc708f12ade822e
MD5 70ea927338269d0f83f3db53e332e6f9
BLAKE2b-256 14632508c490fc47456fc3fcbeeb1c30014fafbd70fe6f714e8598c93175c19e

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