Skip to content

← Training overview

4. Consumer agent

Once features are registered and documented, business users want to ask questions like "do we have a feature for customer lifetime value?" or "is provider_z_score still up to date?". The consumer agent is the LangGraph-based chatbot that answers those questions from the catalogs and the business dictionary — in French or English.

What it can answer

Intent Example question
SEARCH "What features analyse customer spending?"
DEFINITION "What is lifetime_amount?"
USAGE "How do I use customer_age in a dashboard?"
FRESHNESS "Are the pharmacy features still up to date?"
SUMMARY "Give me an overview of the claims domain."
LINEAGE "Where does provider_amount_zscore come from?"
EXPLAIN "How is risk_index calculated?"

The agent is a LangGraph StateGraph with a MemorySaver singleton, so a follow-up question reuses the previous turn's resolved entity, feature group, and data domain — no need to repeat context.

Launch the chatbot

from tdfs4ds.agent import launch_chatbot_with_index

launch_chatbot_with_index(port=7860, force_rebuild=False)

That single call (1) builds or refreshes the vector index from the business dictionary, then (2) opens a Gradio UI with a chat pane, a collapsible agent trace panel, and a visualizations panel for charts returned by MCP tools.

Programmatic use

from tdfs4ds.agent import consumer_agent

answer = consumer_agent(
    "What features do we have for the customer entity?",
    thread_id="alice-session-1",
)

Pass the same thread_id on the next call and the agent picks up where it left off — same domain, same entity, same feature group in scope.

Where the answers come from

The agent uses structured SQL first (catalog lookups, follow-up reports, SHOW VIEW DDL) and falls back to vector search when the SQL exact-match path returns nothing. The vector index has its own training module — see Module 5 › Vector store backends for where the index actually lives and how to choose between Chroma and the Teradata Vector Store.

Learn more