Skip to main content

Afferens Python SDK — Data Pipeline for AI Agents

Project description

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-77-YOURNAME")

# 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(
    target_node_id="IPHONE-IOS-01",
    command_type="ROTATE_CAMERA",
    parameters={"degrees": 90},
)

# 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.

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

afferens-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

afferens-0.1.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file afferens-0.1.2.tar.gz.

File metadata

  • Download URL: afferens-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for afferens-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b5a40017b8214e551a2670de1d3a79b04900c6cf8a115f31672077e52b46bce0
MD5 10e7575d6dd908c042c7b847c4987485
BLAKE2b-256 67cc8a24685799ab3bc9fb1e5a32d3aa93afc793ddc0b3d98c03ce9ab2d06e10

See more details on using hashes here.

File details

Details for the file afferens-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: afferens-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for afferens-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d67ca425a81fd3e1df3ca4a459d50e87bc397b19e8635fc7549d45e37b0c1484
MD5 8dafa22ec3a027126efae63deac51efb
BLAKE2b-256 a1eef545b7e0346a6a16519ea7c16f865c6c16096494626feebc8bf4eb5a25b6

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