Real-time environmental context for AI agents
Project description
🧠 sensa
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
- Channels fetch data from free public APIs (no keys needed for basic use)
- Compression fits all channel output within your token budget using priority-based allocation
- 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.
- Fork the repo
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
License
MIT — see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b62f0016600182745e01a429981dd11f28ca30dcd502853ef9d9666c03db1895
|
|
| MD5 |
ff4efe902b4a78db99ba2db8af1f683a
|
|
| BLAKE2b-256 |
1d3619cfefa9dbe5c5bdba23a860647aeb0ad6619fc387a6a118891cd0f0648e
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cca539e8fcfb4fb3bc9532ec8117883a766692fa451ea8b635a98789b0f440d0
|
|
| MD5 |
bdf59077d66ca8f90791c2cb0171b04a
|
|
| BLAKE2b-256 |
3cda26f9cbc8a102ab827a10cf1a667594cece1f5c995159c8a7b1a4e17f3a1c
|