UiPath Runtime abstractions
Project description
UiPath Runtime
Core runtime abstractions and contracts for the UiPath Python SDK.
Overview
uipath-runtime provides the foundational interfaces and base classes for building agent runtimes in the UiPath ecosystem. It defines the contracts that all runtime implementations must follow, handles execution context, event streaming, tracing, and error management.
This package is typically used as a dependency by higher-level packages like uipath-langchain, uipath-llamaindex, or the main uipath SDK. You would use this directly only if you're building custom runtime implementations.
Installation
uv add uipath-runtime
Core Concepts
Runtime Base Class
All runtimes extend UiPathBaseRuntime and implement these core methods:
from uipath.runtime import UiPathBaseRuntime, UiPathRuntimeContext, UiPathRuntimeResult, UiPathRuntimeEvent
class MyCustomRuntime(UiPathBaseRuntime):
def __init__(self, context: UiPathRuntimeContext):
super().__init__(context)
async def execute(self) -> UiPathRuntimeResult:
# Execute your agent logic
return UiPathRuntimeResult(
output={"result": "success"},
status=UiPathRuntimeStatus.SUCCESSFUL
)
async def stream(
self,
) -> AsyncGenerator[Union[UiPathRuntimeEvent, UiPathRuntimeResult], None]:
# Stream events during execution for real-time monitoring
yield UiPathRuntimeStateEvent(
payload={"status": "starting"},
execution_id=self.context.execution_id
)
# Yield final result
yield UiPathRuntimeResult(
output={"completed": True},
status=UiPathRuntimeStatus.SUCCESSFUL
)
async def validate(self) -> None:
# Validate configuration before execution
if not self.context.entrypoint:
raise UiPathRuntimeError(
UiPathErrorCode.ENTRYPOINT_MISSING,
"Missing entrypoint",
"Detailed error message here",
UiPathErrorCategory.USER,
)
async def cleanup(self) -> None:
# Clean up resources after execution
pass
Runtime Factory
The factory pattern handles runtime instantiation, instrumentation, and tracing:
from uipath.runtime import UiPathRuntimeFactory, UiPathRuntimeContext
factory = UiPathRuntimeFactory(
MyCustomRuntime,
UiPathRuntimeContext,
)
# Add OpenTelemetry instrumentation
factory.add_instrumentor(MyInstrumentor, get_current_span)
# Add span exporters for tracing
factory.add_span_exporter(JsonLinesFileExporter("trace.jsonl"))
# Execute
context = UiPathRuntimeContext(entrypoint="main.py", input='{"query": "hello"}')
result = await factory.execute(context)
Event Streaming
Runtimes can stream events during execution for real-time monitoring:
async for event in factory.stream(context):
if isinstance(event, UiPathRuntimeStateEvent):
print(f"State update: {event.payload}")
elif isinstance(event, UiPathRuntimeMessageEvent):
print(f"Message: {event.payload}")
elif isinstance(event, UiPathRuntimeResult):
print(f"Completed: {event.output}")
Execution Context
Runtime context carries configuration and state throughout execution:
context = UiPathRuntimeContext(
entrypoint="agent.py",
input='{"query": "hello"}',
job_id="job-123",
resume=False,
)
Error Handling
Structured error handling with categorization:
from uipath.runtime.error import (
UiPathRuntimeError,
UiPathErrorCode,
UiPathErrorCategory
)
raise UiPathRuntimeError(
UiPathErrorCode.EXECUTION_ERROR,
"Failed to execute agent",
"Detailed error message here",
UiPathErrorCategory.USER,
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uipath_runtime-0.0.2.tar.gz.
File metadata
- Download URL: uipath_runtime-0.0.2.tar.gz
- Upload date:
- Size: 75.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56edfd83e7b18ebda8357b6b223125dc737d1c89074546db7517a431b2e59420
|
|
| MD5 |
623313d1ad42bfcedde470a92fe44a37
|
|
| BLAKE2b-256 |
3ba6e449ee481d4c5bc6a8edfac9d9246a9593fcf9fa415f829259dc28cf11bc
|
Provenance
The following attestation bundles were made for uipath_runtime-0.0.2.tar.gz:
Publisher:
cd.yml on UiPath/uipath-runtime-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uipath_runtime-0.0.2.tar.gz -
Subject digest:
56edfd83e7b18ebda8357b6b223125dc737d1c89074546db7517a431b2e59420 - Sigstore transparency entry: 661328075
- Sigstore integration time:
-
Permalink:
UiPath/uipath-runtime-python@68e8d701841da02886f4872696b8591f0e1ba8f5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/UiPath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@68e8d701841da02886f4872696b8591f0e1ba8f5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file uipath_runtime-0.0.2-py3-none-any.whl.
File metadata
- Download URL: uipath_runtime-0.0.2-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b090ce8971eb9fa99e67bd17c83dd78bb518ffa2619b1d3c242ca9affee01bb9
|
|
| MD5 |
9493ec4ca5c03ca4f4dd65dee41e22f9
|
|
| BLAKE2b-256 |
3910c26f590d14fb060a2402f75cab8488ab4c5465d9d29ee64290526507295f
|
Provenance
The following attestation bundles were made for uipath_runtime-0.0.2-py3-none-any.whl:
Publisher:
cd.yml on UiPath/uipath-runtime-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uipath_runtime-0.0.2-py3-none-any.whl -
Subject digest:
b090ce8971eb9fa99e67bd17c83dd78bb518ffa2619b1d3c242ca9affee01bb9 - Sigstore transparency entry: 661328084
- Sigstore integration time:
-
Permalink:
UiPath/uipath-runtime-python@68e8d701841da02886f4872696b8591f0e1ba8f5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/UiPath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@68e8d701841da02886f4872696b8591f0e1ba8f5 -
Trigger Event:
push
-
Statement type: