Skip to content

[Observability] Emit structured logs from the LangGraph implementation that match its contract's observability_hooks #36

Description

@Skull-boy

What this is

The contract.yaml for every implementation in this repo
declares an observability field — what the agent surfaces
about its own execution.

Right now that field is documentation. The LangGraph
duplicate-issue-detector declares it, but the implementation
emits nothing structured. No log file. No event schema.
Nothing a downstream system could read.

This issue is to make observability real for one implementation:
emit structured JSON logs from the LangGraph duplicate-issue-detector
that match exactly what its contract declares.

Why this matters

The repo is heading toward a self-evolving harness where agents
improve over time based on their own execution history. That
improvement loop reads telemetry. If nothing emits telemetry,
the loop has nothing to read.

This issue is the first step toward that. A contributor who
picks this up is not writing a logging utility — they are
building the data layer the harness will eventually read from.

What the deliverable is

One new file:
implementations/langgraph/duplicate-issue-detector/observability.py

A simple structured logger that emits one JSON event per
agent invocation:

{
  "node_id": "duplicate-issue-detector-v1",
  "task_id": "uuid4-generated-per-run",
  "timestamp": "2026-09-05T08:47:00Z",
  "event": "invocation_complete",
  "success": true,
  "latency_ms": 340,
  "retry_count": 0,
  "tool_calls": ["qdrant.search", "github.comment"],
  "input_hash": "sha256-of-input",
  "output_hash": "sha256-of-output"
}

Where it writes:

  • To stdout (so GitHub Actions can capture it)
  • To logs/<node_id>/<date>.jsonl as append-only JSON-lines

Wired into the existing nodes:

  • detect() emits on completion (success or failure)
  • act() emits on completion (success or failure)
  • Failures emit "success": false with an "error" field —
    they never swallow exceptions silently

Updated contract.yaml:
The observability field currently says what is logged.
Update it to also specify the schema — add a
log_schema sub-field pointing to the event structure above.

Constraints

  • Do not add any external logging dependency.
    stdlib only: json, hashlib, uuid, datetime, pathlib.
  • The node_id in every emitted event must match the
    node_id that will be declared in the context_contract
    field when that spec lands — use
    "duplicate-issue-detector-v1" exactly.
  • Every event must be valid JSON on a single line
    (JSON-lines format). No pretty-printing in the file output.
  • Failures must still emit — a run that raises an exception
    must emit success: false before re-raising.
    Silent failures are not acceptable.
  • The log directory must be in .gitignore —
    no one commits actual log files.

How to get started

  1. Fork the repo
  2. Read implementations/langgraph/duplicate-issue-detector/ contract.yaml — specifically the observability field
  3. Write observability.py with the schema above
  4. Wire it into nodes.py at the end of detect() and act()
  5. Update contract.yaml to add log_schema
  6. Add .gitignore entry for logs/
  7. Open a PR

Drop a comment before starting so effort isn't duplicated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions