Runtime SDKsPython SDK

Python SDK

Install the Python 3.12+ sys.monitoring agent and attach it to your application lifecycle.

Install

Python 3.12 or newer is required because the agent uses PEP 669 sys.monitoring.

shell
python -m pip install liveprobe==0.3.0

Configure

dotenv
LIVEPROBE_BROKER_URL=https://liveprobe.tryastrea.tech
LIVEPROBE_PROJECT_ID=acme
LIVEPROBE_ENVIRONMENT=production
LIVEPROBE_SERVICE_ID=api
LIVEPROBE_API_KEY=lp_service_<shown-once-secret>
LIVEPROBE_COMMIT_SHA=<deployed-git-sha>

Keyword arguments override environment variables. Use the key issued for this exact project, environment, and service.

Application lifecycle

python
import os
import liveprobe

agent = liveprobe.start(
    service_id=os.environ["LIVEPROBE_SERVICE_ID"],
    broker_url=os.environ["LIVEPROBE_BROKER_URL"],
    api_key=os.environ.get("LIVEPROBE_API_KEY"),
    commit_sha=os.environ.get("LIVEPROBE_COMMIT_SHA"),
    project_id=os.environ.get("LIVEPROBE_PROJECT_ID"),
    environment=os.environ.get("LIVEPROBE_ENVIRONMENT"),
)

# Call from the framework's existing graceful shutdown path.
liveprobe.stop()

Start one process-wide agent after application initialization. In multiprocess deployments, each process starts its own agent instance and reports a distinct agent ID.

Source paths

Python does not use source maps. A probe file must match a runtime-known .py path or an unambiguous suffix of that path. Deploy the same source layout used to run the application.

Runtime behavior

  • Conditions, watches, logs, and metrics support safe expressions.
  • Log events support debug, info, warn, and error severity.
  • Snapshots can capture bounded locals for selected stack frames.
  • Safety reason codes include pause_budget, instrumentation_failure, and agent_worker_failure.
  • Broker-rejected invalid events are dropped instead of permanently blocking later queued events.