orxtra v0.13.0 /tool.src.orxtra.tool._scrub
On this page

Shared secret scrubbing used by both the local and remote worker pipelines: scrub_text/scrub_data/scrub_tool_output replace real secret values with placeholders in text and structured data via SecretRegistry.scrub.

#tool.src.orxtra.tool._scrub

#tool.src.orxtra.tool._scrub

Shared secret scrubbing for tool execution pipelines.

Both the local pipeline (tool/_pipeline.py) and the remote pipeline (worker/_pipeline_split.py) call these functions. The drift-sentinel test asserts that both pipelines reference this module.

#_ScrubEncoder

JSON encoder that handles common non-serializable types.

Covers UUID, Decimal, datetime, Path, dataclasses, and pydantic models -- the same types _ExtendedEncoder and JsonRenderer._to_serializable handle in _renderers.py.

#default

python
def default(self, o: object) -> Any

#scrub_text

python
def scrub_text(registry: SecretRegistry, text: str) -> str

Scrub secret values from a text string.

#scrub_data

python
def scrub_data(registry: SecretRegistry, data: Any) -> Any

Scrub secret values from structured data.

Serializes data to JSON (handling dataclasses, pydantic models, UUIDs, etc.), scrubs the JSON string, and deserializes back. The returned value is a dict/list/scalar (deserialized JSON) rather than the original typed object -- acceptable since data flows into trace/transcripts as serialized JSON anyway.

Returns data unchanged if it is None or not JSON-serializable.

#scrub_tool_output

python
def scrub_tool_output(registry: SecretRegistry, result: ToolOutput[Any]) -> ToolOutput[Any]

Scrub both text and data fields of a ToolOutput.

Search