Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/uipath-core/src/uipath/core/adapters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Public surface:

- :class:`EvaluatorProtocol` – structural protocol the framework
- `EvaluatorProtocol` – structural protocol the framework
plugin expects from any policy evaluator.
"""

Expand Down
6 changes: 3 additions & 3 deletions packages/uipath-core/src/uipath/core/adapters/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
``uipath-core`` — plugins depend only on this structural protocol so
they can be swapped against any of them without code change.

``EvaluatorProtocol`` is a :class:`typing.Protocol` so any class whose
``EvaluatorProtocol`` is a `typing.Protocol` so any class whose
methods match the signatures below satisfies the contract without
inheritance.
"""
Expand All @@ -22,9 +22,9 @@
class EvaluatorProtocol(Protocol):
"""Structural protocol a framework plugin expects from a policy evaluator.

Every ``evaluate_*`` method returns an :class:`AuditRecord` — the
Every ``evaluate_*`` method returns an `AuditRecord` — the
per-hook audit envelope holding the per-rule
:class:`RuleEvaluation` list, the final action, and the trace /
`RuleEvaluation` list, the final action, and the trace /
agent metadata. Callers get a typed result; no downcasting is
required.
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Feature flags configuration for UiPath SDK.

A simple, local-only feature flag registry. Flags can be set
programmatically via :meth:`FeatureFlagsManager.configure_flags` or
programmatically via `FeatureFlagsManager.configure_flags()` or
supplied via environment variables named ``UIPATH_FEATURE_<FlagName>``
when nothing has been configured programmatically.

Programmatic values always take precedence over environment variables.

Example usage::
Example usage:

from uipath.core.feature_flags import FeatureFlags

Expand Down Expand Up @@ -58,7 +58,7 @@ def _parse_env_value(raw: str) -> Any:
class FeatureFlagsManager:
"""Singleton registry for UiPath feature flags.

Use the module-level :data:`FeatureFlags` instance rather than
Use the module-level `FeatureFlags` instance rather than
instantiating this class directly.
"""

Expand Down Expand Up @@ -90,7 +90,7 @@ def get_flag(self, name: str, *, default: Any = None) -> Any:

Resolution order:

1. Value set via :meth:`configure_flags` (highest priority)
1. Value set via `configure_flags()` (highest priority)
2. ``UIPATH_FEATURE_<name>`` environment variable (fallback when nothing configured)
3. *default*

Expand All @@ -108,7 +108,7 @@ def get_flag(self, name: str, *, default: Any = None) -> Any:
def is_flag_enabled(self, name: str, *, default: bool = False) -> bool:
"""Check whether a boolean flag is enabled.

Uses the same resolution order as :meth:`get_flag`.
Uses the same resolution order as `get_flag()`.

Args:
name: The feature flag name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Evaluator-agnostic types every governance consumer references — the
runtime layer, adapter packages, and customer code that catches
:class:`GovernanceBlockException`. The full runtime / audit /
`GovernanceBlockException`. The full runtime / audit /
native-evaluator implementation lives outside this package; this
core surface is just the contracts.
"""
Expand Down
6 changes: 3 additions & 3 deletions packages/uipath-core/src/uipath/core/governance/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Process-level feature-flag gate that decides whether the Python
governance checker runs at all. The
:class:`uipath.core.governance.EnforcementMode` value type is defined
in :mod:`uipath.core.governance.models`; the per-policy runtime state
`uipath.core.governance.EnforcementMode` value type is defined
in `uipath.core.governance.models`; the per-policy runtime state
that selects a mode (backend-supplied via the ``/runtime/policy``
client) lives outside this package.
"""
Expand All @@ -29,7 +29,7 @@ def is_governance_enabled() -> bool:

Resolution order:

1. :meth:`uipath.core.feature_flags.FeatureFlagsManager.is_flag_enabled` -
1. `uipath.core.feature_flags.FeatureFlagsManager.is_flag_enabled()` -
the in-process programmatic registry (typically populated from
gitops) and its own ``UIPATH_FEATURE_<name>`` env-var fallback.
2. Default ``False`` (governance disabled).
Expand Down
12 changes: 6 additions & 6 deletions packages/uipath-core/src/uipath/core/governance/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class GovernanceBlockException(Exception):
This exception indicates that the AI agent's operation was blocked by
a configured governance policy, not an unexpected system error.

Prefer the classmethod constructors (:meth:`from_violation`,
:meth:`from_audit_record`) when you have structured context — the
Prefer the classmethod constructors (`from_violation()`,
`from_audit_record()`) when you have structured context — the
default constructor is for raw-message use only.
"""

Expand All @@ -60,8 +60,8 @@ def __init__(
) -> None:
"""Construct from a pre-formatted message and optional structured context.

