The agentic loop that gives an app an embodied AI presence. Install embodiment in an app or wrap one, supply a model seam plus IO callbacks, and it drives the perceive-decide-act loop and the presence pump - extracted from colleague so the loop is written once and imported, not reimplemented per host.
pip install embodiment==0.21.0 Copy PIP instructions
Gwen, a background realtime voice app — a daemon that listens through a microphone array, answers in Hebrew through a speaker model on the lobes gateway, remembers what it is explicitly asked to, and shows what it is doing on a dashboard. Underneath it is a small, tested core for giving an app an embodied AI presence.
The daemon is built and runs, on one rig. embodiment start launches it; it has run live Hebrew turns with the operator through a reSpeaker XVF3800, stored and recalled memory across a restart, been interrupted mid-sentence, and been watched from a phone. Every module was reviewed and probed on the device or in a browser before it was merged.
Its usefulness is unmeasured. Nothing here claims that Gwen is worth talking to. Acceptance is on one rig only — one array, one gateway, one operator, one language — and the acceptance run (t21, a human at the microphone) publishes latency as measured, including if it is bad. See docs/live-test-results/2026-09-22-t21-acceptance.md when t21's result file lands; until it does, no number in this repo describes the daemon's turn latency, its echo cancellation or its speakability, and this README quotes none.
Known from the integration runs, not yet measured:
Measured once, on this rig, in docs/live-test-results/2026-10-23-recall-gemma2.md (aggregates only; one person's store of 24 records; queries written by a model, not spoken by a person — none of it is a measurement of real use):
The library read path (0.18.0) is built; its retrieval was measured once on this rig, and its value is unmeasured. In docs/live-test-results/2026-10-24-library.md (aggregates only, model-written questions, through the daemon's own search route, 50 indexed items): hit@5 was 19 of 32 and 17 of 28 on two question sets, with 0 of 10 off-topic false positives in each run and a search p90 of 0.21 s. Transcripts alone scored 6 of 11 (index version 1). Most misses are the threshold returning nothing: the library similarity threshold reuses memory's 0.715 and is provisional and not calibrated on library text. Transcripts reach the library through culture-rules (decision c21): 33 Pocket transcripts were there on 2026-10-24.
The rig was re-probed on 2026-10-23: senses, worker and gemma2-embed are ready but proxied; stt and tts are ready and local. Roles resolve by name; re-probe before relying on this.
Everything that used to live here — the strategist tier, the configuration lane, the muse, drones, the example hosts and the old live-test results — is archived in git history, not deleted from the record. The tag archive/pre-realtime-0.14.0 is the last commit that contains it; its own published verdicts (mechanism proven, value not) are quoted in CLAUDE.md, and the redesign inherits that honesty: it makes no value claim until it has a measurement.
"Embodiment" is an overloaded word in this mesh. This package is software presence, not a body: it gives an application ears, a voice, memory and a loop. It does not drive hardware and nothing here claims a body.
Retention: recordings are kept. Every clip the page sends (recorded on its mic or uploaded) is kept as it arrived, before it is transcribed (d10), and so is every utterance the room microphone hears, from speech onset to its end, as a WAV (d11); the silence between utterances is not written. They live under recordings/ in the state directory: 0600 files named by their sha256, in a 0700 directory, capped at 2 GiB. A recording past the cap is refused and recorded, and nothing is deleted to make room. Archiving to S3 is tracked in #99. Transcripts go to a private, size-bounded, per-session log (0600) under the state directory (0700). Each turn says how it arrived (d7), links its recording, and carries typed timestamps (d12): created, recorded, witnessed, received, transcribed, generated, with the page's own times marked by: client.
uv sync # creates .venv with the approved dependencies uv run embodiment doctor # identity invariants; nothing is started The gateway key comes from the grant CLI and is injected into the daemon's environment for that one process. There is no env-file fallback: the daemon reads EMBODIMENT_GATEWAY_KEY (or the mesh-wide CULTURE_VLLM_API_KEY) from its environment and nothing else, and the key never reaches a browser, an asset, an event, a log line or a status field.
grant run --inject EMBODIMENT_GATEWAY_KEY=LOBES_GATEWAY_API_KEY -- uv run embodiment start uv run embodiment status uv run embodiment stop start returns once the daemon has reported itself running, not merely once a process exists; a second start finds the first and starts nothing. EMBODIMENT_GATEWAY_URL selects the gateway (default http://localhost:8001); its stt lane must be local to that gateway, because the realtime session never crosses machines (the gateway refuses to tunnel a WebSocket to a proxied peer).
The library is optional. Set EMBODIMENT_LIBRARY_URL and EMBODIMENT_LIBRARY_KEY; the key is injected, never written by Gwen:
From another device on your tailnet, bind off loopback and name the host a browser will send:
None of the following is in this release. Each is a stated seam or a stated absence, not an implication.
embodiment tunnel prints the cultureflare/cloudflared commands for exposing the daemon beyond loopback — it is dry-run only: unlike lobes tunnel there is no --apply flag here at all, because provisioning a Cloudflare Tunnel and Access app is the operator's act, run by hand from the printed command, never something this verb does itself.
embodiment tunnel embodiment tunnel --json embodiment tunnel --hostname gwen.example.org --allow me@example.com embodiment tunnel --with-service-token The default hostname is gwen.culture.dev. It prints two commands and runs neither, then the Access environment variable names the daemon needs (names only, never values):
A printed command is only honest if pasting it does what it says. --hostname (RFC-1123 labels), --allow (exactly one @, no whitespace) and --tunnel-name ([A-Za-z0-9._-] only) are refused at parse time — a structured error:/hint: and exit 1 — if they fall outside that charset, and every token of a printed command line is shlex.quote-d regardless. So embodiment tunnel --tunnel-name 'a; touch pwned' is refused outright, and even a value that somehow bypassed that check would still print as one inert quoted token, never a second shell command.
What Cloudflare Access protects, and what it does not. Access sits in front of exactly one thing: requests arriving for the public hostname named by --hostname. It never gates loopback names (localhost, 127.0.0.1, ::1) — those never cross Cloudflare's edge at all, so there is nothing for Access to intercept. Loopback is not authentication, so the daemon does not rely on Access alone either (see below).
How the daemon validates the assertion. embodiment/http/access.py verifies the Cf-Access-Jwt-Assertion JWT with the standard library (RS256 is one modular exponentiation, so no new dependency): the kid must name a key in the team JWKS, the signature must verify, iss must be the team domain, aud must contain the application's AUD tag, the token must be inside nbf..exp, and the person must be on the operator's email allow-list. The guard applies it to every guarded request whose Host is the configured public hostname, and only those. Configure it with three environment variables, set together or not at all (names only here; the values come from the Access app):
and name the public Host with embodiment start --public-hostname (or EMBODIMENT_PUBLIC_HOSTNAME); a daemon started without it treats no Host as public, and status()["http"]["public_hostname_configured"] says which. With the Access env unset the guard is unchanged and refuses every assertion (http-access-verifier-missing); a partial set refuses every assertion and records it (http-access-config-incomplete). An unreachable JWKS is infrastructure, not a bad token: the request is refused with 503 and the outage is recorded once. Every refusal has a fixed reason that carries no token or email.
On the public Host a valid assertion replaces the install secret, so the operator reaches the dashboard and chat at gwen.culture.dev by signing in with Cloudflare. Every other Host (loopback, a tailnet name) still needs the install secret, whatever assertion it carries — an assertion off the public Host did not come through Cloudflare. Because Cloudflare attaches the assertion to any request carrying the CF_Authorization cookie, an Access-admitted request must also carry an allow-listed Origin or Sec-Fetch-Site: same-origin (a CSRF rule); the event stream is closed when the assertion expires. This is verified against synthetic tokens in tests; a live pass through Cloudflare is the operator's, and is not claimed here.
Service tokens are refused. Gwen's public surface is for a person: a valid assertion that names a service token (no person) is refused (http-access-service-token), as is a person who is not on the allow-list (http-access-email-not-allowed). --with-service-token still prints the cultureflare flag, but it does not admit a non-browser client here; a robot relay is a future, separate seam.
Memory ingest. Producers (Pocket recordings, culture-rules' daily newspaper) enqueue facts with embodiment memory ingest --file [--apply] and embodiment memory forget. The verbs validate and enqueue only, and are a dry run unless --apply; the daemon is the single writer of the store. A newspaper issue is archived together 30 days after its issue date. Recalled facts are cited by their source in the chat view.
embodiment/audio/remote.py is a websockets server that speaks the lobes /v1/realtime wire inbound, implementing the same AudioEndpoint protocol embodiment/audio/host.py implements for the machine's own microphone and speaker. A client dials in, the WebSocket handshake completes carrying no credential at all, and the FIRST message on the socket must be {"type": "auth", "secret": "..."} — checked against an install secret (or a per-endpoint secret) in constant time before any other message, audio included, is ever processed. A wrong, missing, malformed or late first message closes the socket (code 1008) and is recorded. The secret deliberately never rides the connect URL — a URL lands in proxy access logs, browser history and Referer headers, all of which this repo's privacy rules forbid for a credential.
v1 ships no robot support and wires no client to it. The endpoint and the browser-side BrowserEar are built and tested; the daemon composes only the host endpoint today. What ships is the seam — one AudioEndpoint implementation among several the daemon can compose — so a browser ear or a robot relay speaking the same wire is a future, separate step, arrived at without touching the daemon that composes endpoints.
Dependencies are human-gated: tests/test_zero_deps.py pins the exact approved set and fails on any change in either direction.
Host audio runs through pw-record/pw-play (or arecord/aplay) as subprocesses — no in-process audio library (deviation d4). lobes-cli is reached over the network only and is forbidden as a dependency.
embodiment start # the daemon, detached; idempotent embodiment status # the daemon's state, truthfully; never starts anything embodiment stop # bounded stop; a SIGKILL is reported and recorded embodiment tunnel # print the remote-access commands; runs nothing embodiment whoami # identity from culture.yaml embodiment learn # structured self-teaching prompt embodiment explain # markdown docs; `explain ` for any verb embodiment overview # descriptive snapshot embodiment doctor # agent-identity invariants embodiment cli overview # the CLI surface Every verb takes --json. Results go to stdout, errors and diagnostics to stderr, never mixed. Exit codes: 0 success, 1 user error, 2 environment error. No Python traceback ever reaches stderr.
uv sync uv run pytest -n auto uv run pytest --cov=embodiment --cov-report=term # gate: 60% uv run teken cli doctor . --strict # the agent-first rubric CI enforces Lint stack (line length 100): black, isort, flake8, bandit, markdownlint-cli2. Every PR bumps the version. The dashboard has its own vitest suite under web/.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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.
None of the files in this release were uploaded with provenance metadata.
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.




