Skip to content

Observability

Content-capture config primitives for GLLM Core.

CaptureDomain

Bases: StrEnum

Common content-capture domain names.

Each member's value is the string a domain module passes as name= to build_content_capture_accessors, and the key used with capture_content. Membership is a discoverability aid only: the domain registry stays open, so capture_content still accepts any registered name, enum member or plain string.

ComponentIOCaptureConfig

Bases: ContentCaptureConfig

Configuration for capturing Component.run() input/output on trace spans.

Attributes:

Name Type Description
capture_input bool | list[str]

Whether, or which named kwargs, to capture from the component's input. An empty list captures nothing, equivalent to False.

capture_output bool

Whether to capture the component's output.

ContentCaptureConfig

Bases: BaseModel

Base for process-wide opt-in content-capture configs.

Attributes:

Name Type Description
max_attribute_bytes int

Maximum number of bytes to capture for each attribute. Defaults to DEFAULT_MAX_ATTRIBUTE_BYTES.

SpanAttribute

Span attributes for GLLM Core component instrumentation.

build_content_capture_accessors(default, *, name)

Build an isolated (configure, get) pair for one content-capture config domain.

The returned get_fn carries a .override context manager that scopes the domain's config to the current context; the domain is registered under name so capture_content(name=...) resolves to it.

Parameters:

Name Type Description Default
default T

The config a fresh domain starts with, and the exact instance restored whenever the returned configure function is called with None.

required
name str

Domain identifier stamped onto the returned functions' __name__ and __doc__ (e.g. "lm_trace_content"), used as the domain key by capture_content and get_registered_capture_domains.

required

Returns:

Type Description
Callable[[T | dict[str, Any] | None], None]

tuple[Callable, Callable]: The configure_fn and get_fn for this domain,

Callable[[], T]

each with its own isolated lock, global state, and context variable.

Raises:

Type Description
CoreValueError

If name is empty or whitespace-only, or if name is already registered as a content-capture domain.

capture_content(**domain_configs)

Scope one or more registered capture domains for the duration of the block.

Each keyword is a domain name (the name= passed to build_content_capture_accessors, e.g. component_io_capture); each value is that domain's complete capture config as a model or dict, or None to suppress the domain for the scope. Unlisted domains are untouched, and capture_content() with no keywords is a no-op.

Parameters:

Name Type Description Default
domain_configs ContentCaptureConfig | dict[str, Any] | None

Per-domain configs keyed by domain name.

{}

Raises:

Type Description
CoreKeyError

If a keyword names no registered domain; raised before any override is entered.

get_registered_capture_domains()

Return the sorted names of the capture domains currently registered.

Returns:

Type Description
list[str]

list[str]: One name per domain built via build_content_capture_accessors.

get_tracer()

Gets the GLLM Core tracer singleton.

Returns:

Type Description
Tracer

trace.Tracer: The versioned tracer for GLLM Core instrumentation.