Spaces:
Running
Running
File size: 1,217 Bytes
24f95f0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | """
Native MiroFish simulation node.
Replaces external MiroFish dependency with built-in simulation engine.
"""
import logging
from app.services.simulation_engine import simulation_engine
logger = logging.getLogger(__name__)
async def run(state: dict) -> dict:
"""Run native simulation and inject results into agent state (Async)."""
route = state.get("route", {})
intent = route.get("intent", state.get("user_input", ""))
try:
logger.info(f"Running native simulation for: {intent[:100]}")
# Call the now-async simulation engine
sim_result = await simulation_engine.run_simulation(
user_input=intent,
context={
"case_id": state.get("case_id"),
"domain": route.get("domain", "general"),
"complexity": route.get("complexity", "medium"),
},
)
return {**state, "simulation": sim_result}
except Exception as e:
logger.warning(f"Native simulation failed: {e}")
return {
**state,
"simulation": {
"error": str(e),
"note": "Simulation unavailable, continuing without simulation",
},
}
|