Agent Architecture
Torale uses a Gemini-powered monitoring agent (Pydantic AI) instead of the previous multi-provider pipeline.
Architecture Overview
APScheduler (cron trigger)
↓
Backend (job.py orchestrator)
↓
Agent (Gemini + Pydantic AI tools)
↓
Structured Response → Persist + Notify + RescheduleAgent Workflow
The agent receives a prompt with the task's search query, condition, and previous evidence, then:
- Gets current datetime via MCP tool
- Retrieves memories from Mem0 (scoped to task)
- Searches via Perplexity MCP tool
- Evaluates condition against search results
- Stores new meta-knowledge in Mem0
- Returns structured response
Response Format
json
{
"evidence": "Internal reasoning and findings (audit trail)",
"sources": ["url1", "url2"],
"confidence": 0-100,
"next_run": "ISO timestamp or null",
"notification": "User-facing message or null"
}Backend Orchestration
job.py handles the execution lifecycle:
- Creates execution record in database
- Calls agent via A2A JSON-RPC
- Maps response to
task_executionsrow - Sends notifications if condition met
- Auto-completes task if
notify_behavior="once" - Dynamically reschedules via agent's
next_run
Benefits
- Single call — No multi-step pipeline coordination
- Agent memory — Mem0 provides cross-run context without explicit state management
- Dynamic scheduling — Agent adjusts check frequency based on context
- Simpler error handling — Retry the whole call, not individual activities