Skip to content

Agent: auto-save flows, query history, shareable URLs, and conversation continuation#180

Merged
asim merged 2 commits intomainfrom
copilot/save-and-share-query-flows
Mar 3, 2026
Merged

Agent: auto-save flows, query history, shareable URLs, and conversation continuation#180
asim merged 2 commits intomainfrom
copilot/save-and-share-query-flows

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Agent queries are ephemeral today — no history, no way to resume or share a result. This adds persistent flows that are saved automatically after every query, with history, shareable URLs, and full context continuation for follow-up queries.

Storage (agent/flows.go)

  • New Flow struct: ID, AccountID, Prompt, Steps (tool+args+result per call), Answer, CreatedAt
  • Persisted to agent_flows.json via existing data.SaveJSON/LoadJSON pattern
  • listFlows returns per-user flows sorted newest-first; deleteFlow enforces ownership

Query handler (agent/agent.go)

  • Auto-save: every successful query is saved as a Flow immediately after synthesis — no user action needed
  • Continue: POST body accepts context_id; prior flow's question+answer is injected into the synthesizer RAG so follow-ups have full context. SSE response event now includes flow_id so the client automatically chains subsequent queries:
    // client side — after first response
    if (ev.flow_id) { document.getElementById('agent-context').value = ev.flow_id; }
  • History: authenticated users see a "Recent queries" card on /agent (last 20, newest-first) with age, tools used, and View/Continue links
  • Shareable URLs: GET /agent/flow/<id> renders the full response (answer card + typed cards + references) publicly; anyone with the link can view
  • Delete: DELETE /agent/flow/<id> with ownership check; returns 500 on persistence failure rather than silently succeeding

Routing (main.go)

  • Added http.HandleFunc("/agent/", agent.Handler) to capture /agent/flow/* sub-paths

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: asim <17530+asim@users.noreply.github.com>
Copilot AI changed the title [WIP] Add feature to save and share agent query flows Agent: auto-save flows, query history, shareable URLs, and conversation continuation Mar 3, 2026
Copilot finished work on behalf of asim March 3, 2026 08:38
@asim asim marked this pull request as ready for review March 3, 2026 08:39
@asim asim merged commit d18478e into main Mar 3, 2026
@asim asim deleted the copilot/save-and-share-query-flows branch March 3, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants