MATIH Platform is in active MVP development. Documentation reflects current implementation status.
14. Context Graph & Ontology
Agent Thinking
Agent Thinking Overview

Agent Thinking Overview

The Agent Thinking subsystem captures, stores, and analyzes the reasoning processes of AI agents during execution. It records every thinking step, LLM API call, and decision point as structured traces, then generates embeddings for similarity search and reasoning analytics.


Architecture

+-------------------+     +-------------------------+
| Agent Orchestrator| --> | Orchestrator Hooks      |
+-------------------+     +------------+------------+
                                       |
                          +------------v------------+
                          | AgentThinkingCapture    |
                          | Service                 |
                          +------------+------------+
                                       |
                    +------------------+------------------+
                    |                  |                  |
           +-------v------+  +--------v-------+  +------v--------+
           | Dgraph Store |  | Kafka Producer |  | Thinking      |
           | (persistence)|  | (streaming)    |  | Embeddings    |
           +--------------+  +----------------+  +---------------+

Key Components

ComponentDescription
AgentThinkingCaptureServiceCaptures agent reasoning during execution
ThinkingEmbeddingServiceGenerates vector embeddings for thinking traces
DgraphContextStorePersists traces, steps, and API calls to Dgraph
ContextGraphOrchestratorHooksNon-invasive integration with agent orchestrators

Subsections

PageDescription
Thinking TracesStructure and lifecycle of agent thinking traces
Thinking EmbeddingsVector embedding generation for trace similarity
Reasoning AnalyticsAnalytics dashboards for agent reasoning patterns

Thinking Step Types

Step TypeDescription
INTENT_ANALYSISAnalyzing user intent from the query
ENTITY_EXTRACTIONExtracting entities from the query context
SQL_GENERATIONGenerating SQL from natural language
TOOL_SELECTIONChoosing which tool or agent to delegate to
VALIDATIONValidating generated outputs
REFINEMENTRefining results based on feedback