fix: VAD agent requires reset
Otherwise, it won't start up correctly. ref: N25B-266
This commit is contained in:
@@ -117,17 +117,23 @@ async def lifespan(app: FastAPI):
|
||||
),
|
||||
}
|
||||
|
||||
vad_agent_instance = None
|
||||
|
||||
for name, (agent_class, kwargs) in agents_to_start.items():
|
||||
try:
|
||||
logger.debug("Starting agent: %s", name)
|
||||
agent_instance = agent_class(**{k: v for k, v in kwargs.items() if k != "name"})
|
||||
await agent_instance.start()
|
||||
if isinstance(agent_instance, VADAgent):
|
||||
vad_agent_instance = agent_instance
|
||||
logger.info("Agent '%s' started successfully.", name)
|
||||
except Exception as e:
|
||||
logger.error("Failed to start agent '%s': %s", name, e, exc_info=True)
|
||||
# Consider if the application should continue if an agent fails to start.
|
||||
raise
|
||||
|
||||
await vad_agent_instance.streaming_behaviour.reset()
|
||||
|
||||
logger.info("Application startup complete.")
|
||||
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user