Skip to main content

Afferens — Python SDK

The data pipeline that gives AI agents real-world senses.

Afferens gives AI agents verified context about the physical world before they act. Through a single hardware-agnostic API, agents pull real-time perception — priced by usage with sense tokens. Vision is live today; additional modalities (spatial, acoustic, environmental, and more) are rolling out.

Install

pip install afferens

Quickstart

from afferens import Afferens

client = Afferens(api_key="aff_live_...")  # your key from afferens.com

# Pull the latest VISION perception (production-ready today)
data = client.perceive(modality="VISION")
print(data)

Get your API key by signing up at afferens.com. Auth is a simple X-API-KEY header, handled for you by the client.

Perceive

client.perceive(modality="VISION", limit=1)   # one event
client.vision(limit=5)                          # modality shortcut

# Modalities: VISION, SPATIAL, ACOUSTIC, ENVIRONMENTAL, MOLECULAR, INTEROCEPTION
# (VISION is live now; the rest are rolling out.)
# Omit `modality` to retrieve across all modalities. `limit` caps at 10.

Returns a dict with status, data, count, api_version.

Ingest live sensor data

client.ingest(
    modality="ENVIRONMENTAL",
    data={"temperature_c": 24.1, "humidity_pct": 55},
    classification="room_reading",
)

# Batch many readings in one request (fewer round-trips):
client.ingest_batch([
    {"modality": "SPATIAL", "data": {"x": 1, "y": 2, "z": 0}, "node_id": "ROVER-01"},
    {"modality": "VISION",  "data": {"frame": "..."}, "node_id": "ROVER-01"},
])

Actuate a physical node

client.actuate(
    command_type="ROTATE_CAMERA",
    parameters={"degrees": 90},
    # target_node_id optional — defaults to your most recently active node
)

# command_type: CAPTURE_FRAME, TRIGGER_ALARM, MOVE_TO, ROTATE_CAMERA,
#               LOCK, UNLOCK, ADJUST_SENSOR, SHUTDOWN_NODE

Sense tokens

Usage is metered in sense tokens (a VISION call ≈ 14 tokens). Every account starts with a free allocation; token packs unlock more. Tokens never expire. See afferens.com/pricing.

Errors

Non-200 responses raise AfferensError (with .status and .message).

from afferens import Afferens
from afferens.client import AfferensError

try:
    client.perceive(modality="VISION")
except AfferensError as e:
    print(e.status, e.message)

License

© Afferens. All rights reserved.

Metadata

Release files for afferens 0.1.3

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

Source distribution (sdist)

Source distribution for afferens 0.1.3
File Size Uploaded Provenance
afferens-0.1.3.tar.gz 4.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for afferens 0.1.3
File Interpreter ABI Platform
afferens-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / afferens-0.1.3.tar.gz

Download URL afferens-0.1.3.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
919cfc5013927f9e10f714a9e24652cc792d93ad069a9135be6f888b79072ab6
BLAKE2b-256 checksum
How to use checksums
cf333da78d841c408c604393d253f67cd11d57cd1acda09da1c898c7c55fa24e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / afferens-0.1.3-py3-none-any.whl

Download URL afferens-0.1.3-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3339436143a3f1a6ad9af88ecdabc39e8afd5bc85fa4081e78249b9e48806d20
BLAKE2b-256 checksum
How to use checksums
7af7a714ee2f070c71bb4a4fe1ab125922ddae6849e10c0b0bc70ff97f789319
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Security for afferens 0.1.3

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.

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