new feature: Multi-Intent
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -111,6 +111,14 @@ class ContestacaoAgent(AgentRuntimeMixin):
|
||||
"next_state": "CONTESTACAO_ACTIVE",
|
||||
"mcp_results": tool_context,
|
||||
"rag": rag_metadata,
|
||||
"rag_context": rag_context,
|
||||
"rag_results": [{
|
||||
"intent": state.get("intent"),
|
||||
"agent": self.name,
|
||||
"source_text": str(state.get("sanitized_input") or state.get("user_text") or ""),
|
||||
"metadata": rag_metadata,
|
||||
**({"context": rag_context} if rag_context else {}),
|
||||
}],
|
||||
"memory_context_metadata": state.get("memory_context_metadata"),
|
||||
**self.transaction_state_patch(state),
|
||||
}
|
||||
|
||||
@@ -219,6 +219,14 @@ class FaturasAgent(AgentRuntimeMixin):
|
||||
"next_state": "FATURAS_ACTIVE",
|
||||
"mcp_results": tool_context,
|
||||
"rag": rag_metadata,
|
||||
"rag_context": rag_context,
|
||||
"rag_results": [{
|
||||
"intent": state.get("intent"),
|
||||
"agent": self.name,
|
||||
"source_text": str(state.get("sanitized_input") or state.get("user_text") or ""),
|
||||
"metadata": rag_metadata,
|
||||
**({"context": rag_context} if rag_context else {}),
|
||||
}],
|
||||
"memory_context_metadata": state.get("memory_context_metadata"),
|
||||
**self.transaction_state_patch(state),
|
||||
**handoff_patch,
|
||||
|
||||
@@ -129,6 +129,14 @@ class SuporteContasAgent(AgentRuntimeMixin):
|
||||
"next_state": "SUPORTE_CONTAS_ACTIVE",
|
||||
"mcp_results": tool_context,
|
||||
"rag": rag_metadata,
|
||||
"rag_context": rag_context,
|
||||
"rag_results": [{
|
||||
"intent": state.get("intent"),
|
||||
"agent": self.name,
|
||||
"source_text": str(state.get("sanitized_input") or state.get("user_text") or ""),
|
||||
"metadata": rag_metadata,
|
||||
**({"context": rag_context} if rag_context else {}),
|
||||
}],
|
||||
"memory_context_metadata": state.get("memory_context_metadata"),
|
||||
**informational_patch,
|
||||
**self.transaction_state_patch(state),
|
||||
|
||||
@@ -116,6 +116,14 @@ class VasAgent(AgentRuntimeMixin):
|
||||
"next_state": "VAS_ACTIVE",
|
||||
"mcp_results": tool_context,
|
||||
"rag": rag_metadata,
|
||||
"rag_context": rag_context,
|
||||
"rag_results": [{
|
||||
"intent": state.get("intent"),
|
||||
"agent": self.name,
|
||||
"source_text": str(state.get("sanitized_input") or state.get("user_text") or ""),
|
||||
"metadata": rag_metadata,
|
||||
**({"context": rag_context} if rag_context else {}),
|
||||
}],
|
||||
"memory_context_metadata": state.get("memory_context_metadata"),
|
||||
**informational_patch,
|
||||
**self.transaction_state_patch(state),
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -483,6 +483,7 @@ async def _process_gateway_message(req: GatewayRequest, emit_sse: bool = False)
|
||||
"domain": result.get("domain"),
|
||||
"mcp_tools": result.get("mcp_tools"),
|
||||
"mcp_results": result.get("mcp_results"),
|
||||
"rag_results": result.get("rag_results"),
|
||||
"transaction_evidence": result.get("relevant_transaction_evidence", []),
|
||||
"transaction_pre_validation": result.get("transaction_pre_validation"),
|
||||
"business_context": business_context.model_dump(),
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -23,6 +23,7 @@ class AgentState(TypedDict, total=False):
|
||||
domain: str
|
||||
mcp_tools: list[str]
|
||||
mcp_results: list[dict[str, Any]]
|
||||
rag_results: list[dict[str, Any]]
|
||||
available_mcp_tools: list[str]
|
||||
selected_tool_call: dict[str, Any]
|
||||
pending_tool_call: dict[str, Any]
|
||||
|
||||
Binary file not shown.
@@ -151,7 +151,9 @@ class AgentWorkflow:
|
||||
"""
|
||||
ctx = dict(state.get("context", {}) or {})
|
||||
mcp_results = state.get("mcp_results") or []
|
||||
ctx["evidence"] = mcp_results or ctx.get("evidence")
|
||||
rag_results = state.get("rag_results") or []
|
||||
combined_evidence = list(mcp_results) + list(rag_results)
|
||||
ctx["evidence"] = combined_evidence or ctx.get("evidence")
|
||||
ctx["tool_result"] = mcp_results or ctx.get("tool_result")
|
||||
ctx["tool_executed"] = any(isinstance(r, dict) and r.get("ok") for r in mcp_results)
|
||||
|
||||
@@ -945,12 +947,17 @@ class AgentWorkflow:
|
||||
"pending_topics": drained.pending_topics,
|
||||
"handled_topics": drained.handled_topics,
|
||||
"mcp_results": drained.mcp_results,
|
||||
"rag_results": drained.rag_results,
|
||||
"output_guardrails_already_applied": False,
|
||||
"supervisor_action": "disabled",
|
||||
"supervisor_attempt": int(state.get("supervisor_attempt", 0)),
|
||||
}
|
||||
context = {
|
||||
**self._output_guardrail_context({**state, "mcp_results": drained.mcp_results}),
|
||||
**self._output_guardrail_context({
|
||||
**state,
|
||||
"mcp_results": drained.mcp_results,
|
||||
"rag_results": drained.rag_results,
|
||||
}),
|
||||
"tenant_id": state.get("tenant_id"),
|
||||
"agent_id": state.get("agent_id"),
|
||||
"session_id": state.get("conversation_key") or state.get("session_id"),
|
||||
@@ -1022,6 +1029,7 @@ class AgentWorkflow:
|
||||
"pending_topics": drained.pending_topics,
|
||||
"handled_topics": drained.handled_topics,
|
||||
"mcp_results": drained.mcp_results,
|
||||
"rag_results": drained.rag_results,
|
||||
}
|
||||
|
||||
async def output_guardrails(self, state):
|
||||
@@ -1104,6 +1112,7 @@ class AgentWorkflow:
|
||||
relevant_transaction_evidence = list(state.get("relevant_transaction_evidence") or [])
|
||||
judge_context["transaction_evidence"] = relevant_transaction_evidence
|
||||
current_evidence = list(state.get("mcp_results", []) or [])
|
||||
current_evidence.extend(state.get("rag_results", []) or [])
|
||||
current_evidence.extend(relevant_transaction_evidence)
|
||||
judge_context["evidence"] = current_evidence or judge_context.get("evidence")
|
||||
judge_context["route"] = state.get("route")
|
||||
@@ -1251,6 +1260,7 @@ class AgentWorkflow:
|
||||
"judges": state.get("judge_results", []),
|
||||
"mcp_tools": state.get("mcp_tools", []),
|
||||
"mcp_results": state.get("mcp_results", []),
|
||||
"rag_results": state.get("rag_results", []),
|
||||
"transaction_evidence": state.get("relevant_transaction_evidence", []),
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user