Skip to main content

Durable, dependency-free Python SDK for capturing AI-agent runs and shipping them to Intencion.

Project description

intencion

Durable, dependency-free Python SDK for capturing AI-agent runs and shipping them to Intencion. Pure stdlib, Python 3.8+, non-blocking background transport.

Install

pip install intencion

Quickstart

import intencion

intencion.init(api_key="in_pk_...")           # call once at startup

with intencion.run(intent="support", input=user_msg, user="u_123",
                   session="s_1", model="gpt-4o") as run:
    run.step(name="lookup_order", tool="db", status="success", ms=42)
    result = my_agent(user_msg)               # your agent work
    # outcome defaults to "success"; override with run.fail("...")/run.abandon()

# decorator form
@intencion.trace(intent="classify")
def classify(msg): ...

intencion.flush()                             # force send queued runs

If the wrapped code raises, the run is recorded as failure and the exception is re-raised unchanged.

Short-lived processes

The worker flushes on an interval, on atexit, and on SIGTERM/SIGINT. For a script, a serverless function, or any process that exits quickly, call flush() before the process ends to ensure queued runs are sent:

intencion.flush()      # block until queued runs are sent (or timeout)
intencion.shutdown()   # flush + stop the worker thread

Configuration

Option Default Meaning
api_key — (required) Sent as Authorization: Bearer <api_key>.
endpoint https://intencion.io/api/ingest Ingest URL.
flush_interval 5.0 Seconds between timed flushes.
max_batch 100 Max runs per request (hard-capped at 500).
max_queue 1000 Bounded queue size; drop-oldest when full.
sample_rate 1.0 Fraction of runs captured (0.0 to 1.0).
disabled False Disable all capture.
debug False Enable debug logging on the intencion logger.

API

intencion.init(api_key, endpoint=None, flush_interval=5.0, max_batch=100,
               max_queue=1000, sample_rate=1.0, disabled=False, debug=False)

intencion.run(intent, input=None, user=None, session=None, model=None)
# use as a context manager (with statement)

intencion.trace(intent, user=None, session=None, model=None, capture_input=False)
# use as a function decorator

intencion.flush(timeout=None)
intencion.shutdown(timeout=2.0)

A run object exposes: step(name, status="success", tool=None, ms=None, error=None), ok(), fail(reason=None), abandon(reason=None), set_tokens(tokens_in, tokens_out), set_model(model).

License

MIT. See LICENSE.

https://intencion.io

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

intencion-0.1.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

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

intencion-0.1.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for intencion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 648cca080f65be54b7b5499c73f407dd16fe8a212363a10b22ea96cbc65714ba
MD5 d823dbf43b393cac8032fa92611a822f
BLAKE2b-256 cb1908f2041012549bbda47864dd8af37f1d2e8bbf8dcd925544d25f8590dca6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for intencion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47d9eda44aa0181a78bf1d2b665dd5b18ee49af38540a95ad298212357a4f061
MD5 f52e3e11172e8d0ece587c61fa6232cc
BLAKE2b-256 c1f63e600f1939bbac6d5d5638a78b323d9f0a5f03806a81ec62c112844687af

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