unique_orchestrator 1.1.0__py3-none-any.whl → 1.2.0__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 unique_orchestrator might be problematic. Click here for more details.

@@ -2,7 +2,7 @@ from enum import StrEnum
2
2
  from pathlib import Path
3
3
  from typing import Annotated, Any, Generic, Literal, TypeVar
4
4
 
5
- from pydantic import BaseModel, Field, ValidationInfo, field_validator
5
+ from pydantic import BaseModel, Field, ValidationInfo, field_validator, model_validator
6
6
  from unique_deep_research.config import DeepResearchToolConfig
7
7
  from unique_deep_research.service import DeepResearchTool
8
8
  from unique_follow_up_questions.config import FollowUpQuestionsConfig
@@ -22,7 +22,11 @@ from unique_toolkit.agentic.evaluation.schemas import EvaluationMetricName
22
22
  from unique_toolkit.agentic.history_manager.history_manager import (
23
23
  UploadedContentConfig,
24
24
  )
25
- from unique_toolkit.agentic.tools.a2a.evaluation import SubAgentEvaluationConfig
25
+ from unique_toolkit.agentic.tools.a2a import (
26
+ REFERENCING_INSTRUCTIONS_FOR_SYSTEM_PROMPT,
27
+ REFERENCING_INSTRUCTIONS_FOR_USER_PROMPT,
28
+ )
29
+ from unique_toolkit.agentic.tools.a2a.evaluation import SubAgentEvaluationServiceConfig
26
30
  from unique_toolkit.agentic.tools.config import get_configuration_dict
27
31
  from unique_toolkit.agentic.tools.tool import ToolBuildConfig
28
32
  from unique_web_search.config import WebSearchConfig
@@ -117,7 +121,9 @@ class EvaluationConfig(BaseModel):
117
121
  model_config = get_configuration_dict()
118
122
  max_review_steps: int = 3
119
123
  hallucination_config: HallucinationConfig = HallucinationConfig()
120
- sub_agents_config: SubAgentEvaluationConfig = SubAgentEvaluationConfig()
124
+ sub_agents_config: SubAgentEvaluationServiceConfig | None = (
125
+ SubAgentEvaluationServiceConfig()
126
+ )
121
127
 
122
128
 
123
129
  # ------------------------------------------------------------
@@ -199,6 +205,22 @@ class InputTokenDistributionConfig(BaseModel):
199
205
  return int(self.percent_for_history * max_input_token)
200
206
 
201
207
 
208
+ class SubAgentsConfig(BaseModel):
209
+ model_config = get_configuration_dict()
210
+ use_sub_agent_references: bool = Field(
211
+ default=True,
212
+ description="Whether to use sub agent references in the main agent's response. Only has an effect if sub agents are used.",
213
+ )
214
+ referencing_instructions_for_system_prompt: str = Field(
215
+ default=REFERENCING_INSTRUCTIONS_FOR_SYSTEM_PROMPT,
216
+ description="Referencing instructions for the main agent's system prompt.",
217
+ )
218
+ referencing_instructions_for_user_prompt: str = Field(
219
+ default=REFERENCING_INSTRUCTIONS_FOR_USER_PROMPT,
220
+ description="Referencing instructions for the main agent's user prompt. Should correspond to a short reminder.",
221
+ )
222
+
223
+
202
224
  class ExperimentalConfig(BaseModel):
203
225
  """Experimental features this part of the configuration might evolve in the future continuously"""
204
226
 
@@ -230,6 +252,8 @@ class ExperimentalConfig(BaseModel):
230
252
  max_tool_calls_per_iteration=5
231
253
  )
232
254
 
255
+ sub_agents_config: SubAgentsConfig = SubAgentsConfig()
256
+
233
257
 
234
258
  class UniqueAIAgentConfig(BaseModel):
235
259
  model_config = get_configuration_dict(frozen=True)
@@ -254,3 +278,9 @@ class UniqueAIConfig(BaseModel):
254
278
  space: UniqueAISpaceConfig = UniqueAISpaceConfig()
255
279
 
256
280
  agent: UniqueAIAgentConfig = UniqueAIAgentConfig()
