Repository navigation
feat(chat): agent self-execute with optional result injection (#264) - #334
Merged
Merged
Conversation
Allow agents to trigger background tasks on themselves during chat via `chat_with_agent(agent_name=<self>, parallel=true)`. New `inject_result` parameter optionally surfaces the result as a styled message in the originating chat session. Backend: - Add SELF_TASK activity type for distinct tracking - Detect self-calls when x_source_agent == target name - Security: validate X-Source-Agent matches MCP key scope - Result injection into chat_messages with source='self_task' - WebSocket events for self-task start/completion MCP: - Add inject_result and chat_session_id params to chat_with_agent - Self-call detection and logging Frontend: - Self-task in activity types query (network store) - ChatBubble: collapsible purple-styled self-task results Tests: 21 unit tests covering detection, validation, injection logic Closes #264 Co-Authored-By: Claude Opus 4.5 <[email protected]>
vybe
added a commit
that referenced
this pull request
Apr 14, 2026
Sprint C now 3/5 complete. Next: #294 (validation). Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.
Summary
SELF_TASKactivity type for tracking agent self-execute background tasksinject_resultparameter to surface task results as collapsible chat messagesX-Source-Agentheader against MCP key scope to prevent header spoofingChanges
src/backend/models.py- AddedSELF_TASKenum,inject_resultparamsrc/backend/routers/chat.py- Self-task detection, security validation, result injectionsrc/mcp-server/src/tools/chat.ts- Addedinject_result,chat_session_idparamssrc/mcp-server/src/client.ts- Updated options interfacesrc/frontend/src/components/chat/ChatBubble.vue- Collapsible purple-styled self-task resultssrc/frontend/src/stores/network.js- Addedself_taskto activity filtertests/test_self_execute.py- 21 unit tests for detection, security, injection logicdocs/memory/feature-flows/self-execute.md- Feature flow documentationTest Plan
pytest tests/test_self_execute.py -v(21 passed)chat_with_agent(self, parallel=true, inject_result=true)Closes #264
🤖 Generated with Claude Code