Skip to main content

behave-core

← repo

The shared observation envelope for BEHAVE. Defines the wire format that behave-shell and behave-text serialize all behavioral observations into. Every sensor in the BEHAVE ecosystem emits the same Observation structure — the domain-specific meaning lives in primitive and value; the envelope provides identity, provenance, time window, and schema versioning.

What it provides

Symbol Type Description
OBSERVATION_SCHEMA_VERSION int Envelope schema version (currently 1). Bumped when field shapes change; federation gossip receivers reject mismatched versions.
Observation Pydantic model One behavioral observation: a single primitive measured over a time window. The core class is registry-agnostic — it does not validate primitive or value against any specific domain. Use the registry-aware subclasses in behave-shell or behave-text for full validation.
ObservationValue Union[str, int, float, bool, list[str], list[int], list[float], dict] Type alias covering all valid value shapes.
Window Pydantic model The measurement window: start_ts and end_ts in epoch seconds. Distinct from Observation.ts (the emission time) — a sensor may compute an observation over a past window and emit it later.

Observation fields

Field Type Required Description
primitive str ✓ Fully-qualified primitive path, e.g. motor.keystroke_cadence
value ObservationValue ✓ The measured value; shape validated by the domain registry
confidence float [0,1] ✓ Sensor's confidence in this measurement (not in any attribution verdict)
window Window ✓ Measurement time window
source str ✓ Canonical sensor identifier, e.g. behave/sniffer/timing.py
evidence_ref str | None — Pointer to underlying raw evidence (session tape, pcap). Never the evidence itself — see PII note below.
identity_ref str | None — AttackerIdentity UUID if the observation is pre-attributed
ts float auto Emission timestamp, epoch seconds
id str auto UUID hex for deduplication
v int auto Envelope schema version (= OBSERVATION_SCHEMA_VERSION)

PII discipline (non-negotiable)

BEHAVE observations carry categorical labels, timing aggregates, and hashes only. They must never carry:

  • Raw keystroke content or command arguments
  • Passwords, tokens, session keys, or any authentication material
  • File contents or payload bytes
  • Raw message text (especially in behave-text)

evidence_ref is a pointer to underlying evidence held elsewhere. Never the evidence itself.

Install

pip install -e .
# or, as a dependency of behave-shell / behave-text:
pip install -e ../core/

Quickstart

from behave_core.spec import Observation, Window, OBSERVATION_SCHEMA_VERSION

obs = Observation(
    primitive="motor.keystroke_cadence",
    value="bursty",
    confidence=0.82,
    window=Window(start_ts=1714000000.0, end_ts=1714003600.0),
    source="behave/shell-sensor/timing.py",
)
print(obs.model_dump_json())

Tests

pytest tests/

License

Code: GPL-3.0-or-later

Release files for behave-core 0.1.1

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

Source distribution (sdist)

Source distribution for behave-core 0.1.1
File Size Uploaded
behave_core-0.1.1.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for behave-core 0.1.1
File Interpreter ABI Platform
behave_core-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / behave_core-0.1.1.tar.gz

Download URL behave_core-0.1.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4a2bb518699fbd36eb12e7ab3f0dfc6f7d848e55f661683aa49a19f0894b61a7
BLAKE2b-256 checksum
How to use checksums
c12b06c12e01e8b1f61aa21389f1e3b31e03cab267c185ff3c4633105de1bff7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / behave_core-0.1.1-py3-none-any.whl

Download URL behave_core-0.1.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd730fabfed0c88790d91fd024c9e5088833c6dc89bda471d016e3723469ee41
BLAKE2b-256 checksum
How to use checksums
a9b0c907e469e15b8b2e98fb23164ec35027ac677d6e8bc4345ad8ebe07ddb9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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