unique_orchestrator 1.7.3__tar.gz → 1.7.4__tar.gz

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 unique_orchestrator might be problematic. Click here for more details.

@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.7.4] - 2025-11-04
9
+ - Update and adapt to toolkit 1.23.0 (refactor sub agents implementation)
10
+
8
11
  ## [1.7.3] - 2025-11-03
9
12
  - Fixed an issue where new assistant messages were not properly generated during streaming outputs with tool calls; the orchestrator now correctly creates messages via `_create_new_assistant_message_if_loop_response_contains_content` when loop_response includes text and tool invocations.
10
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_orchestrator
3
- Version: 1.7.3
3
+ Version: 1.7.4
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Andreas Hauri
@@ -20,7 +20,7 @@ Requires-Dist: unique-internal-search (>=1.0.1,<2.0.0)
20
20
  Requires-Dist: unique-sdk (>=0.10.34,<0.11.0)
21
21
  Requires-Dist: unique-stock-ticker (>=1.0.2,<2.0.0)
22
22
  Requires-Dist: unique-swot (>=0.1.0,<0.2.0)
23
- Requires-Dist: unique-toolkit (>=1.22.2,<2.0.0)
23
+ Requires-Dist: unique-toolkit (>=1.23.0,<2.0.0)
24
24
  Requires-Dist: unique-web-search (>=1.3.1,<2.0.0)
25
25
  Description-Content-Type: text/markdown
26
26
 
@@ -34,6 +34,9 @@ All notable changes to this project will be documented in this file.
34
34
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
35
35
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
36
36
 
37
+ ## [1.7.4] - 2025-11-04
38
+ - Update and adapt to toolkit 1.23.0 (refactor sub agents implementation)
39
+
37
40
  ## [1.7.3] - 2025-11-03
38
41
  - Fixed an issue where new assistant messages were not properly generated during streaming outputs with tool calls; the orchestrator now correctly creates messages via `_create_new_assistant_message_if_loop_response_contains_content` when loop_response includes text and tool invocations.
39
42
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "unique_orchestrator"
3
- version = "1.7.3"
3
+ version = "1.7.4"
4
4
  description = ""
5
5
  authors = ["Andreas Hauri <andreas.hauri@unique.ai>"]
6
6
  readme = ["README.md", "CHANGELOG.md"]
@@ -15,7 +15,7 @@ python-dotenv = "^1.0.1"
15
15
  pytest = "^8.4.1"
16
16
  unique-sdk = "^0.10.34"
17
17
 
18
- unique-toolkit = "^1.22.2"
18
+ unique-toolkit = "^1.23.0"
19
19
  unique-stock-ticker = "^1.0.2"
20
20
  unique-follow-up-questions = "^1.1.2"
21
21
  unique-internal-search = "^1.0.1"
@@ -1,6 +1,6 @@
1
1
  import os
2
2
  from logging import Logger
3
- from typing import NamedTuple
3
+ from typing import NamedTuple, cast
4
4
 
5
5
  from openai import AsyncOpenAI
