Skip to main content

Official Python SDK for the Agenitry audit-trail API — log AI agent actions, query events, and pull stats in two lines of code.

Project description

Agenitry Python SDK

The event ledger for AI agents. One line to log, one URL to verify.

The problem

Your AI agent takes actions — reservations, orders, comps, price changes — but nobody can see what happened or why. You're flying blind.

Agenitry gives every agent action a permanent, verifiable record. Log an event in one line. Share a URL. Done.

Install

pip install agenitry

Zero dependencies. Python 3.9+.

Quick start

from agenitry import Agenitry

agent = Agenitry(api_key="ag_your_key", venue_id="nobo-downtown")

# Log an event — fire and forget by default
agent.log(action="order_captured", amount=42.50, direction="inbound")

# Await confirmation if you need the event ID
event = agent.log(action="reservation_booked", amount=0, direction="inbound", await_confirmation=True)
print(event["id"])  # evt_abc123

# Query events
result = agent.events(action="order_captured", limit=10)
for e in result["events"]:
    print(e["action"], e["amount"])

# Get stats
stats = agent.stats(period="7d")
print(stats["total_inbound"], stats["event_count"])

Verify URL

Every event gets a permanent, shareable URL:

https://api.agenitry.com/v1/verify/{venue_id}/{event_id}

No login required. No dashboard needed. Just share the link and anyone can verify what happened.

API Reference

Agenitry(api_key, venue_id, *, agent_id=None, base_url=None, max_retries=3, retry_base_delay=0.5)

Create a new Agenitry client.

Parameter Type Default Description
api_key str required Your venue API key (ag_...)
venue_id str required Your venue identifier
agent_id str None Default agent ID for all events
base_url str https://api.agenitry.com API base URL
max_retries int 3 Max retry attempts on 429/5xx
retry_base_delay float 0.5 Base delay in seconds (exponential backoff)

agent.log(*, action, amount=None, direction=None, agent_id=None, context=None, await_confirmation=False)

Log an event.

Parameter Type Default Description
action str required Event action (see below)
amount float None Dollar amount
direction str None inbound, outbound, or internal
agent_id str constructor default Agent that performed the action
context dict None Arbitrary JSONB context data
await_confirmation bool False If True, waits for server response

Fire and forget (default): log() returns immediately with {id: "", status: "logged"}. If the request fails, it's silently swallowed. Perfect for non-critical logging.

Await confirmation: log() waits for the server response and raises AgenitryError on failure. Use when you need the event ID or need to know it was persisted.

Event Actions

Action Description Direction Example
order_captured Agent captured an order inbound Voice agent took a $42.50 takeout order
reservation_booked Agent booked a reservation inbound Chatbot reserved table 7 for 8pm
price_changed Agent changed a price internal Agent updated happy hour draft from $6 to $7
item_86d Agent marked an item as unavailable internal Agent 86'd the tuna special
comp_issued Agent issued a comp outbound Agent comped dessert for a regular
purchase_order Agent placed a purchase order outbound Agent ordered 50 lbs of salmon

agent.events(*, agent_id=None, action=None, direction=None, limit=None, offset=None, context=None)

Query events for the venue.

Parameter Type Default Description
agent_id str None Filter by agent
action str None Filter by action type
direction str None Filter by direction
limit int 50 Max events to return
offset int 0 Pagination offset
context dict None JSONB contains filter

Returns a dict with total, limit, offset, has_more, and events list.

agent.stats(*, period=None)

Get aggregate stats for the venue.

Parameter Type Default Description
period str today today, 7d, 30d, or 90d

Returns a dict with total_inbound, total_outbound, event_count, and by_agent breakdown.

AgenitryError

Raised on API errors. Attributes:

Attribute Type Description
status int or None HTTP status code (if available)
body dict or None Parsed response body (if JSON)
code str Error code: NETWORK, HTTP, or PARSE

create_agenitry(api_key, venue_id, **kwargs)

Factory function. Returns an Agenitry instance. Same arguments as the constructor.

Type Aliases

EventAction = Literal[
    "order_captured", "reservation_booked", "price_changed",
    "item_86d", "comp_issued", "purchase_order"
]

EventDirection = Literal["inbound", "outbound", "internal"]

StatsPeriod = Literal["today", "7d", "30d", "90d"]

License

MIT

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

agenitry-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

agenitry-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agenitry-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agenitry-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1c034d4b3d38edb7fa95f7205abde35e5d63cdd1257025bcca48de116a3840e1
MD5 706de7169837aa064437a0440d974aae
BLAKE2b-256 2fb59665bdc408eeea8b902c7af92decb123a995a009e74d4cf148a4e7ba291c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agenitry-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agenitry-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8274d5befe754ca7ef920b3ee12c66923b2dd89fd3f62c02205fbd41efa1c626
MD5 ed0ba9d7547959e3207d9cb9e7674f9f
BLAKE2b-256 733f5e7abc25e81bb6a6d5762748c565a347d615a7fd6e62aed0056b411db6e8

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