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.1.0.tar.gz (26.6 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.1.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sensa_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 26.6 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.1.0.tar.gz
Algorithm Hash digest
SHA256 31a8da1bb53918c8a9cbe69d01cae240c94abba32ba2cb146db45b8680db38a5
MD5 255cc6a19f2b47d3f4c6ee58c2b8ea0c
BLAKE2b-256 4326d4fc8edb242c4a6d67a1f631735c25634587c44fb006b575ed43cc6506ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sensa_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 682cf4a771a6e5732aed2594e19c16bb7addf760dbd7b3f13c8f491b91021488
MD5 d3d0df1f165bbee6f82bee326ec852bd
BLAKE2b-256 0e8ffeb5932610cbb2291bac193b14f65ab4009c3f84659f60f016ba59a0c9d0

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