feat(insights): autonomous Agent Improvement Loop — self-scheduling feedback daemon#1278
Open
raphael-solace wants to merge 1 commit intoSolaceLabs:mainfrom
Open
feat(insights): autonomous Agent Improvement Loop — self-scheduling feedback daemon#1278raphael-solace wants to merge 1 commit intoSolaceLabs:mainfrom
raphael-solace wants to merge 1 commit intoSolaceLabs:mainfrom
Conversation
Introduces a self-scheduling feedback-loop agent that continuously analyses the existing SAM persistence layer (tasks, task_events, feedback tables) and produces structured improvement reports as artifacts — no operator intervention required. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
|
This is the ticket: |
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.
The Problem This Solves
Right now, when agents fail, apology-loop, or quietly miss what users are asking for, nobody finds out. The data is all there —
task_events,tasks,feedback— but there is no closed loop between what happens in production and what gets fixed.We have heard this from multiple customers. They build agents, deploy them, and then fly blind. They only discover that a tool is broken or that users keep asking for a capability the agent doesn't have when someone escalates a support ticket. That lag kills trust and slows iteration.
This PR closes that loop.
What This PR Does
Adds an autonomous Agent Improvement Loop daemon — a standard SAM agent that wakes up on a configurable schedule, analyses its own deployment's task history and feedback, and writes a structured improvement report as a persistent artifact.
No human needs to prompt it. No new infrastructure is required. It runs alongside your existing agents and uses only what SAM already persists today.
How it works
The self-scheduling mechanism reuses the exact same
add_timer+publish_a2a_messagepath already used for health checks and agent card publishing. No threads, no external cron, no new services.Files Changed
src/solace_agent_mesh/agent/tools/agent_insights_tools.pysrc/solace_agent_mesh/agent/tools/__init__.pypreset/agents/agent_insights.yamlsam runtests/unit/agent/tools/test_agent_insights_tools.pyThe Three Analysis Tools
query_agent_statsPer-user task counts, completion rate, avg latency, token usage, negative-feedback count. Gives the executive view: is the mesh healthy overall?
query_tool_statsReads
ToolInvocationStartData/ToolResultDatasignals already stored intask_events.payload. Computes per-tool error rate and p95 latency. Flags tools at ≥20% error rate as flaky, ≥5 s p95 as slow.query_recent_failuresReturns failed/cancelled tasks and completed tasks with thumbs-down feedback, with the user's original request text. This is the signal for missing capabilities: when users ask for something and the agent can't do it, the pattern shows up here.
What the Report Looks Like
Each run saves a
insights_report_YYYY-MM-DD.mdartifact structured as:Configuration
To start:
That's it. The agent connects to the broker, registers its timer, and runs autonomously from that point on.
Why This Is a Game Changer
Every agent platform eventually needs to answer: how do I know my agents are actually working well, and how do I improve them without manually reviewing logs?
Today there is no answer in SAM. Customers who ask for observability get told to look at logs. Customers who ask for improvement suggestions get told to review session history manually. This is not scalable and it is not what enterprise customers expect from an AI platform.
This PR turns the deployment model from fire-and-forget into a continuous improvement loop:
We have had direct requests from customers for exactly this: "tell me what my agents can't do", "show me where the mesh is breaking", "give me a weekly report I can act on". This delivers all three with a single YAML file.
Backward Compatibility
sam run --config preset/agents/agent_insights.yamlSQLAlchemyandjson, both already inpyproject.tomlTest Plan
🤖 Generated with Claude Code