signalwire-agents 1.0.11__py3-none-any.whl → 1.0.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ A package for building AI agents using SignalWire's AI and SWML capabilities.
18
18
  from .core.logging_config import configure_logging
19
19
  configure_logging()
20
20
 
21
- __version__ = "1.0.11"
21
+ __version__ = "1.0.13"
22
22
 
23
23
  # Import core classes for easier access
24
24
  from .core.agent_base import AgentBase
@@ -67,11 +67,15 @@ class AgentServer:
67
67
 
68
68
  # Keep track of registered agents
69
69
  self.agents: Dict[str, AgentBase] = {}
70
-
70
+
71
71
  # Keep track of SIP routing configuration
72
72
  self._sip_routing_enabled = False
73
73
  self._sip_route = None
74
74
  self._sip_username_mapping: Dict[str, str] = {} # Maps SIP usernames to routes
75
+
76
+ # Register health endpoints immediately so they're available
77
+ # whether using server.run() or server.app with gunicorn
78
+ self._register_health_endpoints()
75
79
 
76
80
  def register(self, agent: AgentBase, route: Optional[str] = None) -> None:
77
81
  """
@@ -519,13 +523,13 @@ class AgentServer:
519
523
  sys.stdout.flush()
520
524
 
521
525
  return response
522
-
523
- def _run_server(self, host: Optional[str] = None, port: Optional[int] = None) -> None:
524
- """Original server mode logic"""
525
- if not self.agents:
526
- self.logger.warning("Starting server with no registered agents")
527
-
528
- # Add a health check endpoint
526
+
527
+ def _register_health_endpoints(self) -> None:
528
+ """Register health and readiness endpoints.
529
+
530
+ Called during __init__ so endpoints are available whether using
531
+ server.run() or accessing server.app directly with gunicorn.
532
+ """
529
533
  @self.app.get("/health")
530
534
  def health_check():
531
535
  return {
@@ -533,7 +537,19 @@ class AgentServer:
533
537
  "agents": len(self.agents),
534
538
  "routes": list(self.agents.keys())
535
539
  }
536
-
540
+
541
+ @self.app.get("/ready")
542
+ def readiness_check():
543
+ return {
544
+ "status": "ready",
545
+ "agents": len(self.agents)
546
+ }
547
+
548
+ def _run_server(self, host: Optional[str] = None, port: Optional[int] = None) -> None:
549
+ """Original server mode logic"""
550
+ if not self.agents:
551
+ self.logger.warning("Starting server with no registered agents")
552
+
537
553
  # Add catch-all route handler to handle both trailing slash and non-trailing slash versions
538
554
  @self.app.get("/{full_path:path}")
539
555
  @self.app.post("/{full_path:path}")