Skip to content

Persist /v1/agents/run transcripts (currently response-only) #2640

Description

@jameswnl

Problem

POST /v1/agents/run returns the execution transcript in the response body but never persists it. Once the response is gone, the transcript is unrecoverable:

  • run_agent_handler (src/app/endpoints/agents.py) builds the result dict and returns it — no TranscriptStore save, no filesystem write, no DB row.
  • The workflow path (step_runner) saves every step transcript to PostgreSQL (step_transcripts, keyed by (workflow_id, step_name)), readable later via GET /v1/workflows/{workflow_id}/transcripts.
  • The query path persists transcripts as filesystem JSON per conversation (store_transcript in src/utils/transcripts.py).

So transcripts have three different fates depending on entrypoint: PG (workflows), files (query), nowhere (agents/run).

Why it matters

  • Demos and audits of single-shot agent runs (e.g. the agent-ephemeral Landlock demo) have no server-side record to revisit.
  • Consumers must implement their own capture (tee the response) — easy to forget, and inconsistent with the workflow experience.

Design question

There is no natural storage key: step_transcripts is keyed by (workflow_id, step_name) and an ad-hoc agent run has neither. Options:

  1. PostgreSQL, new table (e.g. agent_run_transcripts keyed by a generated run id returned in the response) — queryable, consistent with workflows; needs schema + fetch API.
  2. Filesystem, mirroring the query-transcript store — cheaper, but a third transcript location with no read API.
  3. By design, won't fix — single-shot runs are the caller's to keep; document that the transcript is response-only.

Acceptance

  • Decision recorded on options 1–3 above.
  • If persisted: transcript retrievable after the fact (API or documented SQL/filesystem path) with a documented retention policy.
  • If won't-fix: documented in the endpoint description and the demo script (docs/cloud-agents-demo-curl.sh — e.g. tee the response to a file).
  • Related: Transcript detail parity across spawn modes (none/local/ephemeral) in /v1/agents/run #2639 (transcript detail parity across spawn modes).

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions