Skip to main content

Sense

A programming language for probabilistic and autonomous computation — where a model's answer, a staged side effect, a permission check, and a human approval gate are things the language itself understands, not conventions a library hopes you follow.

PyPI version Python versions MIT licensed

Website · Documentation


Install

pip install sense-lang

Requires Python 3.10+. No other runtime dependency for the interpreter itself.

Optional extras, only needed if you use the matching feature:

pip install sense-lang[anthropic]   # inference("anthropic", ...)
pip install sense-lang[openai]      # inference("openai", ...)
pip install sense-lang[mcp]         # connect_mcp(...)

Quickstart

def fib(n) -> Int:
    if n < 2:
        return n
    return fib(n - 1) + fib(n - 2)

i = 0
while i < 10:
    print(fib(i))
    i = i + 1
sense run fib.sns
sense repl

Reasoning about something never talks to a vendor SDK directly — it asks whichever model is currently delegated to, and reads back a structured Answer, never a plain string:

model reasoning = inference("mock", "demo")   # offline, no API key needed
set delegation = reasoning

result = ask("what database should we use?")
print(result.value)
print(result.confidence)

A side effect that changes the outside world gets its own lifecycle — calling it never runs the effect; only .commit() does:

irreversible action send_mail(to: String, body: String) requires email.send:
    print("sending to " + to)

policy: allow email.send

mail = send_mail("alice@example.com", "hi")   # nothing sent yet
mail.verify()
mail.commit()                                  # only now

Full walkthroughs, the language reference, and the safety model live at docs.sensecode.dev.

What's in the box

  • ask/Model/Answer — vendor-agnostic reasoning, with confidence and source structurally distinct from a plain value.
  • action — prepare → verify → commit, enforced by the interpreter; a reversible action must declare how to undo itself.
  • policy/requires — capability-gated permissions, scoped exactly like variables.
  • agent — a real runtime entity with identity, state, and a genuine pause/resume lifecycle.
  • tool/skill/connect_mcp — capability-checked functions a model can be handed to call on its own.
  • memory/persistent memory — session-scoped and durable, versioned key/value storage.
  • import python "module" — reach into any installed Python package directly; the interpreter is itself written in Python.

Development

Contributing or building from source:

git clone <repo-url>
cd sense
python -m venv .venv
.venv/Scripts/python -m pip install -e .[dev]   # Windows
# source .venv/bin/activate && pip install -e .[dev]   # macOS/Linux

pytest -q

License

MIT — see LICENSE.

Metadata

Release files for sense-lang 0.20.0

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

Source distribution (sdist)

Source distribution for sense-lang 0.20.0
File Size Uploaded Provenance
sense_lang-0.20.0.tar.gz 138.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sense-lang 0.20.0
File Interpreter ABI Platform
sense_lang-0.20.0-py3-none-any.whl Python 3 none any Details

Total release size: 231.3 kB

Release files / sense_lang-0.20.0.tar.gz

Download URL sense_lang-0.20.0.tar.gz
Size 138.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fedffb317706b5200fe527c03970841b9bde073e22ccb528bb533c7da64fbbc7
BLAKE2b-256 checksum
How to use checksums
91af3fa57feda548baa6c371a718dcdff7a6bb225749ec355f43de3156ebbdd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.6

Release files / sense_lang-0.20.0-py3-none-any.whl

Download URL sense_lang-0.20.0-py3-none-any.whl
Size 93.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e064cd4938c6c244499d8f9276f806e2d1ff5e9e5214dc6efdc1b562d7a64fc
BLAKE2b-256 checksum
How to use checksums
0fb3a5e732d7eb3579c5f2f47f96dc08ea3230d522d7a30d46222114cadb72fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.6

Security for sense-lang 0.20.0

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.

Release history Release notifications | RSS feed

This release

0.20.0 This release

2 release files No provenance

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