Skip to content

Agent Zero AI framework

feat(tunnel): implement tunnel provider switching

linuztx2f9266fa5b2b
diff --git a/python/helpers/tunnel_manager.py b/python/helpers/tunnel_manager.py
index d58979a5c..4e72cd495 100644
--- a/python/helpers/tunnel_manager.py
+++ b/python/helpers/tunnel_manager.py
@@ -18,30 +18,26 @@ class TunnelManager:
self.tunnel = None
self.tunnel_url = None
self.is_running = False
+ self.provider = None
- def start_tunnel(self, port=80):
+ def start_tunnel(self, port=80, provider="serveo"):
"""Start a new tunnel or return the existing one's URL"""
if self.is_running and self.tunnel_url:
return self.tunnel_url
-
- # switched to serveo to support SSE MCP server
-
- # Create and start a new tunnel
- # config = FlareConfig(
- # port=port,
- # verbose=True,
- # timeout=60, # Increase timeout from default 30 to 60 seconds
- # )
-
- config = ServeoConfig(port=port) # type: ignore
+ self.provider = provider
try:
# Start tunnel in a separate thread to avoid blocking
def run_tunnel():
try:
- # self.tunnel = FlareTunnel(config)
- self.tunnel = ServeoTunnel(config)
+ if self.provider == "cloudflared":
+ config = FlareConfig(port=port, verbose=True)
+ self.tunnel = FlareTunnel(config)
+ else: # Default to serveo
+ config = ServeoConfig(port=port)
+ self.tunnel = ServeoTunnel(config)
+
self.tunnel.start()
self.tunnel_url = self.tunnel.tunnel_url
self.is_running = True
@@ -72,6 +68,7 @@ class TunnelManager:
self.tunnel.stop()
self.is_running = False
self.tunnel_url = None
+ self.provider = None
return True
except Exception:
return False