uipath 2.1.90__py3-none-any.whl → 2.1.92__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of uipath might be problematic. Click here for more details.
- uipath/_cli/_evals/_runtime.py +4 -4
- uipath/_cli/_evals/mocks/llm_mocker.py +8 -3
- uipath/_cli/_evals/mocks/mocks.py +8 -1
- uipath/_cli/_push/sw_file_handler.py +5 -5
- uipath/_cli/_runtime/_contracts.py +68 -1
- uipath/_cli/_utils/_parse_ast.py +58 -32
- uipath/_cli/_utils/_project_files.py +9 -11
- uipath/_cli/_utils/_studio_project.py +17 -0
- uipath/_cli/cli_init.py +32 -28
- uipath/_cli/cli_pack.py +13 -11
- uipath/_cli/cli_push.py +4 -4
- uipath/_cli/models/__init__.py +0 -0
- uipath/_cli/models/runtime_schema.py +71 -0
- uipath/_events/_events.py +82 -4
- uipath/agent/_utils.py +1 -1
- uipath/agent/models/agent.py +227 -55
- uipath/agent/models/evals.py +56 -0
- uipath/telemetry/_track.py +1 -0
- {uipath-2.1.90.dist-info → uipath-2.1.92.dist-info}/METADATA +1 -1
- {uipath-2.1.90.dist-info → uipath-2.1.92.dist-info}/RECORD +23 -20
- {uipath-2.1.90.dist-info → uipath-2.1.92.dist-info}/WHEEL +0 -0
- {uipath-2.1.90.dist-info → uipath-2.1.92.dist-info}/entry_points.txt +0 -0
- {uipath-2.1.90.dist-info → uipath-2.1.92.dist-info}/licenses/LICENSE +0 -0
uipath/_cli/cli_push.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# type: ignore
|
|
2
2
|
import asyncio
|
|
3
3
|
import os
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any, Optional
|
|
5
5
|
from urllib.parse import urlparse
|
|
6
6
|
|
|
7
7
|
import click
|
|
@@ -32,7 +32,7 @@ def get_org_scoped_url(base_url: str) -> str:
|
|
|
32
32
|
|
|
33
33
|
async def upload_source_files_to_project(
|
|
34
34
|
project_id: str,
|
|
35
|
-
|
|
35
|
+
settings: Optional[dict[str, Any]],
|
|
36
36
|
directory: str,
|
|
37
37
|
include_uv_lock: bool = True,
|
|
38
38
|
) -> None:
|
|
@@ -50,7 +50,7 @@ async def upload_source_files_to_project(
|
|
|
50
50
|
include_uv_lock=include_uv_lock,
|
|
51
51
|
)
|
|
52
52
|
|
|
53
|
-
await sw_file_handler.upload_source_files(
|
|
53
|
+
await sw_file_handler.upload_source_files(settings)
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
@click.command()
|
|
@@ -99,7 +99,7 @@ def push(root: str, nolock: bool) -> None:
|
|
|
99
99
|
asyncio.run(
|
|
100
100
|
upload_source_files_to_project(
|
|
101
101
|
os.getenv(UIPATH_PROJECT_ID),
|
|
102
|
-
config,
|
|
102
|
+
config.get("settings", {}),
|
|
103
103
|
root,
|
|
104
104
|
include_uv_lock=not nolock,
|
|
105
105
|
)
|
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from typing import Any, Dict, List, Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
4
|
+
|
|
5
|
+
COMMON_MODEL_SCHEMA = ConfigDict(
|
|
6
|
+
validate_by_name=True,
|
|
7
|
+
validate_by_alias=True,
|
|
8
|
+
use_enum_values=True,
|
|
9
|
+
arbitrary_types_allowed=True,
|
|
10
|
+
extra="allow",
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Entrypoint(BaseModel):
|
|
15
|
+
file_path: str = Field(..., alias="filePath")
|
|
16
|
+
unique_id: str = Field(..., alias="uniqueId")
|
|
17
|
+
type: str = Field(..., alias="type")
|
|
18
|
+
input: Dict[str, Any] = Field(..., alias="input")
|
|
19
|
+
output: Dict[str, Any] = Field(..., alias="output")
|
|
20
|
+
|
|
21
|
+
model_config = COMMON_MODEL_SCHEMA
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class BindingResourceValue(BaseModel):
|
|
25
|
+
default_value: str = Field(..., alias="defaultValue")
|
|
26
|
+
is_expression: bool = Field(..., alias="isExpression")
|
|
27
|
+
display_name: str = Field(..., alias="displayName")
|
|
28
|
+
|
|
29
|
+
model_config = COMMON_MODEL_SCHEMA
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# TODO: create stronger binding resource definition with discriminator based on resource enum.
|
|
33
|
+
class BindingResource(BaseModel):
|
|
34
|
+
resource: str = Field(..., alias="resource")
|
|
35
|
+
key: str = Field(..., alias="key")
|
|
36
|
+
value: dict[str, BindingResourceValue] = Field(..., alias="value")
|
|
37
|
+
metadata: Any = Field(..., alias="metadata")
|
|
38
|
+
|
|
39
|
+
model_config = COMMON_MODEL_SCHEMA
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class Bindings(BaseModel):
|
|
43
|
+
version: str = Field(..., alias="version")
|
|
44
|
+
resources: List[BindingResource] = Field(..., alias="resources")
|
|
45
|
+
|
|
46
|
+
model_config = COMMON_MODEL_SCHEMA
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class RuntimeInternalArguments(BaseModel):
|
|
50
|
+
resource_overwrites: dict[str, Any] = Field(..., alias="resourceOverwrites")
|
|
51
|
+
|
|
52
|
+
model_config = COMMON_MODEL_SCHEMA
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class RuntimeArguments(BaseModel):
|
|
56
|
+
internal_arguments: Optional[RuntimeInternalArguments] = Field(
|
|
57
|
+
default=None, alias="internalArguments"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
model_config = COMMON_MODEL_SCHEMA
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class RuntimeSchema(BaseModel):
|
|
64
|
+
runtime: Optional[RuntimeArguments] = Field(default=None, alias="runtime")
|
|
65
|
+
entrypoints: List[Entrypoint] = Field(..., alias="entryPoints")
|
|
66
|
+
bindings: Bindings = Field(
|
|
67
|
+
default=Bindings(version="2.0", resources=[]), alias="bindings"
|
|
68
|
+
)
|
|
69
|
+
settings: Optional[Dict[str, Any]] = Field(default=None, alias="setting")
|
|
70
|
+
|
|
71
|
+
model_config = COMMON_MODEL_SCHEMA
|
uipath/_events/_events.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import enum
|
|
2
1
|
import logging
|
|
3
|
-
from
|
|
2
|
+
from enum import Enum
|
|
3
|
+
from typing import Any, Dict, List, Optional, Union
|
|
4
4
|
|
|
5
5
|
from opentelemetry.sdk.trace import ReadableSpan
|
|
6
|
-
from pydantic import BaseModel, ConfigDict, model_validator
|
|
6
|
+
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
7
7
|
|
|
8
8
|
from uipath._cli._evals._models._evaluation_set import EvaluationItem
|
|
9
9
|
from uipath.eval.models import EvalItemResult
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class EvaluationEvents(str,
|
|
12
|
+
class EvaluationEvents(str, Enum):
|
|
13
13
|
CREATE_EVAL_SET_RUN = "create_eval_set_run"
|
|
14
14
|
CREATE_EVAL_RUN = "create_eval_run"
|
|
15
15
|
UPDATE_EVAL_SET_RUN = "update_eval_set_run"
|
|
@@ -67,3 +67,81 @@ ProgressEvent = Union[
|
|
|
67
67
|
EvalRunUpdatedEvent,
|
|
68
68
|
EvalSetRunUpdatedEvent,
|
|
69
69
|
]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class EventType(str, Enum):
|
|
73
|
+
"""Types of events that can be emitted during execution."""
|
|
74
|
+
|
|
75
|
+
MESSAGE_CREATED = "message_created"
|
|
76
|
+
AGENT_STATE_UPDATED = "agent_state_updated"
|
|
77
|
+
ERROR = "error"
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class BaseEvent(BaseModel):
|
|
81
|
+
"""Base class for all UiPath events."""
|
|
82
|
+
|
|
83
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
84
|
+
|
|
85
|
+
event_type: EventType
|
|
86
|
+
metadata: Optional[Dict[str, Any]] = Field(
|
|
87
|
+
default=None, description="Additional event context"
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class MessageCreatedEvent(BaseEvent):
|
|
92
|
+
"""Event emitted when a message is created or streamed.
|
|
93
|
+
|
|
94
|
+
Wraps framework-specific message objects (e.g., LangChain BaseMessage,
|
|
95
|
+
CrewAI messages, AutoGen messages, etc.) without converting them.
|
|
96
|
+
|
|
97
|
+
Attributes:
|
|
98
|
+
payload: The framework-specific message object
|
|
99
|
+
event_type: Automatically set to MESSAGE_CREATED
|
|
100
|
+
metadata: Additional context (conversation_id, exchange_id, etc.)
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
# LangChain
|
|
104
|
+
event = MessageCreatedEvent(
|
|
105
|
+
payload=AIMessage(content="Hello"),
|
|
106
|
+
metadata={"conversation_id": "123"}
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
# Access the message
|
|
110
|
+
message = event.payload # BaseMessage
|
|
111
|
+
print(message.content)
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
payload: Any = Field(description="Framework-specific message object")
|
|
115
|
+
event_type: EventType = Field(default=EventType.MESSAGE_CREATED, frozen=True)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class AgentStateUpdatedEvent(BaseEvent):
|
|
119
|
+
"""Event emitted when agent state is updated.
|
|
120
|
+
|
|
121
|
+
Wraps framework-specific state update objects, preserving the original
|
|
122
|
+
structure and data from the framework.
|
|
123
|
+
|
|
124
|
+
Attributes:
|
|
125
|
+
payload: The framework-specific state update (e.g., LangGraph state dict)
|
|
126
|
+
node_name: Name of the node/agent that produced this update (if available)
|
|
127
|
+
event_type: Automatically set to AGENT_STATE_UPDATED
|
|
128
|
+
metadata: Additional context
|
|
129
|
+
|
|
130
|
+
Example:
|
|
131
|
+
# LangGraph
|
|
132
|
+
event = AgentStateUpdatedEvent(
|
|
133
|
+
payload={"messages": [...], "context": "..."},
|
|
134
|
+
node_name="agent_node",
|
|
135
|
+
metadata={"conversation_id": "123"}
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# Access the state
|
|
139
|
+
state = event.payload # dict
|
|
140
|
+
messages = state.get("messages", [])
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
payload: Dict[str, Any] = Field(description="Framework-specific state update")
|
|
144
|
+
node_name: Optional[str] = Field(
|
|
145
|
+
default=None, description="Name of the node/agent that caused this update"
|
|
146
|
+
)
|
|
147
|
+
event_type: EventType = Field(default=EventType.AGENT_STATE_UPDATED, frozen=True)
|
uipath/agent/_utils.py
CHANGED
|
@@ -29,7 +29,7 @@ async def get_file(
|
|
|
29
29
|
) -> Response:
|
|
30
30
|
resolved = resolve_path(folder, path)
|
|
31
31
|
assert isinstance(resolved, ProjectFile), "Path file not found."
|
|
32
|
-
return await studio_client.
|
|
32
|
+
return await studio_client.download_project_file_async(resolved)
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
async def create_agent_project(solution_id: str, project_name: str) -> str:
|
uipath/agent/models/agent.py
CHANGED
|
@@ -3,11 +3,8 @@
|
|
|
3
3
|
from enum import Enum
|
|
4
4
|
from typing import Annotated, Any, Dict, List, Literal, Optional, Union
|
|
5
5
|
|
|
6
|
-
from pydantic import BaseModel, ConfigDict, Discriminator, Field, Tag
|
|
6
|
+
from pydantic import BaseModel, ConfigDict, Discriminator, Field, Tag, field_validator
|
|
7
7
|
|
|
8
|
-
from uipath._cli._evals._models._evaluation_set import EvaluationSet
|
|
9
|
-
from uipath._cli._evals._models._evaluator import Evaluator
|
|
10
|
-
from uipath._cli._evals._models._mocks import ExampleCall
|
|
11
8
|
from uipath.models import Connection
|
|
12
9
|
|
|
13
10
|
|
|
@@ -17,6 +14,7 @@ class AgentResourceType(str, Enum):
|
|
|
17
14
|
TOOL = "tool"
|
|
18
15
|
CONTEXT = "context"
|
|
19
16
|
ESCALATION = "escalation"
|
|
17
|
+
MCP = "mcp"
|
|
20
18
|
|
|
21
19
|
|
|
22
20
|
class BaseAgentResourceConfig(BaseModel):
|
|
@@ -55,12 +53,14 @@ class AgentToolType(str, Enum):
|
|
|
55
53
|
"""Agent tool type."""
|
|
56
54
|
|
|
57
55
|
AGENT = "agent"
|
|
58
|
-
INTEGRATION = "integration"
|
|
59
56
|
PROCESS = "process"
|
|
57
|
+
API = "api"
|
|
58
|
+
PROCESS_ORCHESTRATION = "processorchestration"
|
|
59
|
+
INTEGRATION = "integration"
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
class AgentToolSettings(BaseModel):
|
|
63
|
-
"""Settings for tool
|
|
63
|
+
"""Settings for tool."""
|
|
64
64
|
|
|
65
65
|
max_attempts: Optional[int] = Field(None, alias="maxAttempts")
|
|
66
66
|
retry_delay: Optional[int] = Field(None, alias="retryDelay")
|
|
@@ -74,7 +74,9 @@ class AgentToolSettings(BaseModel):
|
|
|
74
74
|
class BaseResourceProperties(BaseModel):
|
|
75
75
|
"""Base resource properties."""
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
model_config = ConfigDict(
|
|
78
|
+
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
79
|
+
)
|
|
78
80
|
|
|
79
81
|
|
|
80
82
|
class AgentProcessToolProperties(BaseResourceProperties):
|
|
@@ -91,7 +93,12 @@ class AgentProcessToolProperties(BaseResourceProperties):
|
|
|
91
93
|
class AgentProcessToolResourceConfig(BaseAgentToolResourceConfig):
|
|
92
94
|
"""Tool resource with tool-specific properties."""
|
|
93
95
|
|
|
94
|
-
type: Literal[
|
|
96
|
+
type: Literal[
|
|
97
|
+
AgentToolType.AGENT,
|
|
98
|
+
AgentToolType.PROCESS,
|
|
99
|
+
AgentToolType.API,
|
|
100
|
+
AgentToolType.PROCESS_ORCHESTRATION,
|
|
101
|
+
]
|
|
95
102
|
output_schema: Dict[str, Any] = Field(
|
|
96
103
|
..., alias="outputSchema", description="Output schema for the tool"
|
|
97
104
|
)
|
|
@@ -101,6 +108,17 @@ class AgentProcessToolResourceConfig(BaseAgentToolResourceConfig):
|
|
|
101
108
|
settings: AgentToolSettings = Field(
|
|
102
109
|
default_factory=AgentToolSettings, description="Tool settings"
|
|
103
110
|
)
|
|
111
|
+
arguments: Dict[str, Any] = Field(
|
|
112
|
+
default_factory=dict, description="Tool arguments"
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
@field_validator("type", mode="before")
|
|
116
|
+
@classmethod
|
|
117
|
+
def normalize_type(cls, v: Any) -> str:
|
|
118
|
+
"""Normalize tool type to lowercase format."""
|
|
119
|
+
if isinstance(v, str):
|
|
120
|
+
return v.lower()
|
|
121
|
+
return v
|
|
104
122
|
|
|
105
123
|
model_config = ConfigDict(
|
|
106
124
|
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
@@ -133,7 +151,7 @@ class AgentIntegrationToolParameter(BaseModel):
|
|
|
133
151
|
|
|
134
152
|
|
|
135
153
|
class AgentIntegrationToolProperties(BaseResourceProperties):
|
|
136
|
-
"""Properties specific to tool
|
|
154
|
+
"""Properties specific to tool."""
|
|
137
155
|
|
|
138
156
|
tool_path: str = Field(..., alias="toolPath")
|
|
139
157
|
object_name: str = Field(..., alias="objectName")
|
|
@@ -141,7 +159,7 @@ class AgentIntegrationToolProperties(BaseResourceProperties):
|
|
|
141
159
|
tool_description: str = Field(..., alias="toolDescription")
|
|
142
160
|
method: str = Field(..., alias="method")
|
|
143
161
|
connection: Connection = Field(..., alias="connection")
|
|
144
|
-
body_structure: dict[str, Any] = Field(
|
|
162
|
+
body_structure: Optional[dict[str, Any]] = Field(None, alias="bodyStructure")
|
|
145
163
|
parameters: List[AgentIntegrationToolParameter] = Field([], alias="parameters")
|
|
146
164
|
|
|
147
165
|
model_config = ConfigDict(
|
|
@@ -154,26 +172,93 @@ class AgentIntegrationToolResourceConfig(BaseAgentToolResourceConfig):
|
|
|
154
172
|
|
|
155
173
|
type: Literal[AgentToolType.INTEGRATION] = AgentToolType.INTEGRATION
|
|
156
174
|
properties: AgentIntegrationToolProperties
|
|
175
|
+
arguments: Optional[Dict[str, Any]] = Field(
|
|
176
|
+
default_factory=dict, description="Tool arguments"
|
|
177
|
+
)
|
|
178
|
+
is_enabled: Optional[bool] = Field(None, alias="isEnabled")
|
|
179
|
+
|
|
180
|
+
@field_validator("type", mode="before")
|
|
181
|
+
@classmethod
|
|
182
|
+
def normalize_type(cls, v: Any) -> str:
|
|
183
|
+
"""Normalize tool type to lowercase format."""
|
|
184
|
+
if isinstance(v, str):
|
|
185
|
+
return v.lower()
|
|
186
|
+
return v
|
|
187
|
+
|
|
157
188
|
model_config = ConfigDict(
|
|
158
189
|
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
159
190
|
)
|
|
160
191
|
|
|
161
192
|
|
|
162
|
-
class AgentUnknownToolResourceConfig(
|
|
193
|
+
class AgentUnknownToolResourceConfig(BaseAgentResourceConfig):
|
|
163
194
|
"""Fallback for unknown or future tool types."""
|
|
164
195
|
|
|
165
196
|
resource_type: Literal[AgentResourceType.TOOL] = AgentResourceType.TOOL
|
|
166
197
|
type: str = Field(alias="$resourceType")
|
|
198
|
+
arguments: Optional[Dict[str, Any]] = Field(
|
|
199
|
+
default_factory=dict, description="Tool arguments"
|
|
200
|
+
)
|
|
201
|
+
is_enabled: Optional[bool] = Field(None, alias="isEnabled")
|
|
167
202
|
|
|
168
203
|
model_config = ConfigDict(extra="allow")
|
|
169
204
|
|
|
170
205
|
|
|
206
|
+
class AgentContextQuerySetting(BaseModel):
|
|
207
|
+
"""Query setting for context configuration."""
|
|
208
|
+
|
|
209
|
+
description: Optional[str] = Field(None)
|
|
210
|
+
variant: Optional[str] = Field(None)
|
|
211
|
+
|
|
212
|
+
model_config = ConfigDict(
|
|
213
|
+
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class AgentContextValueSetting(BaseModel):
|
|
218
|
+
"""Generic value setting for context configuration."""
|
|
219
|
+
|
|
220
|
+
value: Any = Field(...)
|
|
221
|
+
|
|
222
|
+
model_config = ConfigDict(
|
|
223
|
+
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
class AgentContextOutputColumn(BaseModel):
|
|
228
|
+
"""Output column configuration for Batch Transform."""
|
|
229
|
+
|
|
230
|
+
name: str = Field(...)
|
|
231
|
+
description: Optional[str] = Field(None)
|
|
232
|
+
|
|
233
|
+
model_config = ConfigDict(
|
|
234
|
+
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
|
|
171
238
|
class AgentContextSettings(BaseModel):
|
|
172
|
-
"""Settings for context
|
|
239
|
+
"""Settings for context."""
|
|
173
240
|
|
|
174
241
|
result_count: int = Field(alias="resultCount")
|
|
175
|
-
retrieval_mode: Literal["Semantic", "Structured"] =
|
|
242
|
+
retrieval_mode: Literal["Semantic", "Structured", "DeepRAG", "BatchTransform"] = (
|
|
243
|
+
Field(alias="retrievalMode")
|
|
244
|
+
)
|
|
176
245
|
threshold: float = Field(default=0)
|
|
246
|
+
query: Optional[AgentContextQuerySetting] = Field(None)
|
|
247
|
+
folder_path_prefix: Optional[Union[Dict[str, Any], AgentContextValueSetting]] = (
|
|
248
|
+
Field(None, alias="folderPathPrefix")
|
|
249
|
+
)
|
|
250
|
+
file_extension: Optional[Union[Dict[str, Any], AgentContextValueSetting]] = Field(
|
|
251
|
+
None, alias="fileExtension"
|
|
252
|
+
)
|
|
253
|
+
citation_mode: Optional[AgentContextValueSetting] = Field(
|
|
254
|
+
None, alias="citationMode"
|
|
255
|
+
)
|
|
256
|
+
web_search_grounding: Optional[AgentContextValueSetting] = Field(
|
|
257
|
+
None, alias="webSearchGrounding"
|
|
258
|
+
)
|
|
259
|
+
output_columns: Optional[List[AgentContextOutputColumn]] = Field(
|
|
260
|
+
None, alias="outputColumns"
|
|
261
|
+
)
|
|
177
262
|
|
|
178
263
|
model_config = ConfigDict(
|
|
179
264
|
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
@@ -187,19 +272,67 @@ class AgentContextResourceConfig(BaseAgentResourceConfig):
|
|
|
187
272
|
folder_path: str = Field(alias="folderPath")
|
|
188
273
|
index_name: str = Field(alias="indexName")
|
|
189
274
|
settings: AgentContextSettings = Field(..., description="Context settings")
|
|
275
|
+
is_enabled: Optional[bool] = Field(None, alias="isEnabled")
|
|
276
|
+
|
|
277
|
+
model_config = ConfigDict(
|
|
278
|
+
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
class AgentMcpTool(BaseModel):
|
|
283
|
+
"""MCP available tool."""
|
|
284
|
+
|
|
285
|
+
name: str = Field(..., alias="name")
|
|
286
|
+
description: str = Field(..., alias="description")
|
|
287
|
+
input_schema: Dict[str, Any] = Field(..., alias="inputSchema")
|
|
190
288
|
|
|
191
289
|
model_config = ConfigDict(
|
|
192
290
|
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
193
291
|
)
|
|
194
292
|
|
|
195
293
|
|
|
294
|
+
class AgentMcpResourceConfig(BaseAgentResourceConfig):
|
|
295
|
+
"""MCP resource configuration."""
|
|
296
|
+
|
|
297
|
+
resource_type: Literal[AgentResourceType.MCP] = Field(alias="$resourceType")
|
|
298
|
+
folder_path: str = Field(alias="folderPath")
|
|
299
|
+
slug: str = Field(..., alias="slug")
|
|
300
|
+
available_tools: List[AgentMcpTool] = Field(..., alias="availableTools")
|
|
301
|
+
is_enabled: Optional[bool] = Field(None, alias="isEnabled")
|
|
302
|
+
|
|
303
|
+
model_config = ConfigDict(
|
|
304
|
+
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
class AgentEscalationRecipientType(str, Enum):
|
|
309
|
+
"""Enum for escalation recipient types."""
|
|
310
|
+
|
|
311
|
+
USER_ID = "UserId"
|
|
312
|
+
GROUP_ID = "GroupId"
|
|
313
|
+
USER_EMAIL = "UserEmail"
|
|
314
|
+
|
|
315
|
+
|
|
196
316
|
class AgentEscalationRecipient(BaseModel):
|
|
197
317
|
"""Recipient for escalation."""
|
|
198
318
|
|
|
199
|
-
type:
|
|
319
|
+
type: Union[AgentEscalationRecipientType, str] = Field(..., alias="type")
|
|
200
320
|
value: str = Field(..., alias="value")
|
|
201
321
|
display_name: Optional[str] = Field(default=None, alias="displayName")
|
|
202
322
|
|
|
323
|
+
@field_validator("type", mode="before")
|
|
324
|
+
@classmethod
|
|
325
|
+
def normalize_type(cls, v: Any) -> str:
|
|
326
|
+
"""Normalize recipient type from int (1=UserId, 2=GroupId, 3=UserEmail) or string. Unknown integers are converted to string."""
|
|
327
|
+
if isinstance(v, int):
|
|
328
|
+
mapping = {
|
|
329
|
+
1: AgentEscalationRecipientType.USER_ID,
|
|
330
|
+
2: AgentEscalationRecipientType.GROUP_ID,
|
|
331
|
+
3: AgentEscalationRecipientType.USER_EMAIL,
|
|
332
|
+
}
|
|
333
|
+
return mapping.get(v, str(v))
|
|
334
|
+
return v
|
|
335
|
+
|
|
203
336
|
model_config = ConfigDict(
|
|
204
337
|
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
205
338
|
)
|
|
@@ -227,7 +360,7 @@ class AgentEscalationChannelProperties(BaseResourceProperties):
|
|
|
227
360
|
class AgentEscalationChannel(BaseModel):
|
|
228
361
|
"""Agent escalation channel."""
|
|
229
362
|
|
|
230
|
-
id: str = Field(
|
|
363
|
+
id: Optional[str] = Field(None, alias="id")
|
|
231
364
|
name: str = Field(..., alias="name")
|
|
232
365
|
type: str = Field(alias="type")
|
|
233
366
|
description: str = Field(..., alias="description")
|
|
@@ -239,8 +372,12 @@ class AgentEscalationChannel(BaseModel):
|
|
|
239
372
|
alias="outputSchema",
|
|
240
373
|
description="Output schema for the escalation channel",
|
|
241
374
|
)
|
|
375
|
+
outcome_mapping: Optional[Dict[str, str]] = Field(None, alias="outcomeMapping")
|
|
242
376
|
properties: AgentEscalationChannelProperties = Field(..., alias="properties")
|
|
243
377
|
recipients: List[AgentEscalationRecipient] = Field(..., alias="recipients")
|
|
378
|
+
task_title: Optional[str] = Field(default=None, alias="taskTitle")
|
|
379
|
+
priority: Optional[str] = None
|
|
380
|
+
labels: List[str] = Field(default_factory=list)
|
|
244
381
|
|
|
245
382
|
model_config = ConfigDict(
|
|
246
383
|
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
@@ -250,11 +387,11 @@ class AgentEscalationChannel(BaseModel):
|
|
|
250
387
|
class AgentEscalationResourceConfig(BaseAgentResourceConfig):
|
|
251
388
|
"""Escalation resource with escalation-specific properties."""
|
|
252
389
|
|
|
390
|
+
id: Optional[str] = Field(None, alias="id")
|
|
253
391
|
resource_type: Literal[AgentResourceType.ESCALATION] = Field(alias="$resourceType")
|
|
254
392
|
channels: List[AgentEscalationChannel] = Field(alias="channels")
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
is_agent_memory_enabled: bool = Field(alias="isAgentMemoryEnabled")
|
|
393
|
+
is_agent_memory_enabled: bool = Field(default=False, alias="isAgentMemoryEnabled")
|
|
394
|
+
escalation_type: int = Field(default=0, alias="escalationType")
|
|
258
395
|
|
|
259
396
|
model_config = ConfigDict(
|
|
260
397
|
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
@@ -269,9 +406,16 @@ def custom_discriminator(data: Any) -> str:
|
|
|
269
406
|
return "AgentContextResourceConfig"
|
|
270
407
|
elif resource_type == AgentResourceType.ESCALATION:
|
|
271
408
|
return "AgentEscalationResourceConfig"
|
|
409
|
+
elif resource_type == AgentResourceType.MCP:
|
|
410
|
+
return "AgentMcpResourceConfig"
|
|
272
411
|
elif resource_type == AgentResourceType.TOOL:
|
|
273
412
|
tool_type = data.get("type")
|
|
274
|
-
if tool_type
|
|
413
|
+
if tool_type in [
|
|
414
|
+
AgentToolType.AGENT,
|
|
415
|
+
AgentToolType.PROCESS,
|
|
416
|
+
AgentToolType.API,
|
|
417
|
+
AgentToolType.PROCESS_ORCHESTRATION,
|
|
418
|
+
]:
|
|
275
419
|
return "AgentProcessToolResourceConfig"
|
|
276
420
|
elif tool_type == AgentToolType.INTEGRATION:
|
|
277
421
|
return "AgentIntegrationToolResourceConfig"
|
|
@@ -296,47 +440,24 @@ AgentResourceConfig = Annotated[
|
|
|
296
440
|
],
|
|
297
441
|
Annotated[AgentContextResourceConfig, Tag("AgentContextResourceConfig")],
|
|
298
442
|
Annotated[AgentEscalationResourceConfig, Tag("AgentEscalationResourceConfig")],
|
|
443
|
+
Annotated[AgentMcpResourceConfig, Tag("AgentMcpResourceConfig")],
|
|
299
444
|
Annotated[AgentUnknownResourceConfig, Tag("AgentUnknownResourceConfig")],
|
|
300
445
|
],
|
|
301
446
|
Field(discriminator=Discriminator(custom_discriminator)),
|
|
302
447
|
]
|
|
303
448
|
|
|
304
449
|
|
|
305
|
-
class
|
|
306
|
-
"""
|
|
450
|
+
class AgentMetadata(BaseModel):
|
|
451
|
+
"""Metadata for agent."""
|
|
307
452
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
input_schema: Dict[str, Any] = Field(
|
|
311
|
-
..., alias="inputSchema", description="JSON schema for input arguments"
|
|
312
|
-
)
|
|
313
|
-
output_schema: Dict[str, Any] = Field(
|
|
314
|
-
..., alias="outputSchema", description="JSON schema for output arguments"
|
|
315
|
-
)
|
|
316
|
-
version: str = Field("1.0.0", description="Agent version")
|
|
317
|
-
resources: List[AgentResourceConfig] = Field(
|
|
318
|
-
..., description="List of tools, context, and escalation resources"
|
|
319
|
-
)
|
|
320
|
-
evaluation_sets: Optional[List[EvaluationSet]] = Field(
|
|
321
|
-
None,
|
|
322
|
-
alias="evaluationSets",
|
|
323
|
-
description="List of agent evaluation sets",
|
|
324
|
-
)
|
|
325
|
-
evaluators: Optional[List[Evaluator]] = Field(
|
|
326
|
-
None, description="List of agent evaluators"
|
|
327
|
-
)
|
|
453
|
+
is_conversational: bool = Field(alias="isConversational")
|
|
454
|
+
storage_version: str = Field(alias="storageVersion")
|
|
328
455
|
|
|
329
456
|
model_config = ConfigDict(
|
|
330
457
|
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
331
458
|
)
|
|
332
459
|
|
|
333
460
|
|
|
334
|
-
class AgentType(str, Enum):
|
|
335
|
-
"""Agent type."""
|
|
336
|
-
|
|
337
|
-
LOW_CODE = "lowCode"
|
|
338
|
-
|
|
339
|
-
|
|
340
461
|
class AgentMessageRole(str, Enum):
|
|
341
462
|
"""Enum for message roles."""
|
|
342
463
|
|
|
@@ -345,23 +466,31 @@ class AgentMessageRole(str, Enum):
|
|
|
345
466
|
|
|
346
467
|
|
|
347
468
|
class AgentMessage(BaseModel):
|
|
348
|
-
"""Message model for agent
|
|
469
|
+
"""Message model for agent definition."""
|
|
349
470
|
|
|
350
|
-
role: AgentMessageRole
|
|
471
|
+
role: Literal[AgentMessageRole.SYSTEM, AgentMessageRole.USER]
|
|
351
472
|
content: str
|
|
352
473
|
|
|
474
|
+
@field_validator("role", mode="before")
|
|
475
|
+
@classmethod
|
|
476
|
+
def normalize_role(cls, v: Any) -> str:
|
|
477
|
+
"""Normalize role to lowercase format."""
|
|
478
|
+
if isinstance(v, str):
|
|
479
|
+
return v.lower()
|
|
480
|
+
return v
|
|
481
|
+
|
|
353
482
|
model_config = ConfigDict(
|
|
354
483
|
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
355
484
|
)
|
|
356
485
|
|
|
357
486
|
|
|
358
487
|
class AgentSettings(BaseModel):
|
|
359
|
-
"""Settings for agent
|
|
488
|
+
"""Settings for agent."""
|
|
360
489
|
|
|
361
490
|
engine: str = Field(..., description="Engine type, e.g., 'basic-v1'")
|
|
362
|
-
model: str = Field(..., description="LLM model
|
|
491
|
+
model: str = Field(..., description="LLM model")
|
|
363
492
|
max_tokens: int = Field(
|
|
364
|
-
..., alias="maxTokens", description="Maximum number of tokens"
|
|
493
|
+
..., alias="maxTokens", description="Maximum number of tokens per completion"
|
|
365
494
|
)
|
|
366
495
|
temperature: float = Field(..., description="Temperature for response generation")
|
|
367
496
|
|
|
@@ -370,17 +499,60 @@ class AgentSettings(BaseModel):
|
|
|
370
499
|
)
|
|
371
500
|
|
|
372
501
|
|
|
502
|
+
class BaseAgentDefinition(BaseModel):
|
|
503
|
+
"""Agent definition model."""
|
|
504
|
+
|
|
505
|
+
input_schema: Dict[str, Any] = Field(
|
|
506
|
+
..., alias="inputSchema", description="JSON schema for input arguments"
|
|
507
|
+
)
|
|
508
|
+
output_schema: Dict[str, Any] = Field(
|
|
509
|
+
..., alias="outputSchema", description="JSON schema for output arguments"
|
|
510
|
+
)
|
|
511
|
+
|
|
512
|
+
model_config = ConfigDict(
|
|
513
|
+
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
class AgentType(str, Enum):
|
|
518
|
+
"""Agent type."""
|
|
519
|
+
|
|
520
|
+
LOW_CODE = "lowCode"
|
|
521
|
+
CODED = "coded"
|
|
522
|
+
|
|
523
|
+
|
|
373
524
|
class LowCodeAgentDefinition(BaseAgentDefinition):
|
|
374
525
|
"""Low code agent definition."""
|
|
375
526
|
|
|
376
527
|
type: Literal[AgentType.LOW_CODE] = AgentType.LOW_CODE
|
|
528
|
+
|
|
529
|
+
id: str = Field(..., description="Agent id or project name")
|
|
530
|
+
name: str = Field(..., description="Agent name or project name")
|
|
531
|
+
metadata: Optional[AgentMetadata] = Field(None, description="Agent metadata")
|
|
377
532
|
messages: List[AgentMessage] = Field(
|
|
378
533
|
..., description="List of system and user messages"
|
|
379
534
|
)
|
|
380
|
-
|
|
381
|
-
|
|
535
|
+
|
|
536
|
+
version: str = Field("1.0.0", description="Agent version")
|
|
537
|
+
resources: List[AgentResourceConfig] = Field(
|
|
538
|
+
..., description="List of tools, context, mcp and escalation resources"
|
|
539
|
+
)
|
|
540
|
+
features: List[Any] = Field(default_factory=list, description="Agent feature list")
|
|
541
|
+
settings: AgentSettings = Field(..., description="Agent settings")
|
|
542
|
+
|
|
543
|
+
model_config = ConfigDict(
|
|
544
|
+
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
545
|
+
)
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
class CodedAgentDefinition(BaseAgentDefinition):
|
|
549
|
+
"""Coded agent definition."""
|
|
550
|
+
|
|
551
|
+
type: Literal[AgentType.CODED] = AgentType.CODED
|
|
552
|
+
|
|
553
|
+
model_config = ConfigDict(
|
|
554
|
+
validate_by_name=True, validate_by_alias=True, extra="allow"
|
|
382
555
|
)
|
|
383
|
-
settings: AgentSettings = Field(..., description="Agent settings configuration")
|
|
384
556
|
|
|
385
557
|
|
|
386
558
|
KnownAgentDefinition = Annotated[
|