-
Notifications
You must be signed in to change notification settings - Fork 319
Dynamic mcp handling #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Dynamic mcp handling #291
Conversation
don't register the same agent multiple times
Also disabled human input callback
Disable human input when nont in interactive mode
and undo the input suppression in server mode
Added Visible INFO Logging for Agent Deactivation Fixed Animated Dots for DEACTIVATED Status Hide MCP Server Entries from Progress Display Fixed Background Polling for Agent Reactivation
fix indentation issues
fix import - i think this is why the Agent is not being reactivated once the mcp server comes back online
dynamic handling is now working, and the progress display is nice
Adds comprehensive MCP server polling and dynamic agent management - Change mcp_polling_interval default from 60s to None (no polling by default) - Add proactive monitoring of ALL MCP servers during polling cycles - Implement simple agent status management: * Deactivate agents when their servers go offline during runtime * Reactivate agents when their servers come back online - Use direct server connectivity testing via temporary connections - Add 3-retry logic with exponential backoff for tool calls - Update progress display: * Show the MCP Server Polling in the progress display * Show "Deactivated" status when polling is disabled * Show "Running" during active server health checks * Show "Ready" between cycles with server status details - Give users full control over polling frequency vs performance trade-offs - they can set an interval that works best for their situation This provides comprehensive server monitoring with automatic agent lifecycle management while maintaining zero performance impact by default.
Restore the cli handling that was accidentally deleted
Use mcp_polling_ferquency as a switch to also enable/disable automatic disabling of agents at startup when the mcp servers it need are not available. This preserves the existing behavior, since mcp_polling_frequency defaults to None The failing test should now pass
This should fix the broken tests
Hi @jdecker76 this looks good at first pass, and I think intersects with some improvements I think are necessary for any Production level client dealing with Streamable HTTP. Below is my list of connection "things" that I wanted to get covered somehow:
Some of this is driven from: https://huggingface.co/blog/building-hf-mcp Q - What does it mean for an agent to be "Deactivated". It can't meaningfully participate in workflows, so without a queueing/resume system (perhaps A2A participation) I'm not sure what the desired behaviour is? |
Sorry for the late reply, just got back from vacation To answer your question above, in the context of this PR - a "Deactivated" agent is not available for use, but is registered with fast-agent. Once all MCP servers are available, it becomes active and available for use. I just added PR 342 for SSE reconnection as an alternative that is less invasive, but still not perfect (I.e. fast-agent still aborts at startup if an MCP server is not available, though it does allow SSE MCP server reconnect once it's up and running) I'm open to suggestions for a more thorough solution, but I need something in place for my deployments. For example, without this PR (or PR 342), if I redeploy my MCP servers then I absolutely must restart my agents. This sounds trivial, but this involves some down time, plus there is the fact that my deployments are serverless on AWS ECS/Fargate - which adds quite a bit of complexity to the situation. WIth one of these PRs, I can publish my MCP server changes and my agents reconnect gracefully. I think this is very important for production systems, whether it's one of these solutions or another solution that fits the project better. When you get a chance, lets discuss this so I can better understand your vision in this area - I'm eager to use fast-agent in production (not a large project by any means, but with ~800 active users it could be a support nightmare for our small team if we don't solve these types of issues) |
Agree this is an important feature; quick question - is there a way to flag this on/off? iirc the progress display always showed the new watchdog is that right? and would you be able to help with the reqs/implementation on the mcp handling on the 0.3.0 branch? i think we should have good options there too. |
refs #289
Adds comprehensive MCP server polling and dynamic agent management
mcp_polling_interval
, which defaults to None (I.e. polling disabled by default)This provides comprehensive MCP server monitoring with automatic agent lifecycle
management while maintaining zero performance impact by default.
If this is considered for inclusion in Fast Agent, I will update the docs repo