MATIH Platform is in active MVP development. Documentation reflects current implementation status.
1. Introduction
Agent Workflows

Agent Workflows

Beta - ai-service, ops-agent-service -- Custom agent creation, workflow automation

The Agent Workflows pillar of the MATIH Platform extends the conversational analytics capability beyond ad-hoc queries into structured, reusable AI agent workflows. Users can create custom agents that combine data queries, ML model predictions, external API calls, and human approval steps into automated workflows that execute on schedule or in response to events.


1.1What Are Agent Workflows?

An agent workflow is a multi-step process orchestrated by MATIH's LangGraph-based AI engine. Unlike a simple query-response interaction, a workflow:

  • Persists across sessions -- Workflows run independently of user sessions; they can execute on schedule or in response to events
  • Combines multiple capabilities -- A single workflow can query data, run ML predictions, generate visualizations, and send notifications
  • Includes human-in-the-loop steps -- Sensitive operations (model deployments, data modifications) can require human approval before proceeding
  • Maintains state -- Each workflow execution tracks its state through all steps, enabling pause, resume, and rollback

Workflow vs. Conversation

AspectConversational QueryAgent Workflow
TriggerUser types a questionSchedule, event, or manual trigger
DurationSeconds to minutesMinutes to hours
PersistenceSession-scoped (24h TTL)Permanent until deleted
ComplexitySingle query + analysisMulti-step with branching and loops
ApprovalNot requiredConfigurable approval gates
NotificationStreamed via WebSocketEmail, Slack, Teams, webhook
ReusabilityOne-off (can be saved as template)Designed for repeated execution

1.2Agent Types

MATIH provides several pre-built agent types that can be composed into workflows:

Agent TypeDescriptionExample Use Case
SQL AgentGenerates and executes SQL queries with full RAG context"Query monthly revenue by product category"
Analysis AgentPerforms statistical analysis on query results"Compute year-over-year growth rate and flag anomalies"
Visualization AgentGenerates chart specifications from data"Create a stacked bar chart of results"
ML Prediction AgentInvokes deployed ML models for inference"Run churn prediction on this customer segment"
Data Quality AgentChecks data quality scores and triggers alerts"Verify that data freshness meets SLA before proceeding"
Notification AgentSends messages via email, Slack, Teams, or webhook"Send daily summary to the sales team"
Approval AgentPauses workflow and requests human approval"Get manager approval before deploying model to production"
HTTP AgentCalls external APIs and processes responses"Fetch exchange rates from external API and enrich data"
Ops AgentExecutes operational tasks (scaling, config changes)"Scale up Trino workers before heavy batch processing"

1.3Workflow Definition

Workflows are defined as directed acyclic graphs (DAGs) of agent steps. Each step specifies:

Workflow: Daily Revenue Report
  |
  Step 1: SQL Agent
  |  Query: "Revenue by product category for yesterday"
  |  Output: query_results
  |
  Step 2: Analysis Agent
  |  Input: query_results
  |  Task: "Compare to same day last week; highlight anomalies > 2 std dev"
  |  Output: analysis_results
  |
  Step 3: Visualization Agent
  |  Input: query_results, analysis_results
  |  Task: "Bar chart with anomaly annotations"
  |  Output: chart_spec
  |
  Step 4: Conditional Branch
  |  If: any anomaly detected in analysis_results
  |  Then: Step 5 (Alert)
  |  Else: Step 6 (Report)
  |
  Step 5: Notification Agent
  |  Channel: Slack #revenue-alerts
  |  Message: "Revenue anomaly detected: {analysis_results.summary}"
  |  Attachment: chart_spec rendered as PNG
  |
  Step 6: Notification Agent
  |  Channel: Email (daily-report@company.com)
  |  Message: "Daily revenue report attached"
  |  Attachment: Full report with chart and analysis
  |
  Schedule: Daily at 08:00 UTC

