feat(agentapi): stream coalesced tool-call events in SSE chat responses - #98
Closed
fepfitra wants to merge 13 commits into
Closed
feat(agentapi): stream coalesced tool-call events in SSE chat responses#98fepfitra wants to merge 13 commits into
fepfitra wants to merge 13 commits into
Conversation
Mirror the existing agent clone flow: copy type and config into a new disconnected workplace. Tunnel connectors are not copied - the clone needs its own pairing. - models/mixins/workplaces.py: clone_workplace() mixin - routes/workplaces.py: POST /api/workplaces/<id>/clone - templates/workplace_detail.html: Clone button + modal
Deleting an agent rmtrees its chat.db but the AgentChatManager kept the cached AgentChatDB instance. Recreating an agent with the same id returned that stale instance; if its persistent connection had been closed, the lazy _get_conn reopens a fresh empty chat.db (mode=rwc) and _init_tables() never runs for it → 'no such table: chat_sessions' on first query. Add AgentChatManager.drop() which closes and removes the cached instance, and call it from all three agent-delete paths (API route, super-agent tool, CLI). Add regression tests covering the stale-cache failure and the drop-then-recreate recovery.
…cking vision payloads python-requests default UA is blocked by Cloudflare WAF (error 1010) for large image payloads, while small text requests pass. Add a Chrome UA so multimodal image requests reach OpenAI-compatible endpoints behind CF.
…d super agent Previously ANY is_super=1 agent bypassed the agent_skills allowlist check in use_skill, letting every super agent lazy-load any skill (e.g. exa-search) without an explicit assignment. Now the exemption applies only to the agent named by the super_agent_id setting (DB app_settings), so other super agents must have the skill in their agent_skills rows like everyone else. No hardcoding — the setting already exists and defaults to kremas.
Lazy skills load only from agent_skills for non-designated agents; only the super_agent_id agent gets blanket access.
Subscribe to tool_executed events, coalesce per session into a 5s window
(mirrors the Telegram channel pattern), and emit inline SSE events like
{"type":"tool","tool_name":"bash (2x)","has_error":false} so
streaming chat clients can show what the agent is doing.
fepfitra
added a commit
to fepfitra/evonic
that referenced
this pull request
Aug 5, 2026
Contributor
Author
|
Closing: PR was polluted with 12 unrelated commits from merge/our-fixes (clone-workplace, cache-invalidation, telegram-notify, llm_client UA, skill-allowlist). Reopening as a clean single-commit PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The agentapi streaming chat endpoint (
/plugin/agentapi/v1/chat/completionswithstream: true) only forwardsllm_response_chunkandturn_completeevents. Streaming clients (e.g. the pitura-dashboard) can show the agent's text but have NO visibility into what the agent is DOING (running bash, editing files, searching the web). Tool execution is a black box during long agent turns.Fix
Subscribe to the existing
tool_executedevent stream, coalesce tool calls per session into a 5-second window (mirroring the Telegram channel pattern from PR #95), and emit inline SSE events while the stream is open:data: {"type":"tool","tool_name":"bash (2x), python (1x)","has_error":false}has_errorsurfaces failures (client can style themtype: "tool"field distinguishes tool events from normalchoices[].delta.contentchunks.tool_executedis unsubscribed in the samefinallyblock as the other events.Verification
python -c 'import ast; ast.parse(...)'— syntax OK. Live-tested against the dashboard after restart: tool calls appear as compact chips in the chat while the agent works.