Skip to main content

urun-sense (Python SDK)

Python SDK for uRun's realtime decision model — Sense.

Sense is a realtime, multi-modal System One model for voice and video agents and was inspired by the Jev model. It runs on continuously streaming media and answers questions about the input many times per second: for example, whether the user is still speaking or done, whether an interruption is a new question or just an "mmmhmm", and what the user's emotional state is.

The Sense SDK gives you one unified surface for perception, decision-making, and reactive agent control.

Get started

pip install "urun-sense[demo]"

On Linux, run PipeWire and make pw-record, pw-dump, and wpctl available on your PATH.

Authenticate with uRun

Make yourself a uRun API key at urun.sh then use that as your SENSE_API_KEY:

export SENSE_API_KEY="<urun-api-key>"

Run an example

Try the interactive example (requires a mic).

Python (standalone terminal demo):

Wait for the connection, select your mic, and start talking to Sense:

python -m sense.examples.cheese_demo

Python example walk-through

This is an overview of how sense-sdk is used to build the demo above. Sense is a decision model, you program it with questions and let it decide the answers. Sense currently supports 3 types of question:

  • Nouls: yes/no questions that the model will answer with true or false with a confidence between 0 and 1.
  • Choices: categorical questions where the answer must be from a list of choices.
  • Scores: again a set of choices but with the important difference that answers naturally form a continuous scale.

Declare your decisions. Create the client app and register your nouls, each registration returns a Question with an id to reference the results by later:

from sense import Sense

app = Sense()  # Needs an API key: default from SENSE_API_KEY

speech = app.noul("Is someone speaking right now?", id="speech")
cheese = app.noul("Is the speaker talking about cheese right now?", id="cheese")

The model can also answer non-binary questions from a list of choices — given a choice Sense matches from a fixed option list:

kind = app.choice(
    "Which type of cheese are they talking about?",
    ["cheddar", "brie", "gouda", "parmesan", "camembert",
     "mozzarella", "blue", "feta", "other"],
    id="cheese_type",
)

If you want an ordered scale use a score — the grades or levels are the range of answers, in this case the user's feeling will be graded in the range (0..4):

feeling = app.score(
    "How does the speaker feel about that cheese?",
    ["hate", "dislike", "meh", "like", "love"],
    id="feeling",
)

Open a session and start reading waves: session.run() connects to Sense, registers the questions, and yields waves. A wave is a batch of decisions taken over the last slice of audio:

session = app.session()
waves = session.run()  # returns async iterator

async def read_waves(waves):
    async for wave in waves:  # iterations can throw SenseUnavailable
        ...

Feed it audio concurrently. The SDK currently speaks 24 kHz PCM16 mono in 40 ms chunks. The audio push and the wave consumption must run at the same time — a blocking wave loop starves the audio — so we run them as concurrent tasks:

async def send_audio(mic, session):
    async for chunk in mic.chunks():
        session.audio.push(chunk)  # PCM16, mono, 24 kHz; one 40 ms block
    await session.close()  # audio ended — end the run loop so read_waves returns

tasks = [
    asyncio.create_task(send_audio(mic, session)),
    asyncio.create_task(read_waves(waves)),
]
await asyncio.gather(*tasks)

session.run() can also take audio/video/text iterators directly and pump them for you; this example pushes audio manually to keep the mic and the level meter in step.

Read decisions off each wave. Every answered question id has a result with a .value, and a confidence/probability .p. Additionally:

  • Choices return confidences for each option in .p_option(name)(normalized so they form a discrete probability distribution).
  • Scores return:
    • The argmax grade in .top
    • The probability of that grade in .p
    • The expected index value in .value, in this case (0..4) across 5 levels.

You will usually want to gate actions on the probability (the example requires p >= 0.6 to trust any result):

speaking = bool(wave.result("speech").value)
detection = wave.result("cheese")
if detection.p >= 0.6:
    kind = wave.result("cheese_type")
    name = kind.value if kind.p_option(kind.value) >= 0.6 else "unknown type"
    sentiment = wave.result("feeling")
    mood = sentiment.top if sentiment.p >= 0.6 else "undecided"
    mood_score = sentiment.value  # Expected index value

Close in the correct order. Cancel your tasks and let them settle, then waves.aclose() and await session.close():

try:
    await asyncio.gather(*tasks)
finally:
    for task in tasks:
        task.cancel()
    await asyncio.gather(*tasks, return_exceptions=True)  # settle both before closing
    await waves.aclose()
    await session.close()

Next steps

Beyond this example, the SDK also has app.predicate(fn) + app.when(pred, handler) for edge-triggered handlers, and app.onWave(handler) to observe every completed wave. Refer to the Sense reference for details.

Full example code

Metadata

Release files for urun-sense 0.1.4

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

Source distribution (sdist)

Source distribution for urun-sense 0.1.4
File Size Uploaded Provenance Actions
urun_sense-0.1.4.tar.gz 598.0 kB With provenance Details for urun_sense-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for urun-sense 0.1.4
File Interpreter ABI Platform Actions
urun_sense-0.1.4-py3-none-any.whl Python 3 none any Details for urun_sense-0.1.4-py3-none-any.whl

Total release size: 1.1 MB

Release files / urun_sense-0.1.4.tar.gz

Download URL urun_sense-0.1.4.tar.gz
Size 598.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0849ff837c3c7b36201fc4d22347a1debeda1aa8c75ce3f91c46dfc1a52876c9
BLAKE2b-256 checksum
How to use checksums
c968fcd358576e34a208dcb3e21d8b826f2a3e8eb1755f06613ba848c38cc595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / urun_sense-0.1.4-py3-none-any.whl

Download URL urun_sense-0.1.4-py3-none-any.whl
Size 489.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f7b0a279777fe4a421a944213a13cad36dda08f30f85c363c9f7a631c98d281
BLAKE2b-256 checksum
How to use checksums
0dfc1808cb0d8794fc2c7bb9a27f94f03eea916a56066b0a9aa82e5914dab43c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for urun-sense 0.1.4

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for urun_sense-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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