Workflow Creation Methods

Workflows can be created through three methods:

MethodAudienceDescription
ConversationalAll usersDescribe the workflow in natural language; the AI generates the workflow definition
Visual builderBI developers, data engineersDrag-and-drop workflow builder in the Agentic Workbench
YAML definitionDevelopersDefine workflows as YAML files, version-controlled in git

1.4Workflow Execution

Trigger Types

TriggerDescriptionExample
ScheduleCron-based execution"Run every Monday at 9:00 AM"
EventKafka event triggers execution"Run when data quality alert fires for orders table"
ManualUser-initiated from Agentic Workbench"Run this workflow now"
APIExternal system triggers via REST API"Trigger from CI/CD pipeline after data load completes"
WebhookIncoming HTTP request triggers execution"Trigger when Slack slash command received"

Execution Engine

Workflows are executed by the ai-service using LangGraph with Temporal as the durable execution backend:

  1. Workflow received -- Trigger event received by ai-service
  2. Temporal workflow started -- Durable workflow initiated with full state tracking
  3. Steps execute sequentially -- Each agent step runs as a Temporal activity with configurable timeout and retry
  4. State checkpointed -- After each step, state is persisted to Temporal's database
  5. Approval gates -- If a step requires approval, workflow pauses and notification is sent
  6. Completion -- Final step executes; results stored and notification sent

Fault Tolerance

Failure ScenarioRecovery Mechanism
Agent step failsAutomatic retry with exponential backoff (configurable: 1, 3, 5 retries)
Service unavailableTemporal workflow pauses and resumes when service recovers
Approval timeoutConfigurable timeout with default action (approve, reject, or escalate)
Data quality check failsWorkflow branches to error handling path
Infrastructure failureTemporal replays workflow from last checkpoint

1.5Agent Marketplace

Planned - Designed for future release -- agent sharing and discovery

The Agent Marketplace will enable organizations to share and discover pre-built agent workflows:

Marketplace FeatureDescription
Template libraryCurated collection of workflow templates for common business processes
Custom agentsOrganizations can publish custom agents for internal use
Version managementAgents versioned with semantic versioning; consumers can pin to specific versions
Rating and reviewsUsers rate and review agents based on effectiveness and reliability
Usage analyticsTrack which agents are most used, their success rates, and performance metrics

Pre-Built Workflow Templates

TemplateDescriptionAgents Used
Daily KPI ReportAutomated daily report with anomaly detection and distributionSQL, Analysis, Visualization, Notification
Data Quality MonitorContinuous quality monitoring with alerting and escalationData Quality, Notification, Approval
Model Performance ReviewWeekly model performance report with drift analysisML Prediction, Analysis, Visualization, Notification
Customer Churn AlertReal-time churn risk scoring with proactive outreach triggersSQL, ML Prediction, Notification
Cost Anomaly DetectionCloud cost monitoring with automated scaling recommendationsSQL, Analysis, Ops, Approval, Notification
Compliance AuditAutomated compliance check with report generationSQL, Data Quality, Analysis, Notification

1.6The Ops Agent Service

The ops-agent-service (Python, port 8080) provides operational automation capabilities:

CapabilityDescription
Infrastructure scalingAutomated scaling of platform components based on workload patterns
Incident responseAutomated initial response to common incidents (restart services, clear caches, adjust limits)
Capacity planningUsage trend analysis with scaling recommendations
Cost optimizationIdentify underutilized resources and recommend right-sizing
Runbook automationConvert operational runbooks into executable agent workflows

The Ops Agent is designed to work alongside human operators, not replace them. It handles routine operational tasks automatically and escalates complex situations to human operators with context and recommendations.


Deep Dive References

  • AI Service Agents -- Agent architecture, state management, and custom agent development
  • AI Service Integrations -- Kafka integration, webhook handling, and external API connectivity
  • Ops Agent -- Operational automation agent architecture and runbook format