agora.fleet.auto_learning

Synthesize learnings automatically from postcondition failures.

The flywheel’s agent-volunteered path (report_learning tool) only works when the agent actually calls it. In practice the model often bails on a task with tool_calls=0 at the end — so the most instructive failures (where a postcondition caught a real bug) record nothing, and the loopback retry starts from a blank slate. This module closes that gap.

Given a task id, a failed predicate name, and the predicate’s reason string, it builds a deterministic Learning that the orchestrator can post to Matrix and re-inject into the retry’s context. No agent cooperation required.

Module Attributes

AUTO_LEARNING_CONFIDENCE

Higher than agent reflections because postconditions are ground truth.

AUTO_LEARNING_MARKER

Prefix so post-hoc analytics can distinguish auto vs agent-volunteered.

Functions

synthesize_failure_learning(*, task_id, ...)

Build a deterministic Learning from one postcondition failure.

agora.fleet.auto_learning.AUTO_LEARNING_CONFIDENCE = 0.8

Higher than agent reflections because postconditions are ground truth.

agora.fleet.auto_learning.AUTO_LEARNING_MARKER = '[auto]'

Prefix so post-hoc analytics can distinguish auto vs agent-volunteered.

agora.fleet.auto_learning.synthesize_failure_learning(*, task_id, predicate_name, reason, now=None)[source]

Build a deterministic Learning from one postcondition failure.

The learning id is a stable hash of (task_id, predicate_name, reason) so the same failure recurring twice reinforces the original rather than duplicating. The category is always LearningCategory.FAILURE.