agent-lab-sdk 0.1.44__py3-none-any.whl → 0.1.45__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 agent-lab-sdk might be problematic. Click here for more details.

@@ -10,13 +10,14 @@ from .input_types import (
10
10
  SwitchInput,
11
11
  FileInput,
12
12
  FilesInput,
13
- SelectOption
13
+ SelectOption,
14
+ Visibility
14
15
  )
15
16
 
16
17
  __all__ = [
17
18
  "LogMessage",
18
19
  "MainInput",
19
- "StringInput",
20
+ "StringInput",
20
21
  "StringArrayInput",
21
22
  "StringArrayInputInline",
22
23
  "NumberInput",
@@ -25,5 +26,6 @@ __all__ = [
25
26
  "SwitchInput",
26
27
  "FileInput",
27
28
  "FilesInput",
28
- "SelectOption"
29
+ "SelectOption",
30
+ "Visibility"
29
31
  ]
@@ -1,35 +1,54 @@
1
1
  from typing import List, Optional, Any
2
+ from enum import Enum
2
3
  from pydantic import BaseModel
3
4
  from pydantic.json_schema import WithJsonSchema
4
5
 
5
6
 
6
- def MainInput(placeholder: str | None = None) -> type:
7
+ class Visibility(str, Enum):
8
+ """
9
+ Enum representing visibility states for input fields.
10
+
11
+ Attributes:
12
+ ALWAYS: Field is always visible
13
+ START: Field is visible only at start
14
+ AFTER_START: Field is visible after start
15
+ """
16
+ ALWAYS = "always"
17
+ START = "start"
18
+ AFTER_START = "after_start"
19
+
20
+
21
+ def MainInput(placeholder: str | None = None, visibility: str | Visibility = Visibility.ALWAYS) -> type:
7
22
  """
8
23
  Factory function for creating a main input type with optional placeholder.
9
-
24
+
10
25
  Args:
11
26
  placeholder: Optional placeholder text for the input field
12
-
27
+ visibility: Visibility state of the field (default: "always")
28
+
13
29
  Returns:
14
30
  Type annotation for main input field
15
31
  """
16
32
  return WithJsonSchema({
17
33
  "type": "main-input",
18
34
  "placeholder": placeholder,
35
+ "visibility": visibility.value if isinstance(visibility, Visibility) else visibility,
19
36
  })
20
37
 
21
38
 
22
- def StringInput(default: str | None = None, title: str | None = None, description: str | None = None, hidden: bool | None = False, depends: str | None = None) -> type:
39
+ def StringInput(default: str | None = None, title: str | None = None, description: str | None = None,
40
+ hidden: bool | None = False, depends: str | None = None, visibility: str | Visibility = Visibility.ALWAYS) -> type:
23
41
  """
24
42
  Factory function for creating a string input type.
25
-
43
+
26
44
  Args:
27
45
  default: Default value for the string input
28
46
  title: Title for the string input
29
47
  description: Description text for the string input
30
48
  hidden: Whether the input should be hidden in the UI
31
49
  depends: Specifies the parameter that this value depends on or is derived from.
32
-
50
+ visibility: Visibility state of the field (default: "always")
51
+
33
52
  Returns:
34
53
  Type annotation for string input field
35
54
  """
@@ -40,13 +59,15 @@ def StringInput(default: str | None = None, title: str | None = None, descriptio
40
59
  "description": description,
41
60
  "hidden": hidden,
42
61
  "depends": depends,
62
+ "visibility": visibility.value if isinstance(visibility, Visibility) else visibility,
43
63
  })
44
64
 
45
65
 
