new feature: External guardrails/judges
This commit is contained in:
@@ -153,6 +153,17 @@ class AgentWorkflow:
|
||||
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)
|
||||
|
||||
# Domain-specific output rails such as TIM_AOFERTA need the full turn
|
||||
# context, including the current customer request. Keep this data in
|
||||
# the agent state; the generic framework only transports it.
|
||||
history = list(state.get("history") or [])
|
||||
current_user_text = str(state.get("user_text") or "").strip()
|
||||
if current_user_text:
|
||||
if not history or str((history[-1] or {}).get("content") or "") != current_user_text or str((history[-1] or {}).get("role") or "") != "user":
|
||||
history.append({"role": "user", "content": current_user_text})
|
||||
ctx["conversation_history"] = history
|
||||
ctx["history_texts"] = [str(item.get("content") or "") for item in history if isinstance(item, dict) and item.get("content") not in (None, "")]
|
||||
|
||||
protocols: list[str] = []
|
||||
seen: set[str] = set()
|
||||
protocol_keys = {"protocol_number", "protocolo_id", "interactionProtocol", "protocolNumber", "finalizacao_protocol"}
|
||||
|
||||
Reference in New Issue
Block a user