Most callers should use :meth:`from_violation` or
:meth:`from_audit_record` instead of passing structured context
Most callers should use `from_violation()` or
`from_audit_record()` instead of passing structured context
directly.
"""
self.violation = violation
Expand All @@ -76,7 +76,7 @@ def __init__(
def from_violation(
cls, violation: GovernanceViolation
) -> "GovernanceBlockException":
"""Build from a structured :class:`GovernanceViolation`."""
"""Build from a structured `GovernanceViolation`."""
return cls(
message=_format_violation_message(
violation.rule_id, violation.rule_name, violation.detail
Expand All @@ -88,7 +88,7 @@ def from_violation(

@classmethod
def from_audit_record(cls, audit_record: AuditRecord) -> "GovernanceBlockException":
"""Build from an :class:`AuditRecord` — first matched rule wins."""
"""Build from an `AuditRecord` — first matched rule wins."""
matched_rules = [e for e in audit_record.evaluations if e.matched]
if matched_rules:
rule = matched_rules[0]
Expand Down
6 changes: 3 additions & 3 deletions packages/uipath-core/src/uipath/core/governance/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
(``Rule``/``Check``/``Condition``) so adapter packages don't inherit
the native policy model:

- **Output types** (:class:`Action`, :class:`LifecycleHook`,
:class:`RuleEvaluation`, :class:`AuditRecord`) — cross the adapter
- **Output types** (`Action`, `LifecycleHook`,
`RuleEvaluation`, `AuditRecord`) — cross the adapter
boundary at evaluation time: every evaluator implementation (native,
AGT, composite, …) produces them, and every adapter consumes them.
- **Configuration value types** (:class:`EnforcementMode`) — describe
- **Configuration value types** (`EnforcementMode`) — describe
governance configuration shared by core and its consumers. The
per-policy runtime state that selects a mode lives outside this
package; only the value type lives here.
Expand Down
12 changes: 6 additions & 6 deletions packages/uipath-core/src/uipath/core/governance/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
centralised guardrail and write the per-rule LLMOps audit records.

Both have wire formats owned by the ``agenticgovernance_`` ingress.
Defining the contracts here — alongside :class:`EvaluatorProtocol` —
Defining the contracts here — alongside `EvaluatorProtocol` —
lets runtime consumers depend on stable protocols and receive a
concrete provider via constructor injection. Concrete providers live
outside this package; ``uipath-core`` does not import them.
Expand All @@ -32,9 +32,9 @@ class PolicyContext(BaseModel):

Wrapping the selectors in a model keeps the protocol surface stable
when the server grows new selector dimensions — adding a field here
doesn't change :meth:`GovernancePolicyProvider.get_policy`.
doesn't change `GovernancePolicyProvider.get_policy()`.

Today carries only :attr:`is_conversational`; future selectors land
Today carries only `is_conversational`; future selectors land
here.
"""

Expand All @@ -46,7 +46,7 @@ class PolicyContext(BaseModel):
class PolicyResponse(BaseModel):
"""Parsed governance backend response.

Wire envelope::
Wire envelope:

{
"mode": "audit" | "enforce" | "disabled",
Expand Down Expand Up @@ -150,7 +150,7 @@ class GovernancePolicyProvider(Protocol):
variant is the preferred entry point for hosts running on an event
loop (the host can overlap policy fetch with the rest of agent
setup via ``asyncio.create_task`` and ``await`` the resolved
:class:`PolicyResponse` before constructing the governance
`PolicyResponse` before constructing the governance
wrapper). The sync variant is kept for callers outside an event
loop (CLI tools, integration tests).

Expand All @@ -164,7 +164,7 @@ def get_policy(self, context: PolicyContext) -> PolicyResponse:
...

async def get_policy_async(self, context: PolicyContext) -> PolicyResponse:
"""Async variant of :meth:`get_policy`.
"""Async variant of `get_policy()`.

Hosts running on an event loop should use this so the fetch
doesn't block the loop and can overlap with other startup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ def create_quickform(
) -> Task:
"""Create a new QuickForm task synchronously.

See :meth:`create_quickform_async` for parameter docs.
See `create_quickform_async()` for parameter docs.
"""
spec = _create_quickform_spec(
title=title,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Service for managing Remote A2A agents in UiPath AgentHub.

.. warning::
Warning:
This module is experimental and subject to change.
The Remote A2A feature is in preview and its API may change in future releases.
"""
Expand All @@ -23,7 +23,7 @@
class RemoteA2aService(FolderContext, BaseService):
"""Service for managing Remote A2A agents in UiPath AgentHub.

.. warning::
Warning:
This service is experimental and subject to change.
"""

Expand All @@ -46,7 +46,7 @@ def list(
) -> List[RemoteA2aAgent]:
"""List Remote A2A agents.

.. warning::
Warning:
This method is experimental and subject to change.

When called without folder_path, returns all agents across
Expand Down Expand Up @@ -106,7 +106,7 @@ async def list_async(
) -> List[RemoteA2aAgent]:
"""Asynchronously list Remote A2A agents.

.. warning::
Warning:
This method is experimental and subject to change.

