Skip to main content

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

Release files for agent-attribution-protocol 0.1.0

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

Source distribution (sdist)

Source distribution for agent-attribution-protocol 0.1.0
File Size Uploaded
agent_attribution_protocol-0.1.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-attribution-protocol 0.1.0
File Interpreter ABI Platform
agent_attribution_protocol-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / agent_attribution_protocol-0.1.0.tar.gz

Download URL agent_attribution_protocol-0.1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
01da07dc1ccfd7ee4fadaeaff564221d4650f318d11d5912fddecb0ecf47b3f5
BLAKE2b-256 checksum
How to use checksums
01b4fac42ab458a697c573b44a701932f774df81d486265db430da5d5694620b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / agent_attribution_protocol-0.1.0-py3-none-any.whl

Download URL agent_attribution_protocol-0.1.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83ffa96ce1a25a9e62b97bf6f92d07e7300e33b5b956a7f14fc708f12ade822e
BLAKE2b-256 checksum
How to use checksums
14632508c490fc47456fc3fcbeeb1c30014fafbd70fe6f714e8598c93175c19e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.1

2 release files

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