#323 — Create pipeline for an agent triage of messages with human in the loop

Repo: Twill-AI/twill-llm-engine State: closed | Status: done Assignee: meliascosta, nadddder

Created: 2026-01-22 · Updated: 2026-01-30

Description

Description

Add a new standalone triage agent that can take a user message (optionally with history), attempt to answer it by calling existing tools (e.g. query_data, create_kpi_tile, calculate_math) if applicable, and return a single final result. Feel free to add new tools. If it can’t confidently answer (or tool attempts fail), it should return an outcome indicating the request should be forwarded to a human. This should be exposed via a new non-streaming interface method (do not emit token chunks/events).

Acceptance criteria

  • New interface method: EngineConnector.triage_message(…) exists and returns a single structured outcome (no streaming / no incremental token chunks).
  • Tool attempts: triage can execute existing tools from twill_llm_engine/utils/tools.py and incorporate results into its reasoning. Tools may be refactored and new tools may be defined.
  • New tools: Check current merchant status on processor (EMS, Luqra), Check POS delivery status (new API, discuss with @nadddder @TwillPayments)
  • Handoff behavior: when the agent cannot answer confidently or encounters unrecoverable tool errors, it returns action=“forward_to_human” plus a brief handoff_reason.
  • Standalone implementation: triage does not reuse existing agent graphs (main_graph, general_subgraph, widget_subgraph); only the tools and interface integration may be reused.
  • Tests: unit tests cover at least one respond case and one forward_to_human case, and validate the me

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets