Live App →

Agentic Backend

The brain of Sentinel’s AI layer. Intent classification, agent routing, tool execution, and workflow orchestration.


Architecture

User Query
    │
    ▼
Guardrail Node (parallel)
    │
    ▼
Supervisor Node (GPT-4.1-nano)
    │
    ├──► document_qa ──► RAG Agent ──► KB/OpenSearch
    ├──► portfolio_review ──► Portfolio Engine ──► Calculations + Narrative
    ├──► general_chat ──► Web Search + Reasoning
    ├──► visualization ──► Chart generation
    └──► vision ──► Vision model
    │
    ▼
Response synthesis ──► Streaming (SSE)

Supervisor Intent Classification

The supervisor node classifies every query in parallel with the guardrail:

Intent Trigger Words Destination
document_qa “What does my CAS say”, “extract”, “find in document” RAG Agent
portfolio_review “analyze portfolio”, “Sharpe ratio”, “risk” Portfolio Engine
general_chat “market news”, “what is”, “explain” Web Search + LLM
visualization “chart”, “graph”, “show me allocation” Chart Agent
vision Image upload, “what is in this” Vision model

Parallel gate: Guardrail + Supervisor run simultaneously via asyncio.gather, saving ~200–400ms per request.


Tool Registry

Tools are stored in MongoDB and loaded dynamically at runtime:

Tool Function Provider
session_document_retrieval Search uploaded session documents OpenSearch
web_search Live SERP + snippet extraction Serper/DDG
portfolio_calculator Sharpe, VaR, XIRR, overlap PyPortfolioOpt
chart_generator Allocation charts, time series Matplotlib
zoho_ticket_create Create support ticket Zoho Desk API
excel_export Generate formatted Excel OpenPyXL

Workflow Engine

DAG-based workflow execution:

workflow = {
    "nodes": {
        "extract": {"agent": "nexus", "input": "document"},
        "calculate": {"agent": "portfolio", "input": "extract.output"},
        "narrate": {"agent": "llm", "input": "calculate.output"},
        "export": {"agent": "excel", "input": "narrate.output"}
    },
    "edges": [
        ["extract", "calculate"],
        ["calculate", "narrate"],
        ["narrate", "export"]
    ]
}

WF2 — Portfolio Refresh: Nexus extraction → deterministic calculations → live NAVs → report generation

WF4 — Zoho Support Ops: Ticket intake → SOP RAG → response generation → Excel export


Configuration

Admins can configure agents via API:

POST /api/v1/agents
{
  "name": "custom_portfolio_agent",
  "model": "claude-3-5-sonnet",
  "tools": ["portfolio_calculator", "chart_generator"],
  "guardrails": ["no_buy_sell_advice", "sebi_disclaimer"],
  "system_prompt": "You are a portfolio analyst..."
}