Skip to content
Pyrula
Pre-release: the packages are not on PyPI yet, so pip install does not resolve. Build from source to try it today.

What leaves your runtime

Your local store is never redacted; replay reads its real arguments and results at every capture level. Capture levels and redaction govern only what leaves the process for Pyrula Cloud.

Cloud calls the capture level the data-sent setting. The values are metadata, lite and full in code, environment variables and the CLI, and the default is full. A level ships its class and everything below it: metadata is structure (ids, kinds, names, timing, status, error codes, usage counters), lite adds your workflow’s own data and failure text, and full adds model and tool traffic and live text.

Pick metadata when payloads must never leave your network, lite to see a workflow’s data in Cloud but keep prompts and tool traffic on your runtime, and full to replay and try a change in Cloud with everything recorded.

What Cloud sees, by level:

metadata lite full
Names, ids and timing yes yes yes
Counts and usage yes yes yes
Error type, code and fingerprint yes yes yes
Stream-overflow notices yes yes yes
Workflow params, step inputs and results no yes yes
An agent turn’s message and reply no no yes
Error messages and stack traces of your steps and runs no yes yes
Tool and sub-agent call errors no no yes
A terminate’s requester you named no no yes
Tool and model inputs and outputs no no yes
Live text while a reply streams no no yes
  • A withheld field keeps its key with the value [omitted: capture level]. An agent turn’s input and result stay on your runtime below full; declare @agent(capture="full") to see them in Cloud.
  • A model call records its request on llm:start and its reply on step:done.message; below full the request’s system and messages are withheld. Before they leave, each text, thinking block, tool input and tool result is cut to 16 KiB and marked _truncated, images and documents are replaced by a marker, thinking signatures are removed, and one event’s prompt stays under 48 KiB by dropping the oldest whole messages. The provider’s raw response never leaves your runtime.
  • hide_thinking=True records no thinking text on llm:start, and none reaches Cloud or the local HTTP surfaces (a streamed thinking delta arrives as [withheld]). The journal keeps it for replay.
  • Fingerprints (input_fingerprint, owner, closure_fingerprint), a Kafka record’s key and header values and an MCP call’s argument fingerprint never leave at any level. Identifiers you choose (run id, workflow or agent name, thread_id, user_id) ship at every level, so send opaque ids from your own system, never an email address or a person’s name.
  • A failure’s message and stack trace ship after redaction, cut to 2048 characters and 8 KiB: at lite for your own code, at full for a model, tool or sub-agent call, which can quote what a model said. At metadata only code, error_type and error_fingerprint ship. Redaction catches token and key patterns, not a plain password quoted in the text, so keep secrets out of exception text.
  • Live text (block:start, block:delta, block:stop) reaches Cloud at full unless PYRULA_CLOUD_LIVE_TEXT is off.

The following example is one agent turn that calls a lookup_order tool, asks the model to draft a reply and then fails on a second tool call. It shows what Cloud receives for the same run at each level:

Event metadata lite full
The tool call lookup_order(order_id="A-1042") step id, kind tool, duration, status the same plus the arguments {"order_id": "A-1042"} and the result {"status": "shipped"}
The model call model name, token counts, duration (Cloud estimates the cost) the same plus the request messages (the system prompt, the customer’s message) and the reply text
The failure on the second tool error_fingerprint, plus error_type and the code once the failure ends the turn the same, because the failure is a tool’s plus the tool’s error text and the exception’s arguments
The turn’s message and reply withheld withheld both

Every setting is a ceiling, and the lowest one wins.

  1. @workflow(capture=...) / @agent(capture=...). A capture= on Runner or CloudRunReporter acts as the declaration for workflows that have none.
  2. PYRULA_CLOUD_CAPTURE. An invalid value stops the runtime at startup, naming the variable.
  3. The key’s ceiling in Cloud, delivered when the worker registers. A key with no ceiling caps nothing.
  4. The dashboard’s config.update, applied last, to agents and workflows alike.

With none of these set, the level is full. Nothing is sent until a register has answered, and the cap is applied at send time, so a lowered ceiling also strips events already queued; raising it never restores what was stripped. pyrula dev prints the effective level and where it came from.

Everything that leaves (Cloud events, control-command failure acks, OpenTelemetry content and exception text) passes through these steps in order:

  1. Capture level. A withheld field never reaches redaction.
  2. Secret-shaped keys. A dict key at any depth containing a name like api_key, password, secret, token, authorization or cookie (case-insensitive) is masked with its whole value. Usage counters such as input_tokens are not masked.
  3. Secret-shaped values in text. Credentials in URLs (postgres://user:pw@host/db) and in key=value, key: value, JSON or repr assignments using those names, including Authorization: Bearer <token>.
  4. Known token formats, with no key: Anthropic, OpenAI, GitHub, AWS and other provider keys, JWTs and PEM private keys.
  5. Your policy (below).
  6. Size caps. A string over 64 KB is cut to a redacted prefix. A dict or list over that is replaced by {_truncated, _original_bytes}. Free-text detail such as an error message is capped at 2,048 characters.

A secret with no recognizable shape, such as a bespoke token or a plaintext business secret under an innocent key, still ships; keep it out of run arguments or use a lower capture level.

Extra key names, matched like the built-in ones:

Terminal window
export PYRULA_REDACT_KEYS="tenant_pin,badge_number"

Or set a process-wide policy at startup (replaces PYRULA_REDACT_KEYS):

import re
from pyrula.contracts.redaction import RedactionPolicy, set_redaction_policy
set_redaction_policy(
RedactionPolicy(
extra_keys=("tenant_pin", "badge_number"),
never_redact_keys=(
"signature",
), # exempt a name; secret-shaped values in it are still masked
extra_value_patterns=(re.compile(r"ACME-\d{6}"),),
)
)

See the redaction API reference.

mask runs once on the whole payload about to leave, after everything above and before the size caps:

def mask(data):
# `data` has already been through the built-in redaction.
if isinstance(data, dict) and "customer_email" in data:
data = dict(data)
data["customer_email"] = "[masked]"
return data
set_redaction_policy(RedactionPolicy(mask=mask))

redaction_hook on AppConfig or RunRouterConfig is separate: it runs on what an HTTP client receives, never on events sent to Cloud.

A control command’s failure ack and a Kafka dead-letter record’s pyrula.error.message header follow the failure-text rule above, cut to 2,048 characters (bytes for the header). Below the level that ships the message they name only the exception type.

Replays and forks run on your side from the local store, so they work at every level. The level only limits what Cloud shows.

With pyrula.agents.observability.configure, prompt and completion content on spans is off unless OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT is set or you pass capture_content=True. configure_langfuse, configure_langsmith and configure_datadog turn it on by default. Recorded content, error statuses and exceptions are redacted as above.

View this page as Markdown