Create a mock AgentManager with the given agent configs.
(*agent_configs)
| 22 | |
| 23 | |
| 24 | def _make_agent_manager(*agent_configs): |
| 25 | """Create a mock AgentManager with the given agent configs.""" |
| 26 | mgr = MagicMock() |
| 27 | snapshots = {} |
| 28 | statuses = [] |
| 29 | |
| 30 | for cfg in agent_configs: |
| 31 | ctx = MagicMock() |
| 32 | ctx.agent_id = cfg.agent_id |
| 33 | ctx.session_id = f"session-{cfg.agent_id}" |
| 34 | ctx.conversation_history = [] |
| 35 | snapshots[cfg.agent_id] = {"config": cfg, "context": ctx} |
| 36 | statuses.append( |
| 37 | { |
| 38 | "agent_id": cfg.agent_id, |
| 39 | "name": cfg.name, |
| 40 | "role": cfg.role, |
| 41 | "status": "active", |
| 42 | } |
| 43 | ) |
| 44 | |
| 45 | mgr.list_agents.return_value = statuses |
| 46 | mgr.get_agent_snapshot.side_effect = lambda aid: snapshots.get(aid) |
| 47 | return mgr |
| 48 | |
| 49 | |
| 50 | # --------------------------------------------------------------------------- |
no test coverage detected