~/blog building-aida.md

Building the AIDA Purchase Agent

CREATED: 2025-04-20

Building the AIDA Purchase Agent

Automating a university's procurement system is no small feat. There are complex, branching logical pathways depending on the purchase type, budget, and supplier contract status.

At UM6P, we approached this by migrating from a static rule-based engine to a dynamic Multi-Agent Architecture powered by LangGraph.

The Problem With Traditional Bots

Standard conversational agents usually fail at enterprise procurement because:

  1. They hallucinate framework contract names.
  2. They cannot safely interrupt for "Human-in-the-Loop" validations.
  3. They get stuck if the user changes context mid-flow.

LangGraph to the Rescue

By modeling our workflow strictly as a defined graph:

  • We can inject a specific node to perform a PgVector semantic search against our supplier database.
  • If the item matches a Contrat Cadre, we route the graph to a strict validation node.
  • If the agent hallucinates, our independent LLM evaluator node detects the divergence and loops back to correct the state before it hits the Next.js frontend.

This ensures production-level safety while keeping the UX conversational and fluid!

./back_to_index.sh