new feature: frontend with separated responses

This commit is contained in:
2026-09-11 09:33:55 -03:00
parent 6c81b21aaa
commit ecfbfbf8e1
60 changed files with 657 additions and 337 deletions

View File

@@ -66,6 +66,30 @@ EMBEDDING_PROVIDER=mock
OCI_EMBEDDING_MODEL=cohere.embed-multilingual-v3.0
RAG_FILE_GLOBS=*.md,*.txt,*.yaml,*.yml,*.json
# RAG / KBDB
# RAG provider: standard (local) ou kbdb (PKG_KB_SERVING.SEARCH_KNOWLEDGE_BASE)
RAG_PROVIDER=standard
# KBDB usa credenciais próprias; não há fallback para ADB_*.
KBDB_DB_USER=
KBDB_DB_PASSWORD=
KBDB_DB_DSN=
KBDB_DB_WALLET_LOCATION=
KBDB_DB_WALLET_PASSWORD=
KBDB_SEARCH_TYPE=hybrid
KBDB_NODE_EXPANSION=true
KBDB_NODE_MAX_RELATED=8
KBDB_GRAPH_CROSS_REF=false
KBDB_MAX_CROSS_REF_HOPS=1
KBDB_DOCUMENT_TYPE=customer_safe
KBDB_METADATA_JSON=
KBDB_MIN_SCORE=
KBDB_IDENTIFY_DOCUMENT=true
KBDB_STORE_QUERY=true
KBDB_IDENTIFY_TOP_N=3
RAG_GROUNDED_ONLY=false
KBDB_GROUNDED_ONLY=true
###############################################################################
# Observabilidade
###############################################################################

View File

@@ -457,6 +457,8 @@ async def _process_gateway_message(req: GatewayRequest, emit_sse: bool = False)
"route": result.get("route"),
"intent": result.get("intent"),
"route_decision": result.get("route_decision"),
"supervisor_results": result.get("supervisor_results") or [],
"agent_responses": result.get("agent_responses") or result.get("supervisor_results") or [],
"domain": result.get("domain"),
"mcp_tools": result.get("mcp_tools"),
"mcp_results": result.get("mcp_results"),

View File

@@ -39,6 +39,7 @@ class AgentState(TypedDict, total=False):
missing_parameters: list[str]
supervisor_plan: dict[str, Any]
supervisor_results: list[dict[str, Any]]
agent_responses: list[dict[str, Any]]
pending_topics: list[dict[str, Any]]
handled_topics: list[dict[str, Any]]
active_agent: str

View File

@@ -490,6 +490,7 @@ class AgentWorkflow:
return {
"answer": answer,
"supervisor_results": partials,
"agent_responses": partials,
"mcp_results": mcp_results,
"next_state": "SUPERVISOR_ACTIVE",
}
@@ -569,6 +570,7 @@ class AgentWorkflow:
"final_answer": candidate,
"pending_topics": drained.pending_topics,
"handled_topics": drained.handled_topics,
"agent_responses": drained.agent_responses,
"mcp_results": drained.mcp_results,
"rag_results": drained.rag_results,
"output_guardrails_already_applied": False,
@@ -586,6 +588,14 @@ class AgentWorkflow:
"tool_result": drained.mcp_results or (state.get("context") or {}).get("tool_result"),
"tool_executed": any(isinstance(item, dict) and item.get("ok") for item in drained.mcp_results),
"mcp_results": drained.mcp_results,
"evidence": (list(drained.mcp_results) + list(drained.rag_results)) or (state.get("context") or {}).get("evidence"),
"tool_result": drained.mcp_results or (state.get("context") or {}).get("tool_result"),
"tool_executed": any(isinstance(item, dict) and item.get("ok") for item in drained.mcp_results),
"mcp_results": drained.mcp_results,
"evidence": (list(drained.mcp_results) + list(drained.rag_results)) or (state.get("context") or {}).get("evidence"),
"tool_result": drained.mcp_results or (state.get("context") or {}).get("tool_result"),
"tool_executed": any(isinstance(item, dict) and item.get("ok") for item in drained.mcp_results),
"mcp_results": drained.mcp_results,
"tenant_id": state.get("tenant_id"),
"agent_id": state.get("agent_id"),
"session_id": state.get("conversation_key") or state.get("session_id"),
@@ -654,6 +664,7 @@ class AgentWorkflow:
"output_guardrails_already_applied": True,
"pending_topics": drained.pending_topics,
"handled_topics": drained.handled_topics,
"agent_responses": drained.agent_responses,
"mcp_results": drained.mcp_results,
"rag_results": drained.rag_results,
"guardrail_decisions": state.get("guardrail_decisions", [])