46
- def StringArrayInput(placeholder: str | None = None, title: str | None = None, description: str | None = None, group: str | None = None, hidden: bool | None = False, depends: str | None = None) -> type:
66
+ def StringArrayInput(placeholder: str | None = None, title: str | None = None, description: str | None = None,
67
+ group: str | None = None, hidden: bool | None = False, depends: str | None = None, visibility: str | Visibility = Visibility.ALWAYS) -> type:
47
68
  """
48
69
  Factory function for creating a string array input type.
49
-
70
+
50
71
  Args:
51
72
  placeholder: Placeholder text for the input field
52
73
  title: Title for the string array input
@@ -54,7 +75,8 @@ def StringArrayInput(placeholder: str | None = None, title: str | None = None, d
54
75
  group: Group name for organizing inputs in the UI
55
76
  hidden: Whether the input should be hidden in the UI
56
77
  depends: Specifies the parameter that this value depends on or is derived from.
57
-
78
+ visibility: Visibility state of the field (default: "always")
79
+
58
80
  Returns:
59
81
  Type annotation for string array input field
60
82
  """
@@ -66,11 +88,12 @@ def StringArrayInput(placeholder: str | None = None, title: str | None = None, d
66
88
  "group": group,
67
89
  "hidden": hidden,
68
90
  "depends": depends,
91
+ "visibility": visibility.value if isinstance(visibility, Visibility) else visibility,
69
92
  })
70
93
 
71
94
 
72
95
  def StringArrayInputInline(placeholder: str | None = None, title: str | None = None, description: str | None = None,
73
- group: str | None = None, hidden: bool | None = False, depends: str | None = None) -> type:
96
+ group: str | None = None, hidden: bool | None = False, depends: str | None = None, visibility: str | Visibility = Visibility.ALWAYS) -> type:
74
97
  """
75
98
  Factory function for creating a string array input inline type.
76
99
 
@@ -81,6 +104,7 @@ def StringArrayInputInline(placeholder: str | None = None, title: str | None = N
81
104
  group: Group name for organizing inputs in the UI
82
105
  hidden: Whether the input should be hidden in the UI
83
106
  depends: Specifies the parameter that this value depends on or is derived from.
107
+ visibility: Visibility state of the field (default: "always")
84
108
 
85
109
  Returns:
86
110
  Type annotation for string array input field
@@ -93,20 +117,23 @@ def StringArrayInputInline(placeholder: str | None = None, title: str | None = N
93
117
  "group": group,
94
118
  "hidden": hidden,
95
119
  "depends": depends,
120
+ "visibility": visibility.value if isinstance(visibility, Visibility) else visibility,
96
121
  })
97
122
 
98
123
 
99
- def NumberInput(default: float | None = None, title: str | None = None, description: str | None = None, hidden: bool | None = False, depends: str | None = None) -> type:
124
+ def NumberInput(default: float | None = None, title: str | None = None, description: str | None = None,
125
+ hidden: bool | None = False, depends: str | None = None, visibility: str | Visibility = Visibility.ALWAYS) -> type:
100
126
  """
101
127
  Factory function for creating a number input type.
102
-
128
+
103
129
  Args:
104
130
  default: Default value for the number input
105
131
  title: Title for the number input
106
132
  description: Description text for the number input
107
133
  hidden: Whether the input should be hidden in the UI
108
134
  depends: Specifies the parameter that this value depends on or is derived from.
109
-
135
+ visibility: Visibility state of the field (default: "always")
136
+
110
137
  Returns:
111
138
  Type annotation for number input field
112
139
  """
@@ -117,6 +144,7 @@ def NumberInput(default: float | None = None, title: str | None = None, descript
117
144
  "description": description,
118
145
  "hidden": hidden,
119
146
  "depends": depends,
147
+ "visibility": visibility.value if isinstance(visibility, Visibility) else visibility,
120
148
  })
121
149
 
122
150
 
@@ -134,10 +162,11 @@ class SelectOption(BaseModel):
134
162
  description: Optional[str] = None
135
163
 
136
164
 
137
- def SelectInput(items: List[Any] = [], title: str | None = None, group: str | None = None, default: str | None = None, hidden: bool | None = False, depends: str | None = None) -> type:
165
+ def SelectInput(items: List[Any] = [], title: str | None = None, group: str | None = None, default: str | None = None,
166
+ hidden: bool | None = False, depends: str | None = None, visibility: str | Visibility = Visibility.ALWAYS) -> type:
138
167
  """
139
168
  Factory function for creating a select input type.
140
-
169
+
141
170
  Args:
