> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sensecode.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How Sense Compares

> Sense against Python and the AI-application stack it's meant to replace parts of — feature by feature, honestly.

## Against Python, syntactically

The same program, side by side:

<CodeGroup>
  ```sns Sense theme={null}
  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
  ```

  ```python Python theme={null}
  def fib(n: int) -> int:
      if n < 2:
          return n
      return fib(n - 1) + fib(n - 2)

  i = 0
  while i < 10:
      print(fib(i))
      i = i + 1
  ```
</CodeGroup>

<Frame>
  |                                     | Sense                                                    | Python                    |
  | ----------------------------------- | -------------------------------------------------------- | ------------------------- |
  | Function keyword                    | `def` (deliberately, for this one concept only)          | `def`                     |
  | Variable declaration                | none — `x = 5`                                           | none — `x = 5`            |
  | Blocks                              | indentation                                              | indentation               |
  | Logic operators                     | `and` `or` `not`                                         | `and` `or` `not`          |
  | Return type                         | `-> Type` (optional, on `def`)                           | `-> type` (optional)      |
  | `tool`/`action`/`agent` return type | `returns Type` — a different shape on purpose, see below | n/a                       |
  | Nested-scope mutation               | just works (one rule)                                    | needs `nonlocal`/`global` |
  | Intentional shadowing               | `local x = ...`                                          | not directly expressible  |
</Frame>

Sense and Python actually converge quite a bit here — both land on
indentation, word-based logic operators, and `def`/`->` for a plain
function, because a plain function genuinely is the same concept in both
languages: no capability check, no audit entry, nothing Python doesn't
already have. Where they diverge is everything that *isn't* a plain
function — `tool`/`action`/`agent`/... each keep their own keyword-first
shape and `returns` for a return type, because each one does something
Python has no equivalent for (a permission check, a staged commit/
rollback lifecycle, a running entity with its own lifecycle) — plus the
scoping rule (Sense picked the less-surprising default over matching
Python).

## Against "Python + the AI stack"

This is the comparison that actually matters for Sense's thesis. A
conventional AI application needs a language plus a pile of libraries; a
Sense program needs the language.

<Frame>
  | Concern                                 | Conventional stack                                                            | Sense                                                                                  |
  | --------------------------------------- | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
  | Calling a model                         | An SDK client, vendor-specific                                                | `ask(prompt)` — vendor-agnostic, runtime-routed                                        |
  | Confidence / uncertainty                | Manual convention, easy to forget                                             | `Answer.value` / `.confidence` — structurally distinct from a plain value              |
  | Which model is "active"                 | A global variable, a config object, or a framework's context manager          | `set delegation`, scoped exactly like a variable — [see Sessions](/ai-native/sessions) |
  | Staging a side effect before it happens | A decorator or a manual two-step API someone has to remember to use correctly | `Action`'s prepare → verify → commit — enforced by the interpreter, not opt-in         |
  | Permission to do something              | Middleware, an IAM layer, a framework-specific guard                          | `policy: allow/deny`, checked at the language level, scoped like delegation            |
  | An agent that waits for approval        | Bespoke state machine, usually hand-rolled per project                        | `pause()`/`resume(agent)` — a real, tested interpreter feature                         |
</Frame>

## What Sense does *not* claim to beat Python at

Sense is explicit that it isn't trying to replace Python for general
software — see [Non-Goals](/philosophy/non-goals). No package ecosystem
remotely close to PyPI's, no mature tooling (debugger, profiler,
packaging) yet, no bytecode VM (Sense's reference implementation is a
tree-walking interpreter — see [Roadmap](/roadmap)). It doesn't need to
compete on libraries, though: [`import python "module"`](/language/python-interop)
reaches straight into any installed Python package, since Sense's own
interpreter is itself written in Python and runs in the same process.

## What Sense claims instead

Not "faster," not "more libraries." The claim is narrower and testable: for
software whose behavior is partly deterministic and partly probabilistic —
coding agents, research agents, enterprise autonomous workers — Sense makes
certain mistakes structurally harder to make by accident, because the
language itself understands the concepts a plain library can only offer as
convention.

## Continue

<CardGroup cols={2}>
  <Card title="The thesis" icon="lightbulb" href="/philosophy/thesis">
    The full argument for why this needed to be a language.
  </Card>

  <Card title="Roadmap" icon="map" href="/roadmap">
    What's actually built today vs. still ahead.
  </Card>
</CardGroup>