6
6
  from unique_follow_up_questions.follow_up_postprocessor import (
@@ -46,11 +46,13 @@ from unique_toolkit.agentic.thinking_manager.thinking_manager import (
46
46
  from unique_toolkit.agentic.tools.a2a import (
47
47
  A2AManager,
48
48
  ExtendedSubAgentToolConfig,
49
+ SubAgentDisplaySpec,
49
50
  SubAgentEvaluationService,
50
- SubAgentResponsesPostprocessor,
51
- )
52
- from unique_toolkit.agentic.tools.a2a.postprocessing.postprocessor import (
51
+ SubAgentEvaluationSpec,
52
+ SubAgentReferencesPostprocessor,
53
+ SubAgentResponsesDisplayPostprocessor,
53
54
  SubAgentResponsesPostprocessorConfig,
55
+ SubAgentResponseWatcher,
54
56
  )
55
57
  from unique_toolkit.agentic.tools.config import ToolBuildConfig
56
58
  from unique_toolkit.agentic.tools.mcp.manager import MCPManager
@@ -107,6 +109,7 @@ class _CommonComponents(NamedTuple):
107
109
  history_manager: HistoryManager
108
110
  evaluation_manager: EvaluationManager
109
111
  postprocessor_manager: PostprocessorManager
112
+ response_watcher: SubAgentResponseWatcher
110
113
  # Tool Manager Components
111
114
  tool_progress_reporter: ToolProgressReporter
112
115
  tool_manager_config: ToolManagerConfig
@@ -126,6 +129,8 @@ def _build_common(
126
129
 
127
130
  uploaded_documents = content_service.get_documents_uploaded_to_chat()
128
131
 
132
+ response_watcher = SubAgentResponseWatcher()
133
+
129
134
  tool_progress_reporter = ToolProgressReporter(
130
135
  chat_service=chat_service,
131
136
  config=config.agent.services.tool_progress_reporter_config,
@@ -174,7 +179,9 @@ def _build_common(
174
179
  a2a_manager = A2AManager(
175
180
  logger=logger,
176
181
  tool_progress_reporter=tool_progress_reporter,
182
+ response_watcher=response_watcher,
177
183
  )
184
+
178
185
  tool_manager_config = ToolManagerConfig(
179
186
  tools=config.space.tools,
180
187
  max_tool_calls=config.agent.experimental.loop_configuration.max_tool_calls_per_iteration,
@@ -222,6 +229,7 @@ def _build_common(
222
229
  tool_manager_config=tool_manager_config,
223
230
  mcp_servers=event.payload.mcp_servers,
224
231
  postprocessor_manager=postprocessor_manager,
232
+ response_watcher=response_watcher,
225
233
  )
226
234
 
227
235
 
@@ -341,16 +349,15 @@ async def _build_responses(
341
349
  _add_sub_agents_postprocessor(
342
350
  postprocessor_manager=postprocessor_manager,
343
351
  tool_manager=tool_manager,
344
- user_id=event.user_id,
345
- company_id=event.company_id,
346
- chat_id=event.payload.chat_id,
347
- sleep_time_before_update=config.agent.experimental.sub_agents_config.sleep_time_before_update,
352
+ config=config,
353
+ response_watcher=common_components.response_watcher,
348
354
  )
349
355
  _add_sub_agents_evaluation(
350
356
  evaluation_manager=common_components.evaluation_manager,
351
357
  tool_manager=tool_manager,
352
358
  config=config,
353
359
  event=event,
360
+ response_watcher=common_components.response_watcher,
354
361
  )
355
362
 
356
363
  return UniqueAIResponsesApi(
@@ -414,16 +421,15 @@ def _build_completions(
414
421
  _add_sub_agents_postprocessor(
415
422
  postprocessor_manager=postprocessor_manager,
416
423
  tool_manager=tool_manager,
417
- user_id=event.user_id,
418
- company_id=event.company_id,
419
- chat_id=event.payload.chat_id,
420
- sleep_time_before_update=config.agent.experimental.sub_agents_config.sleep_time_before_update,
424
+ config=config,
425
+ response_watcher=common_components.response_watcher,
421
426
  )
422
427
  _add_sub_agents_evaluation(
423
428
  evaluation_manager=common_components.evaluation_manager,
424
429
  tool_manager=tool_manager,
425
430
  config=config,
426
431
  event=event,
432
+ response_watcher=common_components.response_watcher,
427
433
  )
428
434
 
429
435
  return UniqueAI(
@@ -447,28 +453,37 @@ def _build_completions(
447
453
  def _add_sub_agents_postprocessor(
448
454
  postprocessor_manager: PostprocessorManager,
449
455
  tool_manager: ToolManager | ResponsesApiToolManager,
450
- user_id: str,
451
- company_id: str,
452
- chat_id: str,
453
- sleep_time_before_update: float,
456
+ config: UniqueAIConfig,
457
+ response_watcher: SubAgentResponseWatcher,
454
458
  ) -> None:
455
459
  sub_agents = tool_manager.sub_agents
456
460
  if len(sub_agents) > 0:
457
- sub_agent_responses_postprocessor = SubAgentResponsesPostprocessor(
458
- user_id=user_id,
459
- main_agent_chat_id=chat_id,
460
- company_id=company_id,
461
- config=SubAgentResponsesPostprocessorConfig(
462
- sleep_time_before_update=sleep_time_before_update,
463
- ),
461
+ display_config = SubAgentResponsesPostprocessorConfig(
462
+ sleep_time_before_update=config.agent.experimental.sub_agents_config.sleep_time_before_update,
464
463
  )
465
- postprocessor_manager.add_postprocessor(sub_agent_responses_postprocessor)
466
-
467
- for tool in tool_manager.sub_agents:
468
- assert isinstance(tool.config, ExtendedSubAgentToolConfig)
469
- sub_agent_responses_postprocessor.register_sub_agent_tool(
470
- tool, tool.config.response_display_config
464
+ display_specs = []
465
+ for tool in sub_agents:
466
+ tool_config = cast(
467
+ ExtendedSubAgentToolConfig, tool.settings.configuration
468
+ ) # (BeforeValidator of ToolBuildConfig)
469
+
470
+ display_specs.append(
471
+ SubAgentDisplaySpec(
472
+ assistant_id=tool_config.assistant_id,
473
+ display_name=tool.display_name(),
474
+ display_config=tool_config.response_display_config,
475
+ )
471
476
  )
477
+ reference_postprocessor = SubAgentReferencesPostprocessor(
478
+ response_watcher=response_watcher,
479
+ )
480
+ sub_agent_responses_postprocessor = SubAgentResponsesDisplayPostprocessor(
481
+ config=display_config,
482
+ response_watcher=response_watcher,
483
+ display_specs=display_specs,
484
+ )
485
+ postprocessor_manager.add_postprocessor(reference_postprocessor)
486
+ postprocessor_manager.add_postprocessor(sub_agent_responses_postprocessor)
472
487
 
473
488
 
474
489
  def _add_sub_agents_evaluation(
@@ -476,18 +491,31 @@ def _add_sub_agents_evaluation(
476
491
  tool_manager: ToolManager | ResponsesApiToolManager,
477
492
  config: UniqueAIConfig,
478
493
  event: ChatEvent,
494
+ response_watcher: SubAgentResponseWatcher,
479
495
  ) -> None:
480
496
  sub_agents = tool_manager.sub_agents
481
- if len(sub_agents) > 0:
482
- sub_agent_evaluation = None
483
- if config.agent.experimental.sub_agents_config.evaluation_config is not None:
484
- sub_agent_evaluation = SubAgentEvaluationService(
485
- config=config.agent.experimental.sub_agents_config.evaluation_config,
486
- language_model_service=LanguageModelService.from_event(event),
487
- )
488
- evaluation_manager.add_evaluation(sub_agent_evaluation)
489
- for tool in tool_manager.sub_agents:
490
- assert isinstance(tool.config, ExtendedSubAgentToolConfig)
491
- sub_agent_evaluation.register_sub_agent_tool(
492
- tool, tool.config.evaluation_config
497
+ if (
498
+ len(sub_agents) > 0
499
+ and config.agent.experimental.sub_agents_config.evaluation_config is not None
500
+ ):
501
+ evaluation_specs = []
502
+ for tool in sub_agents:
503
+ tool_config = cast(
504
+ ExtendedSubAgentToolConfig, tool.settings.configuration
505
+ ) # (BeforeValidator of ToolBuildConfig)
506
+
507
+ evaluation_specs.append(
508
+ SubAgentEvaluationSpec(
509
+ assistant_id=tool_config.assistant_id,
510
+ display_name=tool.display_name(),
511
+ config=tool_config.evaluation_config,
493
512
  )
513
+ )
514
+
515
+ sub_agent_evaluation = SubAgentEvaluationService(
516
+ config=config.agent.experimental.sub_agents_config.evaluation_config,
517
+ language_model_service=LanguageModelService.from_event(event),
518
+ evaluation_specs=evaluation_specs,
519
+ response_watcher=response_watcher,
520
+ )
521
+ evaluation_manager.add_evaluation(sub_agent_evaluation)