281
+
282
+ @model_validator(mode="after")
283
+ def disable_sub_agent_referencing_if_not_used(self) -> "UniqueAIConfig":
284
+ if not any(tool.is_sub_agent for tool in self.space.tools):
285
+ self.agent.experimental.sub_agents_config.use_sub_agent_references = False
286
+ return self
@@ -73,7 +73,12 @@ This tool is called {{ tool_description.display_name }} by the user.
73
73
  - {{ meta.message }}
74
74
  {%- endif -%}
75
75
  {%- endfor -%}
76
- {%- endif -%}
76
+ {%- endif %}
77
+
78
+ {% if use_sub_agent_references and sub_agent_referencing_instructions | length > 0 %}
79
+ # Special Instructions: Referencing Sub Agents Answers
80
+ {{ sub_agent_referencing_instructions }}
81
+ {%- endif %}
77
82
 
78
83
  {# Answer Style Section #}
79
84
  # Answer Style
@@ -6,13 +6,18 @@
6
6
  - date_string: The current date in formatted string
7
7
  - mcp_server_user_prompts: List of unique server-wide user prompts from MCP servers
8
8
  - tool_descriptions_with_user_prompts: List of UniqueToolDescription objects with user prompts
9
- #}{{ query }}
9
+ #}
10
+ # User Query
11
+ {{ query }}
10
12
 
11
- {%- if mcp_server_user_prompts and mcp_server_user_prompts|length > 0 %}
13
+ {% if use_sub_agent_references and sub_agent_referencing_instructions | length > 0 %}
14
+ # Sub Agents Referencing Reminder
15
+ {{ sub_agent_referencing_instructions }}
16
+ {%- endif %}
12
17
 
13
- ## MCP Server Context
18
+ {%- if mcp_server_user_prompts and mcp_server_user_prompts|length > 0 %}
19
+ # MCP Server Context
14
20
  {%- for server_prompt in mcp_server_user_prompts %}
15
-
16
21
  {{ server_prompt }}
17
22
  {%- endfor %}
18
23
  {%- endif %}
@@ -256,12 +256,19 @@ class UniqueAI:
256
256
 
257
257
  query = self._event.payload.user_message.text
258
258
 
259
+ use_sub_agent_references = (
260
+ self._config.agent.experimental.sub_agents_config.use_sub_agent_references
261
+ )
262
+ sub_agent_referencing_instructions = self._config.agent.experimental.sub_agents_config.referencing_instructions_for_user_prompt
263
+
259
264
  user_msg = user_message_template.render(
260
265
  query=query,
261
266
  tool_descriptions=tool_descriptions,
262
267
  used_tools=used_tools,
263
268
  mcp_server_user_prompts=list(mcp_server_user_prompts),
264
269
  tool_descriptions_with_user_prompts=tool_descriptions_with_user_prompts,
270
+ use_sub_agent_references=use_sub_agent_references,
271
+ sub_agent_referencing_instructions=sub_agent_referencing_instructions,
265
272
  )
266
273
  return user_msg
267
274
 
@@ -283,6 +290,11 @@ class UniqueAI:
283
290
  mcp_server.system_prompt for mcp_server in self._mcp_servers
284
291
  ]
285
292
 
293
+ use_sub_agent_references = (
294
+ self._config.agent.experimental.sub_agents_config.use_sub_agent_references
295
+ )
296
+ sub_agent_referencing_instructions = self._config.agent.experimental.sub_agents_config.referencing_instructions_for_system_prompt
297
+
286
298
  system_message = system_prompt_template.render(
287
299
  model_info=self._config.space.language_model.model_dump(mode="json"),
288
300
  date_string=date_string,
@@ -294,6 +306,8 @@ class UniqueAI:
294
306
  max_loop_iterations=self._config.agent.max_loop_iterations,
295
307
  current_iteration=self.current_iteration_index + 1,
296
308
  mcp_server_system_prompts=mcp_server_system_prompts,
309
+ use_sub_agent_references=use_sub_agent_references,
310
+ sub_agent_referencing_instructions=sub_agent_referencing_instructions,
297
311
  )
