MIRA Thalaplan: AgentMira Architecture
Overview
AgentMira is integrated into RAG pipelines (plan_rag_assistant_template and plan_rag_assistant_no_answer_template) in AgentPlanner.py. This document describes the current implementation and planned evolution.
Current Implementation
Status: ✅ Implemented
AgentMira runs as a single agent within the RAG pipeline with an internal LLM-driven loop:
# plan_rag_assistant_template (line 168)
agent_plan_rag_assistant_template.append(
Goal(None, None, "Assistant-Mira", None, GoalTarget.AGENT, agent_mira, [])
)
# plan_rag_assistant_no_answer_template (line 188)
agent_plan_rag_assistant_no_answer_template.append(
Goal(None, None, "Assistant-Mira", None, GoalTarget.AGENT, agent_mira, [-7])
)
Internal Loop Mechanism
- LLM Call: AgentMira invokes the LLM with user prompt + context
- Tool Decision: LLM decides whether to call MIRA MCP tools to query Innovator
- Dynamic Subgoal Injection: If tool invocation needed,
AgentToolCallersubgoal is injected - Tool Execution: MIRA MCP tools extract structured data from Innovator
- Result Integration: Tool results feed back as context for next LLM call
- Loop: Repeats until LLM decides task is complete or max iterations reached
MIRA MCP Tools:
- MIRA_NodeSearch — Search for nodes in knowledge graph
- MIRA_RelationshipQuery — Query relationships between nodes
- MIRA_NodeProperties — Retrieve node properties
- MIRA_PathQuery — Find paths between nodes
- MIRA_Summarize — Generate summaries
Target Implementation
Status: 🚧 Planned
Replace the internal loop with a declarative plan structure: plan_mira. This eliminates dynamic subgoal injection in favor of explicit plan structure managed by Thalaplan.
plan_mira Structure
agent_plan_mira_template = []
agent_plan_mira_template.append(Goal(None, None, "AgentMiraIterator", None, GoalTarget.AGENT, agent_mira_iterator, []))
agent_plan_mira_template.append(Goal(None, None, "Consolidator", None, GoalTarget.CONSOLIDATOR, None, [-1]))
Chain of Goals:
1. AgentMiraIterator (NEW) — Orchestrates multi-step reasoning with tool calls
2. Consolidator — Merges results
Note: AgentMira remains in the RAG plan (current implementation), and plan_mira is invoked as a sub-plan from within AgentMira's internal loop.
AgentMiraIterator (New Agent)
Derives from: AgentToolPreparer
Replaces AgentMira's internal loop. Responsibilities:
- Analyze initial request
- Decide which tool calls are needed
- Instantiate AgentToolCaller subgoals (delegated to Thalaplan)
- Consolidate tool results
- Perform follow-up analysis if needed
Key Difference: Subgoal injection is now declarative (via Thalaplan) rather than imperative (LLM-driven from within AgentMira).
Integration: AgentMira (in RAG plan) calls plan_mira as a sub-plan when tool invocation is needed.
Implementation Roadmap
| Component | Status | Priority | Notes |
|---|---|---|---|
| AgentMira (current) | ✅ Done | — | Working internal loop |
| plan_mira template | 📝 To Do | High | Add to AgentPlanner.init_agent_planner() |
| AgentMiraIterator | 📝 To Do | High | New orchestrator agent |
| Integration | 📝 To Do | High | Replace AgentMira in RAG plans with plan_mira |
Files
- AgentPlanner.py — RAG plan templates (lines 151-200)
PythonServer/src/core/agents/AgentMira.py— Current implementationPythonServer/src/core/agents/AgentMiraIterator.py— New agent (to be created)