[agents] Add agent-session scrobbling for Gemini and opencode providers
All checks were successful
ci / test (push) Successful in 3m2s
ci / build-and-deploy (push) Has been skipped

This commit is contained in:
2026-07-31 00:21:24 -04:00
parent 952ed596da
commit 0c92174440
26 changed files with 1458 additions and 5 deletions

View File

@ -185,7 +185,7 @@ events).
- Timestamp picker (default to now)
- Optional: barcode scanning for food/drinks via CameraX
* Backlog [0/24] :vrobbler:project:personal:
* Backlog [2/26] :vrobbler:project:personal:
** TODO [#C] After transition to linux add curl_cffi as webpage scrapper again :webpages:metadata:
** TODO [#C] Create small utility to clean up tracks scrobbled with wonky playback times :bug:music:scrobbles:
:PROPERTIES:
@ -698,6 +698,39 @@ The Edit log form should have from top to bottom:
*** Description
** TODO [#A] Add trends tests for concurrent trends :trends:tests:concurrent:
** DONE [#A] Add agent-session scrobbling :scrobbles:agents:
:PROPERTIES:
:ID: 0114a3d8-b13e-bbb6-b461-c7005e9be680
:END:
*** Description
What if we could "scrobble" an agent session? Honestly, this is mostly applicable to
web searches or quick questions via Gemini or similar web-based agents.
The scrobble should be the tool, so using Gemini is an agent_session scrobble, and the
associated prompt and any response are stored in the AgentSessionLogData. For this,
we'd need a way to start a prompt with an AI agent via python libraries like genai.
Then we'd ask a question or a prompt request in the top Scrobble something bar. In
this case, an entry without a -<letter> prefix would be understood as starting a
Gemini chat and would send the prompt to Gemini, get a response and return it
to the browser, starting a new scrobble and storing any response in the log data.
Then the AgentSessionLogData would capture a list of turns: [{"prompt_id": <id>,
"prompt": "A request prompt", "response": "An agent respones"},
**** Tasks
- [X] Add agents app with AgentSession model and AgentSessionLogData
- [X] Add gemini (httpx) and opencode (CLI) agent provider modules
- [X] Wire AgentSession into scrobbles (media type, FK, prefetching)
- [X] Route unprefixed manual scrobble input to agent sessions
- [X] Add async Celery task to fetch turn responses
- [X] Render agent turns on scrobble detail with htmx polling
- [X] Add agent session list/detail views and templates
- [X] Generate migrations
- [X] Write tests
** DONE [#A] Fix small bug in nature importer if geojson is missing :importers:nature:
:PROPERTIES:
:ID: 0e0a9089-fda1-5e0d-6974-bebacb571cd3