Restore active sessions on startup
This commit is contained in:
17
app/main.py
17
app/main.py
@@ -51,6 +51,7 @@ async def startup_event():
|
||||
orchestrator = AgentOrchestrator(
|
||||
loop_interval_seconds=settings.AGENT_LOOP_INTERVAL_SECONDS
|
||||
)
|
||||
await orchestrator.restore_active_sessions()
|
||||
agent_loop_task = asyncio.create_task(agent_loop())
|
||||
logger.info("Application started successfully")
|
||||
except Exception as e:
|
||||
@@ -143,6 +144,22 @@ async def get_ledger(session_id: str) -> dict:
|
||||
}
|
||||
|
||||
|
||||
@app.get("/admin/session/status")
|
||||
async def get_session_status(session_id: str) -> dict:
|
||||
"""Get status for an active stream session."""
|
||||
if not orchestrator:
|
||||
raise HTTPException(status_code=503, detail="Orchestrator not initialized")
|
||||
|
||||
status = await orchestrator.get_session_status(session_id)
|
||||
if not status:
|
||||
raise HTTPException(status_code=404, detail="Active session not found")
|
||||
|
||||
return {
|
||||
**status,
|
||||
"timestamp": datetime.utcnow().isoformat(),
|
||||
}
|
||||
|
||||
|
||||
@app.get("/admin/loop/status")
|
||||
async def get_loop_status() -> dict:
|
||||
"""Get the background agent loop runtime configuration."""
|
||||
|
||||
Reference in New Issue
Block a user