Agentic System Architecture & Zero-Defect Observability
Tharior Remedai is architected with defensive exception boundaries, multi-generational memory leak fences, circuit breakers, and a Dead-Letter Queue (DLQ) that guarantees zero unhandled application crashes.
1. Specialized A2A AgentCards
Executes sub-100ms AST lookup, evaluates task ambiguity, and halts with clarifying questions when requirements are underspecified.
Remediates unit test failures, API serialization bugs, concurrency edge cases, and retry policies.
Resolves React hook re-renders, visual CSS layouts, and accessibility violations.
Synthesizes multi-file refactoring, distributed state synchronization, deadlocks, and schema migrations.
Scans patches for OWASP Top 10 vulnerabilities, HMAC verification, and tenant isolation leakage.
Validates HPA scaling policies, KEDA ScaledObjects, resource limits, and Docker builds.
2. Zero-Missed Observability & DLQ Replay
Every execution trace, AST traversal, LLM prompt, and sandbox result emits structured correlation events
(trace_id, span_id, task_id, duration_ms, cost_usd).
3. Circuit Breakers, Model Failover & PR Automation
External endpoints and LLM invocations are guarded by asynchronous circuit breakers (CLOSED → OPEN → HALF-OPEN).
To maximize reliability during autonomous code generation:
- Client/Model 4xx Filtering: Transient model errors (e.g. temporary upstream 404s or parameter mismatches) are filtered so they never trip the global gateway circuit breaker.
- Multi-Model Candidate Failover: When synthesizing code, the agent pipeline attempts up to 5 verified candidate models within the assigned tier before reporting failure.
- Dual Routing: The primary route connects via OpenRouter Gateway with fallback to Straight provider SDKs when direct keys are configured.
- Automated Pull Request Dispatch: Validated patches trigger automated local branch creation (
remedai/patch-<hex>), commit generation, and event bus broadcasts for Git PR opening.
4. Memory Management & Multi-Generational GC
To guarantee zero memory leaks in 24/7 Kubernetes worker pods:
- In-memory event buffers are capped using bounded ring buffers (
maxlen=2000). - A background memory watcher inspects RSS every 30 seconds. If usage reaches 75% of limit, it executes 3-generation garbage collection (
gc.collect(2)). - All ephemeral attachments and scratchpads are purged using guaranteed asynchronous context managers.