298
312
  return system_message
299
313
 
@@ -35,9 +35,10 @@ from unique_toolkit.agentic.thinking_manager.thinking_manager import (
35
35
  ThinkingManager,
36
36
  ThinkingManagerConfig,
37
37
  )
38
- from unique_toolkit.agentic.tools.a2a.evaluation import SubAgentsEvaluation
39
- from unique_toolkit.agentic.tools.a2a.manager import A2AManager
40
- from unique_toolkit.agentic.tools.a2a.postprocessing import (
38
+ from unique_toolkit.agentic.tools.a2a import (
39
+ A2AManager,
40
+ ExtendedSubAgentToolConfig,
41
+ SubAgentEvaluationService,
41
42
  SubAgentResponsesPostprocessor,
42
43
  )
43
44
  from unique_toolkit.agentic.tools.config import ToolBuildConfig
@@ -166,25 +167,33 @@ def build_unique_ai(
166
167
  )
167
168
 
168
169
  if len(tool_manager.sub_agents) > 0:
169
- postprocessor_manager.add_postprocessor(
170
- SubAgentResponsesPostprocessor(
171
- user_id=event.user_id,
172
- agent_chat_id=event.payload.chat_id,
173
- company_id=event.company_id,
174
- sub_agent_tools=tool_manager.sub_agents,
175
- )
170
+ sub_agent_responses_postprocessor = SubAgentResponsesPostprocessor(
171
+ user_id=event.user_id,
172
+ main_agent_chat_id=event.payload.chat_id,
173
+ company_id=event.company_id,
176
174
  )
177
- if config.agent.services.evaluation_config is not None:
178
- logger.info("Adding sub agents evaluation")
179
- evaluation_manager.add_evaluation(
180
- SubAgentsEvaluation(
181
- config.agent.services.evaluation_config.sub_agents_config,
182
- tool_manager.sub_agents,
183
- LanguageModelService.from_event(event),
184
- )
175
+ postprocessor_manager.add_postprocessor(sub_agent_responses_postprocessor)
176
+
177
+ sub_agent_evaluation = None
178
+ if (
179
+ config.agent.services.evaluation_config is not None
180
+ and config.agent.services.evaluation_config.sub_agents_config is not None
181
+ ):
182
+ sub_agent_evaluation = SubAgentEvaluationService(
183
+ config=config.agent.services.evaluation_config.sub_agents_config,
184
+ language_model_service=LanguageModelService.from_event(event),
185
185
  )
186
- else:
187
- logger.warning("No evaluation config found for sub agents")
186
+ evaluation_manager.add_evaluation(sub_agent_evaluation)
187
+
188
+ for tool in tool_manager.sub_agents:
189
+ assert isinstance(tool.config, ExtendedSubAgentToolConfig)
190
+ sub_agent_responses_postprocessor.register_sub_agent_tool(
191
+ tool, tool.config.response_display_config
192
+ )
193
+ if sub_agent_evaluation is not None:
194
+ sub_agent_evaluation.register_sub_agent_tool(
195
+ tool, tool.config.evaluation_config
196
+ )
188
197
 
189
198
  return UniqueAI(
190
199
  event=event,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_orchestrator
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary:
5
5
  License: Proprietary
6
6
  Author: Andreas Hauri
@@ -19,7 +19,7 @@ Requires-Dist: unique-follow-up-questions (>=1.0.0,<2.0.0)
19
19
  Requires-Dist: unique-internal-search (>=1.0.0,<2.0.0)
20
20
  Requires-Dist: unique-sdk (>=0.10.24,<0.11.0)
21
21
  Requires-Dist: unique-stock-ticker (>=1.0.0,<2.0.0)
22
- Requires-Dist: unique-toolkit (>=1.4.0,<2.0.0)
22
+ Requires-Dist: unique-toolkit (>=1.11.0,<2.0.0)
23
23
  Requires-Dist: unique-web-search (>=1.0.0,<2.0.0)
24
24
  Description-Content-Type: text/markdown
25
25
 
@@ -33,6 +33,12 @@ All notable changes to this project will be documented in this file.
33
33
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
34
34
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
35
35
 
36
+ ## [1.2.0] - 2025-10-07
37
+ - Add sub agent response referencing.
38
+
39
+ ## [1.1.1] - 2025-10-03
40
+ - Adapt orchestrator to toolkit 1.8.0.
41
+
36
42
  ## [1.1.0] - 2025-09-29
37
43
  - Add ability to display sub agent's answers in main agent.
38
44
  - Add ability to consolidate sub agent's assessment's in main agent.
@@ -61,3 +67,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
61
67
 
62
68
  ## [0.0.1] - 2025-08-18
63
69
  - Initial release of `orchestrator`.
70
+
@@ -0,0 +1,11 @@
1
+ unique_orchestrator/config.py,sha256=OqXs0697mEoPEh8baM1z4mU909QD_D812jq8ZQ8wLwc,9512
2
+ unique_orchestrator/prompts/generic_reference_prompt.jinja2,sha256=fYPaiE-N1gSoOqu85OeEBa_ttAim8grOhHuOHJjSHNU,2663
3
+ unique_orchestrator/prompts/system_prompt.jinja2,sha256=YXFdx3PG2p4TKfjEpz7guIw2GaKoY-4zRMEzXaKhHXE,7213
4
+ unique_orchestrator/prompts/user_message_prompt.jinja2,sha256=BQokpBh3H2J-rFk8i-PRph3jy4T1gAJPPb1mxxRWNuM,878
5
+ unique_orchestrator/tests/test_unique_ai_reference_order.py,sha256=8mZeVP1k8neH4qrFW3oa3zwIdaq2c7R1VvurC7kjBU8,4445
6
+ unique_orchestrator/unique_ai.py,sha256=8sBD5P16XcJ_3BXywBuZRRa4h89ANAi8h3VA4V2G_sI,16471
7
+ unique_orchestrator/unique_ai_builder.py,sha256=m9-k9oVY7RR9ntrWEzBs0gcycNk4JcbqNfqW-DlJXrc,7507
8
+ unique_orchestrator-1.2.0.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
9
+ unique_orchestrator-1.2.0.dist-info/METADATA,sha256=AO3IWc2IKsH33aRYbpukGvrySf_iO2hsUwFJBQR9_9w,2098
10
+ unique_orchestrator-1.2.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
11
+ unique_orchestrator-1.2.0.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- unique_orchestrator/config.py,sha256=8TIWd-3d9gEsPyBSKVNWfMnrssvylPTiOGxpW9etwH4,8221
2
- unique_orchestrator/prompts/generic_reference_prompt.jinja2,sha256=fYPaiE-N1gSoOqu85OeEBa_ttAim8grOhHuOHJjSHNU,2663
3
- unique_orchestrator/prompts/system_prompt.jinja2,sha256=0FrDZbfpVMjf4G1VBOavG1aUlZTDDDdn_aUGjeVac4g,7018
4
- unique_orchestrator/prompts/user_message_prompt.jinja2,sha256=KLCfbxMu5R7_V8-AHkdXEmVorcSHNej_xM_7xJyNkl0,692
5
- unique_orchestrator/tests/test_unique_ai_reference_order.py,sha256=8mZeVP1k8neH4qrFW3oa3zwIdaq2c7R1VvurC7kjBU8,4445
6
- unique_orchestrator/unique_ai.py,sha256=OFzgyPWvh5mK4p3OxII3hKpQt_dhHBD2BbtHakZ35n8,15635
7
- unique_orchestrator/unique_ai_builder.py,sha256=wjS3tMdN0kfljBUKVwNJfvZv_pmd14dqv2ZViWHKB8w,7140
8
- unique_orchestrator-1.1.0.dist-info/LICENSE,sha256=GlN8wHNdh53xwOPg44URnwag6TEolCjoq3YD_KrWgss,193
9
- unique_orchestrator-1.1.0.dist-info/METADATA,sha256=DmLm0q6Taii5Ko2uFj3cABAEVIZaiABjducyB2y-cEQ,1969
10
- unique_orchestrator-1.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
11
- unique_orchestrator-1.1.0.dist-info/RECORD,,