Skip to content

Commit 72abea4

Browse files
committed
fix: update readme
1 parent d671446 commit 72abea4

File tree

1 file changed

+39
-11
lines changed

1 file changed

+39
-11
lines changed

README.md

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# UiPath Runtime
22

3+
[![PyPI downloads](https://img.shields.io/pypi/dm/uipath-runtime.svg)](https://pypi.org/project/uipath-runtime/)
4+
[![Python versions](https://img.shields.io/pypi/pyversions/uipath-runtime.svg)](https://pypi.org/project/uipath-runtime/)
5+
36
Core runtime abstractions and contracts for the UiPath Python SDK.
47

58
## Overview
@@ -27,16 +30,41 @@ class MyCustomRuntime(UiPathBaseRuntime):
2730
def __init__(self, context: UiPathRuntimeContext):
2831
super().__init__(context)
2932

33+
async def get_schema(self) -> UiPathRuntimeSchema:
34+
# Returns the runtime's JSON schemas
35+
return UiPathRuntimeSchema(
36+
input={
37+
"type": "object",
38+
"properties": {
39+
"message": {
40+
"type": "string",
41+
"description": "Input message"
42+
}
43+
},
44+
"required": ["message"]
45+
},
46+
output={
47+
"type": "object",
48+
"properties": {
49+
"result": {
50+
"type": "string",
51+
"description": "Execution result"
52+
}
53+
},
54+
"required": ["result"]
55+
}
56+
)
57+
3058
async def execute(self) -> UiPathRuntimeResult:
31-
# Execute your agent logic
59+
# Execute framework-specific agent invoke logic
3260
return UiPathRuntimeResult(
3361
output={"result": "success"},
3462
status=UiPathRuntimeStatus.SUCCESSFUL
3563
)
3664

3765
async def stream(
3866
self,
39-
) -> AsyncGenerator[Union[UiPathRuntimeEvent, UiPathRuntimeResult], None]:
67+
) -> AsyncGenerator[UiPathRuntimeEvent, None]:
4068
# Stream events during execution for real-time monitoring
4169
yield UiPathRuntimeStateEvent(
4270
payload={"status": "starting"},
@@ -69,30 +97,30 @@ class MyCustomRuntime(UiPathBaseRuntime):
6997
The factory pattern handles runtime instantiation, instrumentation, and tracing:
7098

7199
```python
72-
from uipath.runtime import UiPathRuntimeFactory, UiPathRuntimeContext
100+
from uipath.runtime import UiPathRuntimeFactory, UiPathRuntimeContext, UiPathRuntimeExecutor
73101

74-
factory = UiPathRuntimeFactory(
75-
MyCustomRuntime,
76-
UiPathRuntimeContext,
77-
)
102+
factory = UiPathRuntimeFactory(MyCustomRuntime)
103+
104+
executor = UiPathRuntimeExecutor()
78105

79106
# Add OpenTelemetry instrumentation
80-
factory.add_instrumentor(MyInstrumentor, get_current_span)
107+
executor.add_instrumentor(MyInstrumentor, get_current_span)
81108

82109
# Add span exporters for tracing
83-
factory.add_span_exporter(JsonLinesFileExporter("trace.jsonl"))
110+
executor.add_span_exporter(JsonLinesFileExporter("trace.jsonl"))
84111

85112
# Execute
86113
context = UiPathRuntimeContext(entrypoint="main.py", input='{"query": "hello"}')
87-
result = await factory.execute(context)
114+
async with factory.from_context(context):
115+
result = await executor.execute(runtime)
88116
```
89117

90118
### Event Streaming
91119

92120
Runtimes can stream events during execution for real-time monitoring:
93121

94122
```python
95-
async for event in factory.stream(context):
123+
async for event in executor.stream(runtime):
96124
if isinstance(event, UiPathRuntimeStateEvent):
97125
print(f"State update: {event.payload}")
98126
elif isinstance(event, UiPathRuntimeMessageEvent):

0 commit comments

Comments
 (0)