agora.observe.jsonl
Structured run logging — JSONL schema v1.
Every Agora run that wires a RunObserver emits two files into a
per-run output directory:
run.jsonl— a singleRunRecordline (the whole-run summary).tasks.jsonl— oneTaskRecordline per task (execution order).
Both records carry schema_version = 1. The schema is locked (Phase A,
Artifact 1) — fields, names, and closed vocabularies are pinned here as
pydantic models so downstream analysis can validate every line it reads.
The observer is intentionally decoupled from the orchestrator’s own types: it
exposes two low-level emit methods (RunObserver.record_task() and
RunObserver.record_run()) that take plain values, so a test can drive it
with a fake orchestrator. The orchestrator-facing convenience
(RunObserver.record_task_from_result()) does the derivation from a
TaskResult.
Tool-call accounting semantics. The three primary counters share one unit — tool calls — so they reconcile arithmetically:
tool_calls_structured + tool_calls_text_fallback == tool_calls_total
tool_calls_total— total model-emitted tool calls executed on the task, summed across stages and attempts (synthetic auto-hook calls are excluded). A call count.tool_calls_structured— calls that arrived via the assistant message’s nativetool_callsfield. A call count.tool_calls_text_fallback— calls extracted by the Ollama adapter’s_parse_tool_calls_from_textfrom prosecontent. A call count, and the headline tool-call-fidelity signal. (The adapter’s fallback only runs when the structured field was empty, so a given turn’s calls are wholly one origin — never a mix — which is what makes the invariant exact.)
Overlap counters (a single call can be counted here and in one of the two origin buckets above — they are NOT part of the reconciliation sum):
tool_calls_malformed— tool executions that raised (arg/exec error).tool_call_unknown_name— calls naming a tool that doesn’t exist.
Side-channel turn counter (NOT a call count, named explicitly so it can’t be confused with the primaries):
turns_with_text_fallback— number of LLM turns on which the text-fallback parser fired (≥1 call extracted from prose).first_text_fallback_iteration— 0-based index of the first iteration on which the parser extracted ≥1 call from prose; null if it never fired.
Module Attributes
|
Closed vocabulary for |
|
Closed vocabulary for |
|
Closed vocabulary for |
|
Log substrings that indicate an asyncio resource leak. |
Functions
|
Derive a |
|
Classify a non-passing task into |
|
Map a task outcome to the |
|
Best-effort HEAD short SHA; |
|
Build a |
|
Best-effort Ollama daemon version via |
|
Count run-log lines matching any |
Classes
The experiment arm a run belongs to. |
|
|
One line in |
|
One task's contribution to a phase gate (provenance). |
One line of a campaign's |
|
One |
|
Full inference-config snapshot recorded with each run (NOT just the name). |
|
Accumulates run signals and emits |
|
The single line in |
|
One line in |
- class agora.observe.jsonl.ArmSpec[source]
Bases:
BaseModelThe experiment arm a run belongs to.
v1 records both axes; only
strictness="strict"is scored andscaffoldingdoes not yet switch behaviour (see design notes). The fields exist so future axes can sweep them without a schema bump.- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- scaffolding: Literal['lean', 'rich']
- strictness: Literal['strict', 'permissive']
- class agora.observe.jsonl.PlanEntry[source]
Bases:
BaseModelOne line of a campaign’s
plan.jsonl(written byscripts/run_campaign.py).The serialized line carries
{id, probe, profile, arm, repeat, params}.run_idis NOT part of that line — it is a load-time enrichment populated byagora.observe.analysis.load_run_records(), which matches this entry’s per-run subdirectory (named byid) to therun.jsonlfound inside it. That lets downstream joins map a run’s uuidrun_idback to its campaign id and repeat.extra="ignore"keeps the model forward-compatible with future plan keys.- model_config = {'extra': 'ignore'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agora.observe.jsonl.PostconditionOutcome[source]
Bases:
BaseModelOne
(name, passed)pair from a task’s postcondition evaluation.- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agora.observe.jsonl.ProfileSnapshot[source]
Bases:
BaseModelFull inference-config snapshot recorded with each run (NOT just the name).
- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agora.observe.jsonl.RunObserver[source]
Bases:
objectAccumulates run signals and emits
run.jsonl+tasks.jsonl.Construct one per run with the static metadata (profile snapshot, arm, probe name, flow path). The orchestrator calls
task_started()each time a task executes (so loop-backs/retries are counted), thenrecord_task_from_result()per task andrecord_run()once at shutdown. Tests can drive the low-levelrecord_task()/record_run()directly.The two files are opened (truncated) on construction so a partially completed run still leaves valid lines on disk.
- __init__(*, run_id, output_dir, probe_name, flow_path, project_name, profile, arm=None, log_path=None, ollama_version='unknown', git_commit='unknown', host=None, notes='', strategy=None, harness=None, probe_version=None)[source]
- static resolve_output_dir(run_id, override=None)[source]
Resolve the run output dir.
Precedence: explicit
override→AGORA_RUN_OUTPUT_DIRenv →runs_out/_default/<run_id>/.
- record_task(**fields)[source]
Validate + append one
TaskRecordtotasks.jsonl.
- record_phase_gate(result, *, run_id=None)[source]
Append one phase-gate outcome to
phases.jsonl(integration run 1).Accepts a
agora.fleet.phase_gate.PhaseGateResult(duck-typed:phase,passed,blockers, andtasksofTaskGateOutcome). Opensphases.jsonlon first call.
- record_run(**fields)[source]
Validate + write the single
RunRecordtorun.jsonl.Computes
async_leak_hitsfrom the wired log path when not supplied.
- record_task_from_result(*, task, result, role, task_index)[source]
Build + emit a
TaskRecordfrom a task and itsTaskResult.resultisNonefor tasks that never executed (skipped).
- class agora.observe.jsonl.RunRecord[source]
Bases:
BaseModelThe single line in
run.jsonl— the whole-run summary.- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- schema_version: Literal[1]
- profile: ProfileSnapshot
- class agora.observe.jsonl.TaskRecord[source]
Bases:
BaseModelOne line in
tasks.jsonl— the outcome of a single task.- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- schema_version: Literal[1]
- task_kind: TaskKind
- status: TaskStatusLiteral
- postconditions: list[PostconditionOutcome]
- agora.observe.jsonl.classify_task_kind(*, output_path='', postcondition_names=(), stage_kinds=(), role='')[source]
Derive a
TaskKindfrom a task’s structural signals.Precedence (first match wins): framework stage kinds → reviewer role → api_spec → research (
kb/) → test authoring (test-file output) → test run (pytest/imports postconditions) →code_body.Unclassifiable tasks (no output path, no postconditions, no role) fall back to
"code_body"with a warning — the contract never invents a new vocabulary value.
- agora.observe.jsonl.derive_failure(*, status, output, postcondition_results, tool_calls_malformed=0, tool_call_unknown_name=0)[source]
Classify a non-passing task into
(failure_category, failure_detail).failure_detailis a short token (predicate name / exception head), never free-form prose.
- agora.observe.jsonl.derive_status(success, output)[source]
Map a task outcome to the
TaskStatusLiteralvocabulary.A task whose
outputbegins with"ERROR: "is the orchestrator’s exception wrapper (the agent loop raised), classified"error"; otherwise a non-success is a clean"failed"(postconditions).
- agora.observe.jsonl.git_commit_short(repo_dir=None)[source]
Best-effort HEAD short SHA;
"unknown"if git is unavailable.
- agora.observe.jsonl.profile_snapshot_from(profile)[source]
Build a
ProfileSnapshotfrom aModelProfile.temperatureandseedare read from the profile itself — the same valuesagora.fleet.profiles.build_llm_factory()threads into the Ollama options dict — so the recorded snapshot is a true record of what the daemon was told, not a caller-supplied annotation.