feat(messaging): proactive agent messaging via send_message MCP tool (#321) - #358
Merged
Conversation
…321) Enables agents to send proactive messages to specific users by verified email across Telegram, Slack, and web channels. Key features: - Explicit opt-in consent via allow_proactive flag on agent_sharing - Redis-based rate limiting (10 messages/recipient/hour) - Mandatory audit logging for all proactive sends - New send_message MCP tool for agent-to-user outreach - Channel resolution: telegram -> slack -> web (auto mode) Backend changes: - New ProactiveMessageService with delivery adapters - Messages router with POST /api/agents/{name}/messages - allow_proactive column + migration on agent_sharing - Telegram reverse lookup by verified email - Slack get_user_by_email for DM delivery MCP Server changes: - New send_message tool with Zod validation - TrinityClient.sendUserMessage() method Closes #321 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Documents the proactive agent messaging feature: - Architecture diagram showing message flow - API endpoints (send, update flag, list shares) - MCP tool usage - Database schema changes - Security considerations Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add documentation for new components introduced in PR #358: - messages.py router in Public Access & Monetization section - proactive_message_service.py in Integrations section - messages.ts MCP tool module (send_message tool) - Update tool count from 66 to 67 across 15 modules Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
Enables agents to send proactive messages to specific users by verified email across Telegram, Slack, and web channels.
allow_proactiveflag on their agent_sharing recordChanges
Backend (Python):
src/backend/services/proactive_message_service.py— New service with channel adapterssrc/backend/routers/messages.py—POST /api/agents/{name}/messagesendpointsrc/backend/db/agent_settings/sharing.py—can_agent_message_email(),set_allow_proactive()src/backend/db/migrations.py—allow_proactivecolumn migrationsrc/backend/db/telegram_channels.py— Reverse lookup by verified emailsrc/backend/services/slack_service.py—get_user_by_email()for DM deliveryMCP Server (TypeScript):
src/mcp-server/src/tools/messages.ts— Newsend_messageMCP toolsrc/mcp-server/src/client.ts—sendUserMessage()API methodsrc/mcp-server/src/server.ts— Tool registrationTests:
tests/test_proactive_messaging.py— 18 test cases covering validation, auth, channelsTest Plan
cd tests && pytest test_proactive_messaging.py -vallow_proactive, send message via MCPaudit_logtable forproactive_messageeventsCloses #321
🤖 Generated with Claude Code