Args:
Expand Down Expand Up @@ -163,7 +163,7 @@ def retrieve(
) -> RemoteA2aAgent:
"""Retrieve a Remote A2A agent by its display name or legacy slug.

.. warning::
Warning:
This method is experimental and subject to change.

Args:
Expand Down Expand Up @@ -209,7 +209,7 @@ async def retrieve_async(
) -> RemoteA2aAgent:
"""Asynchronously retrieve a Remote A2A agent by display name or legacy slug.

.. warning::
Warning:
This method is experimental and subject to change.

Args:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Models for Remote A2A Agents in UiPath AgentHub.

.. warning::
Warning:
This module is experimental and subject to change.
The Remote A2A feature is in preview and its API may change in future releases.
"""
Expand Down Expand Up @@ -31,7 +31,7 @@ class RemoteA2aAgentFolder(BaseModel):
class RemoteA2aAgent(BaseModel):
"""Model representing a Remote A2A agent in UiPath AgentHub.

.. warning::
Warning:
This model is experimental and subject to change.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ def _get_caller_component() -> str:
def resolve_trace_id(fallback: str | None = None) -> str | None:
"""Resolve the current UiPath trace id as a 32-char hex string.

Same lookup chain :func:`_inject_trace_context` uses to compose the
Same lookup chain `_inject_trace_context()` uses to compose the
``x-uipath-traceparent-id`` header, exposed as a public helper so
callers can capture the value when they need it in a request body
(e.g. governance compensation) or before hopping to a background
thread that won't inherit the OpenTelemetry context.

Resolution order (first hit wins):

1. :attr:`UiPathConfig.trace_id` (``UIPATH_TRACE_ID`` env var),
normalized via :meth:`_SpanUtils.normalize_trace_id`. This is the
1. `UiPathConfig.trace_id` (``UIPATH_TRACE_ID`` env var),
normalized via `_SpanUtils.normalize_trace_id()`. This is the
canonical agent trace id the LLMOps exporter binds spans to.
2. The LLMOps external span trace id, when a provider is registered
via :meth:`UiPathSpanUtils.register_current_span_provider`.
via `UiPathSpanUtils.register_current_span_provider()`.
3. The current OpenTelemetry span trace id.
4. The caller-supplied ``fallback``.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ExecutionSourceContext:
variable and releases it on exit so it stays correctly scoped in concurrent
runs. The CLI enters this with ``UiPathRuntimeContext.execution_source`` so
platform clients can read it via
:attr:`UiPathExecutionContext.execution_source`.
`UiPathExecutionContext.execution_source`.
"""

def __init__(self, execution_source: str | None) -> None:
Expand Down Expand Up @@ -110,6 +110,6 @@ def execution_source(self) -> str | None:

Identifies the run context (e.g. ``runtime``/``playground``/``eval``),
derived from the CLI command and carried via
:class:`ExecutionSourceContext`. Returns ``None`` when not set.
`ExecutionSourceContext`. Returns ``None`` when not set.
"""
return _execution_source.get()
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ReferenceContext:
Each mutating call returns a new instance — the original is never
modified, preventing sibling spans from sharing context.

Usage::
Usage:

ctx = ReferenceContext.Empty
ctx = ctx.add("maestro", process_id, "2.1.0")
Expand Down Expand Up @@ -105,7 +105,7 @@ def add(
version: Optional version string.

Returns:
A new :class:`ReferenceContext` with the entry appended.
A new `ReferenceContext` with the entry appended.
"""
if not service_type or not service_type.strip():
raise ValueError("service_type must be a non-empty string.")
Expand Down Expand Up @@ -158,7 +158,7 @@ def from_baggage_header(header_value: Optional[str]) -> "ReferenceContext":
``"ref.type=agent;ref.id=<uuid>;ref.v=1.0,ref.type=maestro;ref.id=<uuid>"``

Returns:
Parsed :class:`ReferenceContext`, or :attr:`ReferenceContext.Empty`
Parsed `ReferenceContext`, or `ReferenceContext.Empty`
if the header is absent, empty, or contains no valid ref entries.
"""
if not header_value or not header_value.strip():
Expand Down Expand Up @@ -225,12 +225,12 @@ def to_baggage_header_value(self) -> str:


class ReferenceContextAccessor:
"""Ambient accessor for the current :class:`ReferenceContext`.
"""Ambient accessor for the current `ReferenceContext`.

Backed by :mod:`contextvars` so the value propagates across ``await``
Backed by `contextvars` so the value propagates across ``await``
boundaries without being threaded through every call signature.

Usage::
Usage:

token = ReferenceContextAccessor.set(ctx)
try:
Expand All @@ -254,7 +254,7 @@ def set(
) -> contextvars.Token[Optional[ReferenceContext]]:
"""Set the ambient context. Returns a token for restoration.

Pass the token to :meth:`reset` in a ``finally`` block.
Pass the token to `reset()` in a ``finally`` block.
"""
return cls._current.set(value)

Expand Down
Loading
Loading