fix(agent): serialize crewai flow stages and remove nested asyncio.run

This commit is contained in:
qzl
2026-03-03 15:49:03 +08:00
parent 3a64410641
commit c76d4d415f
2 changed files with 63 additions and 0 deletions
@@ -0,0 +1,25 @@
from __future__ import annotations
import pytest
from v1.agent.crewai_flow import AgentFlow
class TestCrewAIFlow:
@pytest.mark.asyncio
async def test_flow_stages_run_in_order(self):
flow = AgentFlow()
await flow.run()
assert flow.state.stage_trace == ["intent", "execution", "reporting"]
@pytest.mark.asyncio
async def test_flow_state_initialized(self):
flow = AgentFlow()
assert flow.state.stage_trace == []
assert flow.state.current_stage is None
@pytest.mark.asyncio
async def test_flow_updates_current_stage(self):
flow = AgentFlow()
await flow.run()
assert flow.state.current_stage == "reporting"