142
171
  items: List of SelectOption objects or dictionaries
143
172
  title: Title for the select input
@@ -145,7 +174,8 @@ def SelectInput(items: List[Any] = [], title: str | None = None, group: str | No
145
174
  default: Default selected value
146
175
  hidden: Whether the input should be hidden in the UI
147
176
  depends: Specifies the parameter that this value depends on or is derived from.
148
-
177
+ visibility: Visibility state of the field (default: "always")
178
+
149
179
  Returns:
150
180
  Type annotation for select input field
151
181
  """
@@ -157,13 +187,15 @@ def SelectInput(items: List[Any] = [], title: str | None = None, group: str | No
157
187
  "default": default,
158
188
  "hidden": hidden,
159
189
  "depends": depends,
190
+ "visibility": visibility.value if isinstance(visibility, Visibility) else visibility,
160
191
  })
161
192
 
162
193
 
163
- def CheckboxInput(title: str | None = None, group: str | None = None, description: str | None = None, default: bool | None = False, hidden: bool | None = False, depends: str | None = None) -> type:
194
+ def CheckboxInput(title: str | None = None, group: str | None = None, description: str | None = None,
195
+ default: bool | None = False, hidden: bool | None = False, depends: str | None = None, visibility: str | Visibility = Visibility.ALWAYS) -> type:
164
196
  """
165
197
  Factory function for creating a checkbox input type.
166
-
198
+
167
199
  Args:
168
200
  title: Title for the checkbox
169
201
  group: Group name for organizing inputs in the UI
@@ -171,7 +203,8 @@ def CheckboxInput(title: str | None = None, group: str | None = None, descriptio
171
203
  default: Default checked state
172
204
  hidden: Whether the input should be hidden in the UI
173
205
  depends: Specifies the parameter that this value depends on or is derived from.
174
-
206
+ visibility: Visibility state of the field (default: "always")
207
+
175
208
  Returns:
176
209
  Type annotation for checkbox input field
177
210
  """
@@ -183,11 +216,12 @@ def CheckboxInput(title: str | None = None, group: str | None = None, descriptio
183
216
  "default": default,
184
217
  "hidden": hidden,
185
218
  "depends": depends,
219
+ "visibility": visibility.value if isinstance(visibility, Visibility) else visibility,
186
220
  })
187
221
 
188
222
 
189
223
  def SwitchInput(title: str | None = None, group: str | None = None, description: str | None = None,
190
- default: bool | None = False, hidden: bool | None = False, depends: str | None = None) -> type:
224
+ default: bool | None = False, hidden: bool | None = False, depends: str | None = None, visibility: str | Visibility = Visibility.ALWAYS) -> type:
191
225
  """
192
226
  Factory function for creating a switch input type.
193
227
 
@@ -198,6 +232,7 @@ def SwitchInput(title: str | None = None, group: str | None = None, description:
198
232
  default: Default checked state
199
233
  hidden: Whether the input should be hidden in the UI
200
234
  depends: Specifies the parameter that this value depends on or is derived from.
235
+ visibility: Visibility state of the field (default: "always")
201
236
 
202
237
  Returns:
203
238
  Type annotation for switch input field
@@ -210,20 +245,23 @@ def SwitchInput(title: str | None = None, group: str | None = None, description:
210
245
  "default": default,
211
246
  "hidden": hidden,
212
247
  "depends": depends,
248
+ "visibility": visibility.value if isinstance(visibility, Visibility) else visibility,
213
249
  })
214
250
 
215
251
 
216
- def FileInput(title: str | None = None, file_extensions: str | None = None, group: str | None = None, hidden: bool | None = False, depends: str | None = None) -> type:
252
+ def FileInput(title: str | None = None, file_extensions: str | None = None, group: str | None = None,
253
+ hidden: bool | None = False, depends: str | None = None, visibility: str | Visibility = Visibility.ALWAYS) -> type:
217
254
  """
218
255
  Factory function for creating a single file input type.
219
-
256
+
220
257
  Args:
221
258
  title: Title for the file input
222
259
  file_extensions: Comma-separated list of allowed file extensions (e.g., ".pdf,.txt")
223
260
  group: Group name for organizing inputs in the UI
224
261
  hidden: Whether the input should be hidden in the UI
225
262
  depends: Specifies the parameter that this value depends on or is derived from.
226
-
263
+ visibility: Visibility state of the field (default: "always")
264
+
227
265
  Returns:
228
266
  Type annotation for file input field
229
267
  """
@@ -234,14 +272,15 @@ def FileInput(title: str | None = None, file_extensions: str | None = None, grou
234
272
  "group": group,
235
273
  "hidden": hidden,
236
274
  "depends": depends,
275
+ "visibility": visibility.value if isinstance(visibility, Visibility) else visibility,
237
276
  })
238
277
 
239
278
 
240
279
  def FilesInput(title: str | None = None, file_extensions: str | None = None, group: str | None = None,
241
- hidden: bool | None = False, depends: str | None = None, limit: int | None = 10) -> type:
280
+ hidden: bool | None = False, depends: str | None = None, limit: int | None = 10, visibility: str | Visibility = Visibility.ALWAYS) -> type:
242
281
  """
243
282
  Factory function for creating a multiple files input type.
244
-
283
+
245
284
  Args:
246
285
  title: Title for the files input
247
286
  file_extensions: Comma-separated list of allowed file extensions (e.g., ".pdf,.txt")
@@ -249,6 +288,7 @@ def FilesInput(title: str | None = None, file_extensions: str | None = None, gro
249
288
  hidden: Whether the input should be hidden in the UI
250
289
  depends: Specifies the parameter that this value depends on or is derived from.
251
290
  limit: Limit count files.
291
+ visibility: Visibility state of the field (default: "always")
252
292
 
253
293
  Returns:
254
294
  Type annotation for files input field
@@ -261,4 +301,5 @@ def FilesInput(title: str | None = None, file_extensions: str | None = None, gro
261
301
  "hidden": hidden,
262
302
  "depends": depends,
263
303
  "limit": limit,
304
+ "visibility": visibility.value if isinstance(visibility, Visibility) else visibility,
264
305
  })
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-lab-sdk
3
- Version: 0.1.44
3
+ Version: 0.1.45
4
4
  Summary: SDK для работы с Agent Lab
5
5
  Author-email: Andrew Ohurtsov <andermirik@yandex.com>
6
6
  License: Proprietary and Confidential — All Rights Reserved
@@ -262,7 +262,7 @@ from typing import List, Annotated
262
262
  from pydantic import BaseModel, Field
263
263
  from agent_lab_sdk.schema import (
264
264
  MainInput, StringInput, StringArrayInput, NumberInput,
265
- SelectInput, CheckboxInput, FileInput, FilesInput, SelectOption
265
+ SelectInput, CheckboxInput, FileInput, FilesInput, SelectOption, Visibility
266
266
  )
267
267
 
268
268
  class AgentState(BaseModel):
@@ -273,7 +273,8 @@ class AgentState(BaseModel):
273
273
  title: Annotated[str, StringInput(
274
274
  default="Без названия",
275
275
  title="Заголовок",
276
- description="Название для вашего запроса"
276
+ description="Название для вашего запроса",
277
+ visibility=Visibility.ALWAYS # или visibility="always"
277
278
  )]
278
279
 
279
280
  # Массив строк
@@ -327,18 +328,18 @@ class AgentState(BaseModel):
327
328
 
328
329
  #### Доступные фабричные функции
329
330
 
330
- | Тип | Описание | Основные параметры |
331
- |--------------------------|-----------------------------------|---------------------------------------------------------------------|
332
- | `MainInput` | Основное поле ввода | `placeholder` |
333
- | `StringInput` | Текстовое поле | `default`, `title`, `description`, `hidden`, `depends` |
334
- | `StringArrayInput` | Массив строк | `placeholder`, `title`, `description`, `group`, `hidden`, `depends` |
335
- | `StringArrayInputInline` | Массив строк в одной строке ввода | `placeholder`, `title`, `description`, `group`, `hidden`, `depends` |
336
- | `NumberInput` | Числовое поле | `default`, `title`, `description`, `hidden`, `depends` |
337
- | `SelectInput` | Выпадающий список | `items`, `title`, `group`, `default`, `hidden`, `depends` |
338
- | `CheckboxInput` | Чекбокс | `title`, `group`, `description`, `default`, `hidden`, `depends` |
339
- | `SwitchInput` | Switch | `title`, `group`, `description`, `default`, `hidden`, `depends` |
340
- | `FileInput` | Загрузка одного файла | `title`, `file_extensions`, `group`, `hidden`, `depends` |
341
- | `FilesInput` | Загрузка нескольких файлов | `title`, `file_extensions`, `group`, `hidden`, `depends`, `limit` |
331
+ | Тип | Описание | Основные параметры |
332
+ |--------------------------|-----------------------------------|-----------------------------------------------------------------------------------|
333
+ | `MainInput` | Основное поле ввода | `placeholder`, `visibility` |
334
+ | `StringInput` | Текстовое поле | `default`, `title`, `description`, `hidden`, `depends`, `visibility` |
335
+ | `StringArrayInput` | Массив строк | `placeholder`, `title`, `description`, `group`, `hidden`, `depends`, `visibility` |
336
+ | `StringArrayInputInline` | Массив строк в одной строке ввода | `placeholder`, `title`, `description`, `group`, `hidden`, `depends`, `visibility` |
337
+ | `NumberInput` | Числовое поле | `default`, `title`, `description`, `hidden`, `depends`, `visibility` |
338
+ | `SelectInput` | Выпадающий список | `items`, `title`, `group`, `default`, `hidden`, `depends`, `visibility` |
339
+ | `CheckboxInput` | Чекбокс | `title`, `group`, `description`, `default`, `hidden`, `depends`, `visibility` |
340
+ | `SwitchInput` | Switch | `title`, `group`, `description`, `default`, `hidden`, `depends`, `visibility` |
341
+ | `FileInput` | Загрузка одного файла | `title`, `file_extensions`, `group`, `hidden`, `depends`, `visibility` |
342
+ | `FilesInput` | Загрузка нескольких файлов | `title`, `file_extensions`, `group`, `hidden`, `depends`, `limit`, `visibility` |
342
343
 
343
344
  #### Группировка полей
344
345
 
@@ -371,6 +372,54 @@ class TaskConfig(BaseModel):
371
372
  )]
372
373
  ```
373
374
 
375
+ #### Управление видимостью полей
376
+
377
+ Параметр `visibility` контролирует, когда поле отображается в интерфейсе. Доступные значения:
378
+
379
+ ```python
380
+ from agent_lab_sdk.schema import Visibility
381
+
382
+ # Enum с тремя значениями:
383
+ Visibility.ALWAYS # "always" - поле всегда доступно для ввода (по умолчанию)
384
+ Visibility.START # "start" - поле доступно для ввода только при старте
385
+ Visibility.AFTER_START # "after_start" - поле доступно для ввода после старта
386
+ ```
387
+
388
+ **Пример использования:**
389
+
390
+ ```python
391
+ class AgentConfig(BaseModel):
392
+ # Всегда доступно для ввода поле
393
+ query: Annotated[str, MainInput(
394
+ placeholder="Введите запрос",
395
+ visibility=Visibility.ALWAYS
396
+ )]
397
+
398
+ # Поле доступно для ввода только при первом запуске
399
+ api_key: Annotated[str, StringInput(
400
+ title="API ключ",
401
+ description="Ключ для доступа к внешнему API",
402
+ visibility=Visibility.START
403
+ )]
404
+
405
+ # Поле появляется после первого сообщения
406
+ session_id: Annotated[str, StringInput(
407
+ title="ID сессии",
408
+ description="Идентификатор текущей сессии",
409
+ visibility=Visibility.AFTER_START,
410
+ hidden=True
411
+ )]
412
+ ```
413
+
414
+ Можно также передавать строковые значения напрямую:
415
+
416
+ ```python
417
+ title: Annotated[str, StringInput(
418
+ title="Заголовок",
419
+ visibility="always" # эквивалентно Visibility.ALWAYS
420
+ )]
421
+ ```
422
+
374
423
  ### 5.2. LogMessage
375
424
 
376
425
  `LogMessage` — вспомогательное сообщение для потоковой передачи логов из узлов LangGraph / LangChain. Экземпляры создаются как обычные сообщения чата, но получают тип `log`, поэтому фронтенд может отображать их отдельно от ответов модели.
@@ -9,14 +9,14 @@ agent_lab_sdk/llm/llm.py,sha256=xL6FYyzjx22w_HnGK0ygGJTGr_OEz9EB6JWyYztprg4,2018
9
9
  agent_lab_sdk/llm/throttled.py,sha256=faccDXiKkmFFfZkVrxFQDHxHutAAivsKDEpYlygfuqU,8019
10
10
  agent_lab_sdk/metrics/__init__.py,sha256=G4VSlzKwupPMM4c6vZaF1rnd0KusKarezDMjli9pVFw,57
11
11
  agent_lab_sdk/metrics/metrics.py,sha256=_XTT9vMG7T0u_D2pL371wm8GoBU5fodJ45D2RACnBJw,3439
12
- agent_lab_sdk/schema/__init__.py,sha256=bHSyXQYkcB9fWBlziWodXR_IzC5nKrdKzrCpyVWNY9o,521
13
- agent_lab_sdk/schema/input_types.py,sha256=e75nRW7Dz_RHk5Yia8DkFfbqMafsLQsQrJPfzQhpIBw,9123
12
+ agent_lab_sdk/schema/__init__.py,sha256=cDVmQG5eYd2qO7DtDTt_YCISQyUXjLprUZ6KvKESKtU,554
13
+ agent_lab_sdk/schema/input_types.py,sha256=ziazdlwmOXQv7d8syaT5D1wulgHEpxaQAThGxwHwU2k,11630
14
14
  agent_lab_sdk/schema/log_message.py,sha256=nadi6lZGRuDSPmfbYs9QPpRJUT9Pfy8Y7pGCvyFF5Mw,638
15
15
  agent_lab_sdk/storage/__init__.py,sha256=HAtUoqg3k0irqPMewayadVA9aXJOmYSxRr6a5J1scT0,174
16
16
  agent_lab_sdk/storage/storage.py,sha256=ELpt7GRwFD-aWa6ctinfA_QwcvzWLvKS0Wz8FlxVqAs,2075
17
17
  agent_lab_sdk/storage/storage_v2.py,sha256=ONseynX59xzWK17dfzxZvnii2rpz3Oo2Zo9Ck-lcGnw,1997
18
- agent_lab_sdk-0.1.44.dist-info/licenses/LICENSE,sha256=_TRXHkF3S9ilWBPdZcHLI_S-PRjK0L_SeOb2pcPAdV4,417
19
- agent_lab_sdk-0.1.44.dist-info/METADATA,sha256=gbWuS14rM1KtS4W8f6Jze8orWGmjzcWgqJpdnfE7NzY,20766
20
- agent_lab_sdk-0.1.44.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- agent_lab_sdk-0.1.44.dist-info/top_level.txt,sha256=E1efqkJ89KNmPBWdLzdMHeVtH0dYyCo4fhnSb81_15I,14
22
- agent_lab_sdk-0.1.44.dist-info/RECORD,,
18
+ agent_lab_sdk-0.1.45.dist-info/licenses/LICENSE,sha256=_TRXHkF3S9ilWBPdZcHLI_S-PRjK0L_SeOb2pcPAdV4,417
19
+ agent_lab_sdk-0.1.45.dist-info/METADATA,sha256=yG9kDYbpWPtiLfSHPhoPZYHL2Bx1_l8M2RNW3f_cS_0,22820
20
+ agent_lab_sdk-0.1.45.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ agent_lab_sdk-0.1.45.dist-info/top_level.txt,sha256=E1efqkJ89KNmPBWdLzdMHeVtH0dYyCo4fhnSb81_15I,14
22
+ agent_lab_sdk-0.1.45.dist-info/RECORD,,