Add multi-pattern orchestrator with plan-then-execute and supervisor

Introduce an agent orchestrator service that supports three
execution patterns (ReAct, plan-then-execute, supervisor) with
LLM-based meta-routing to select the appropriate pattern and task
type per request. Update the agent schema to support
orchestration fields (correlation, sub-agents, plan steps) and
remove legacy response fields (answer, thought, observation).
This commit is contained in:
Cyber MacGeddon 2026-03-23 19:46:44 +00:00
parent 7af1d60db8
commit ade5606a92
21 changed files with 3006 additions and 172 deletions

View file

@ -188,12 +188,10 @@ class TestAgentTranslatorCompletionFlags:
# Arrange
translator = TranslatorRegistry.get_response_translator("agent")
response = AgentResponse(
answer="4",
error=None,
thought=None,
observation=None,
chunk_type="answer",
content="4",
end_of_message=True,
end_of_dialog=True
end_of_dialog=True,
)
# Act
@ -201,7 +199,7 @@ class TestAgentTranslatorCompletionFlags:
# Assert
assert is_final is True, "is_final must be True when end_of_dialog=True"
assert response_dict["answer"] == "4"
assert response_dict["content"] == "4"
assert response_dict["end_of_dialog"] is True
def test_agent_translator_is_final_with_end_of_dialog_false(self):
@ -212,12 +210,10 @@ class TestAgentTranslatorCompletionFlags:
# Arrange
translator = TranslatorRegistry.get_response_translator("agent")
response = AgentResponse(
answer=None,
error=None,
thought="I need to solve this.",
observation=None,
chunk_type="thought",
content="I need to solve this.",
end_of_message=True,
end_of_dialog=False
end_of_dialog=False,
)
# Act
@ -225,31 +221,9 @@ class TestAgentTranslatorCompletionFlags:
# Assert
assert is_final is False, "is_final must be False when end_of_dialog=False"
assert response_dict["thought"] == "I need to solve this."
assert response_dict["content"] == "I need to solve this."
assert response_dict["end_of_dialog"] is False
def test_agent_translator_is_final_fallback_with_answer(self):
"""
Test that AgentResponseTranslator returns is_final=True
when answer is present (fallback for legacy responses).
"""
# Arrange
translator = TranslatorRegistry.get_response_translator("agent")
# Legacy response without end_of_dialog flag
response = AgentResponse(
answer="4",
error=None,
thought=None,
observation=None
)
# Act
response_dict, is_final = translator.from_response_with_completion(response)
# Assert
assert is_final is True, "is_final must be True when answer is present (legacy fallback)"
assert response_dict["answer"] == "4"
def test_agent_translator_intermediate_message_is_not_final(self):
"""
Test that intermediate messages (thought/observation) return is_final=False.
@ -259,12 +233,10 @@ class TestAgentTranslatorCompletionFlags:
# Test thought message
thought_response = AgentResponse(
answer=None,
error=None,
thought="Processing...",
observation=None,
chunk_type="thought",
content="Processing...",
end_of_message=True,
end_of_dialog=False
end_of_dialog=False,
)
# Act
@ -275,12 +247,10 @@ class TestAgentTranslatorCompletionFlags:
# Test observation message
observation_response = AgentResponse(
answer=None,
error=None,
thought=None,
observation="Result found",
chunk_type="observation",
content="Result found",
end_of_message=True,
end_of_dialog=False
end_of_dialog=False,
)
# Act
@ -302,10 +272,6 @@ class TestAgentTranslatorCompletionFlags:
content="",
end_of_message=True,
end_of_dialog=True,
answer=None,
error=None,
thought=None,
observation=None
)
# Act