Skip to Content
Execution & MonitoringThe TDAO Loop

The TDAO Loop

Every AiQarus agent executes using the Think-Decide-Act-Observe (TDAO) loop—a structured reasoning framework that ensures transparency and traceability.

Overview

┌─────────────────────────────────────────────────────────┐ │ │ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │ THINK │────▶│ DECIDE │────▶│ ACT │────▶│ OBSERVE │ │ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │ │ │ │ │ │ ▼ ▼ ▼ ▼ │ [Analyze] [Choose] [Execute] [Summarize] │ │ │ ├── Complete ──▶ Exit with Result │ ├── Continue ──▶ Loop ─────────────┘ │ └── Fail ──────▶ Exit with Error └─────────────────────────────────────────────────────────┘

The Four Phases

1. THINK

The agent analyzes the current situation.

Input:

  • Original user input/goal
  • Previous observations (if any)
  • Current context and state

Output:

  • Structured reasoning trace
  • Identification of what’s known vs unknown
  • Assessment of progress toward goal

Example Think Output:

{ "phase": "think", "reasoning": "The user wants to offboard Sarah Chen. I have gathered her employee ID and access information. I've identified that she has AWS admin access which is high-risk given she's leaving for a competitor. I need to prioritize revoking this access before proceeding with other offboarding tasks.", "knowns": [ "Employee: Sarah Chen", "Department: Engineering", "AWS access level: Admin", "Departure type: Competitor" ], "unknowns": [ "Pending code reviews", "Active customer relationships" ], "progress": "40% - Information gathered, ready for action planning" }

2. DECIDE

The agent chooses what to do next.

Possible Decisions:

DecisionMeaningNext Step
ContinueMore work to doProceed to ACT with specific action
CompleteGoal achievedExit with final output
FailCannot proceedExit with error explanation

Example Decide Output:

{ "phase": "decide", "decision": "continue", "action": { "tool": "okta_revoke_access", "parameters": { "user_id": "sarah.chen@company.com", "application": "aws-production" }, "justification": "Revoking AWS admin access first due to high risk (competitor departure + production access)" }, "risk_score": 85, "requires_approval": true }

3. ACT

The agent executes the decided action.

What Happens:

  • Tool is invoked with specified parameters
  • External systems are called
  • Results are captured
  • All activity is traced

Example Act Output:

{ "phase": "act", "tool": "okta_revoke_access", "input": { "user_id": "sarah.chen@company.com", "application": "aws-production" }, "output": { "success": true, "revoked_at": "2026-01-15T14:30:00Z", "affected_resources": 15 }, "duration_ms": 1250 }

4. OBSERVE

The agent summarizes results to inform the next iteration.

Example Observe Output:

{ "phase": "observe", "summary": "Successfully revoked AWS production admin access for Sarah Chen. 15 resources were affected. The user can no longer access production databases, EC2 instances, or S3 buckets.", "state_changes": [ "AWS admin access: active → revoked" ], "next_considerations": [ "Proceed with GitHub access revocation", "Document which resources were affected for audit" ] }

Step Records

Each TDAO iteration creates a Step record:

{ "step_id": "step_456", "run_id": "run_123", "step_number": 3, "phases": { "think": { ... }, "decide": { ... }, "act": { ... }, "observe": { ... } }, "tokens_used": { "input": 2500, "output": 800 }, "duration_ms": 4500, "started_at": "2026-01-15T14:29:55Z", "completed_at": "2026-01-15T14:30:00Z" }

Why TDAO Matters

1. Transparency

Every decision is recorded with full reasoning:

  • Why the agent chose this action
  • What alternatives were considered
  • How risk was assessed

2. Debuggability

When something goes wrong, you can trace:

  • Which step failed
  • What the agent was thinking
  • What information it had

3. Auditability

Regulators and compliance teams can review:

  • The complete decision-making process
  • Justifications for each action
  • Risk assessments and approvals

4. Reproducibility

Given the same input and state:

  • The same reasoning should occur
  • Behavior is predictable
  • Testing is reliable

Viewing TDAO in the UI

The Run Detail view shows each step:

┌─────────────────────────────────────────────────────────────────────┐ │ Run: Off-boarding Sarah Chen │ │ Status: Completed │ │ │ │ ────────────────────────────────────────────────────────────────── │ │ │ │ Step 1: Gather Information ✓ 2.1s │ │ ├─ THINK: Analyzing offboarding request... │ │ ├─ DECIDE: Continue → fetch_employee_data │ │ ├─ ACT: Called okta_get_user → success │ │ └─ OBSERVE: Retrieved employee profile and access list │ │ │ │ Step 2: Assess Risk ✓ 1.8s │ │ ├─ THINK: Evaluating access scope and departure type... │ │ ├─ DECIDE: Continue → calculate risk score │ │ ├─ ACT: Risk assessment complete → score: 85/100 │ │ └─ OBSERVE: High risk due to competitor + admin access │ │ │ │ Step 3: Revoke AWS Access ✓ 3.5s │ │ ├─ THINK: Prioritizing AWS due to high risk... │ │ ├─ DECIDE: Continue → revoke_aws_access (approval required) │ │ │ └─ 🛑 PAUSED for approval (approved by john@company.com) │ │ ├─ ACT: Called okta_revoke_access → success │ │ └─ OBSERVE: AWS access revoked, 15 resources affected │ │ │ │ [Expand All] [Verify Audit Chain] [Export] │ │ │ └─────────────────────────────────────────────────────────────────────┘

Configuration

Custom Phase Prompts

Override default prompts for each phase:

phase_prompts: think: "Carefully analyze the current situation. Consider all available information and identify what you know vs what you need to find out." decide: "Based on your analysis, decide the next action. Always explain your reasoning." observe: "Summarize what happened and what it means for the overall goal."

Phase Timeouts

Set timeouts for individual phases:

phase_timeouts: think: 30s decide: 10s act: 60s observe: 15s