Skip to main content

Real-time environmental context for AI agents

Project description

🧠 sensa

License: MIT Python 3.9+

Real-time environmental context for AI agents.

Your AI agent doesn't know what time it is. It doesn't know if it's raining, what Bitcoin costs, or what just happened in the news. Sensa fixes that — injecting a compact, token-efficient snapshot of the real world into every prompt.

Quick Install

pip install sensa

Quickstart

from sensa import SensaClient

client = SensaClient(channels=["time", "weather", "crypto", "news"], location="Austin, TX")
context = client.get_context_sync()
print(context)

Example output:

[SENSA — Tue Apr 7, 2026 3:15 PM CDT]
⏱ Session: 47m | Last call: 2m ago
🌤 Austin, TX: 78°F, partly cloudy, wind 8mph
📈 BTC: $94,230 (+2.1%) | ETH: $3,847 (+1.8%) | SOL: $142 (+0.5%)
📰 Fed signals rate hold | Tech earnings beat estimates | Oil prices steady

Channels

Channel Data API Key Required
time Date, time, session tracking stdlib No
weather Temp, conditions, wind wttr.in No
crypto BTC, ETH, SOL prices + 24h % CoinGecko No
news Top 3 headlines RSS (BBC, AP) No

Configuration

client = SensaClient(
    channels=["time", "weather", "crypto"],
    location="Austin, TX",           # Used by weather channel
    timezone="America/Chicago",      # Timezone for time channel
    max_tokens=200,                  # Token budget for output
    api_keys={                       # Optional premium API keys
        "openweathermap": "your-key",
    },
    staleness_thresholds={           # Minutes before data is flagged stale
        "weather": 15,
        "crypto": 5,
        "news": 30,
    },
)

Async Usage

import asyncio
from sensa import SensaClient

async def main():
    client = SensaClient(channels=["time", "weather"])
    context = await client.get_context()
    print(context)

asyncio.run(main())

Zero Config

Sensa works with zero configuration. Just SensaClient() gives you the time channel out of the box.

How It Works

  1. Channels fetch data from free public APIs (no keys needed for basic use)
  2. Compression fits all channel output within your token budget using priority-based allocation
  3. Staleness detection flags data that's too old, so your agent knows what to trust

Contributing

Contributions welcome! Please open an issue or PR on GitHub.

  1. Fork the repo
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

License

MIT — see LICENSE for details.

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

sensa_ai-0.2.0.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

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

sensa_ai-0.2.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file sensa_ai-0.2.0.tar.gz.

File metadata

  • Download URL: sensa_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for sensa_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b62f0016600182745e01a429981dd11f28ca30dcd502853ef9d9666c03db1895
MD5 ff4efe902b4a78db99ba2db8af1f683a
BLAKE2b-256 1d3619cfefa9dbe5c5bdba23a860647aeb0ad6619fc387a6a118891cd0f0648e

See more details on using hashes here.

File details

Details for the file sensa_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sensa_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for sensa_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cca539e8fcfb4fb3bc9532ec8117883a766692fa451ea8b635a98789b0f440d0
MD5 bdf59077d66ca8f90791c2cb0171b04a
BLAKE2b-256 3cda26f9cbc8a102ab827a10cf1a667594cece1f5c995159c8a7b1a4e17f3a1c

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