richfrem/agent-plugins-skills / plugins/agent-orchestration/.apm/skills/orchestrating-agent-work
orchestrating-agent-work
VerifiedInteractive orchestrator for complex engineering work. Analyzes the task, conducts a diagnostic interview to select the appropriate execution strategy (Directed Acyclic Graph versus Loop, and which Loop type), plans the artifact, and supervises execution and verification. Use for "how should I orchestrate this", "plan this workflow", "should this be a DAG or a loop", "run these jobs in parallel", "delegate this to a worker agent", or "run/resume this graph manifest". Not for single trivial edits or skill self-improvement.
tests/test_swarm_run_models.py
View on GitHub#!/usr/bin/env python3
"""
Purpose:
Unit tests for swarm_run.py model loading and configuration functions.
Verifies correct model resolution from cheapest_models.json with fallbacks.
Key Input Dependencies:
- swarm_run.py module (_load_cheapest_model function)
- Temporary JSON files for test fixtures
Key Functions:
- _write_json(): Write test JSON fixture to temporary file
Tests cover:
- _load_cheapest_model: JSON load, fallback, malformed JSON, missing engine key
"""
import json
import os
import sys
import tempfile
import unittest
from pathlib import Path
sys.path.insert(0, os.path.dirname(__file__))
from swarm_run import _load_cheapest_model
class TestLoadCheapestModel(unittest.TestCase):
def _write_json(self, data: dict) -> Path:
"""Write test data to temporary JSON file and return path."""
f = tempfile.NamedTemporaryFile(
mode="w", suffix=".json", delete=False
)
json.dump(data, f)
f.close()
return Path(f.name)
def test_returns_fallback_when_json_absent(self):
"""Verify fallback model returned when cheapest_models.json does not exist."""
absent = Path(tempfile.mkdtemp()) / "does_not_exist.json"
result = _load_cheapest_model("copilot", "gpt-5-mini", ref_path=absent)
self.assertEqual(result, "gpt-5-mini")
def test_loads_model_for_requested_engine(self):
"""Verify model correctly loaded for the requested engine from JSON."""
ref = self._write_json({"copilot": {"model": "gpt-5-nano"}})
try:
result = _load_cheapest_model("copilot", "gpt-5-mini", ref_path=ref)
self.assertEqual(result, "gpt-5-nano")
finally:
ref.unlink()
def test_returns_fallback_when_engine_not_in_json(self):
"""Verify fallback returned when the requested engine key is absent from JSON."""
ref = self._write_json({"copilot": {"model": "gpt-5-mini"}})
try:
result = _load_cheapest_model("gemini", "gemini-fallback", ref_path=ref)
self.assertEqual(result, "gemini-fallback")
finally:
ref.unlink()
def test_returns_fallback_on_malformed_json(self):
"""Verify fallback returned when cheapest_models.json contains malformed JSON."""
f = tempfile.NamedTemporaryFile(
mode="w", suffix=".json", delete=False
)
f.write("not valid json{{{")
f.close()
ref = Path(f.name)
try:
result = _load_cheapest_model("copilot", "gpt-5-mini", ref_path=ref)
self.assertEqual(result, "gpt-5-mini")
finally:
ref.unlink()
def test_returns_fallback_when_model_key_absent(self):
"""Verify fallback returned when the engine entry has no 'model' key."""
ref = self._write_json({"copilot": {"description": "no model key"}})
try:
result = _load_cheapest_model("copilot", "gpt-5-mini", ref_path=ref)
self.assertEqual(result, "gpt-5-mini")
finally:
ref.unlink()
if __name__ == "__main__":
unittest.main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |