Files
fengqun/examples/run_three_newapi_agnets.py
T
gongzhiyongandOmX 10a980b0bf Establish agent swarm quality evidence
Define Agent and swarm-specific acceptance evidence, move the reports under docs, and make the homepage point to the current standard, live run, model I/O, and handoff evidence.

Constraint: Agent quality standards are configured from industry AI and agent risk references because there is no single accepted swarm-Agent certification standard.

Rejected: Treating py_compile or unittest as the primary quality standard | they are evidence collection tools, not the Agent quality standard itself.

Confidence: high

Scope-risk: moderate

Directive: Keep future standard reports under docs/ and keep secrets in ignored local .env files only.

Tested: git diff --cached --check; python -B -m py_compile swarm_minimal/*.py examples/*.py tests/*.py; python -B -m unittest discover -s tests; python -u -B examples/run_academic_standard_evaluation.py

Not-tested: Did not rerun the full live Azure/NewAPI S07 scenario after moving docs; previous live run 3e8e58ae4e084bc8b90cf5c46f8992f3 passed before the docs relocation.

Co-authored-by: OmX <omx@oh-my-codex.dev>
2026-05-16 14:36:47 +08:00

56 lines
1.7 KiB
Python

from pathlib import Path
import json
import sys
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
from swarm_minimal.core import InMemorySwarmStore, SwarmCoordinator, Task
from swarm_minimal.local_env import load_project_env
from swarm_minimal.newapi_agnet import (
NewApiChannelConfig,
build_model_test_agnets,
discover_newapi_models,
select_distinct_models,
)
def main() -> None:
load_project_env(ROOT)
config = NewApiChannelConfig.from_env()
print(json.dumps(config.redacted_summary(), ensure_ascii=False, indent=2))
discovered_models = discover_newapi_models(config)
selected_models = select_distinct_models(discovered_models, count=3)
print("selected_models:")
for model in selected_models:
print(f"- {model}")
store = InMemorySwarmStore()
agents = build_model_test_agnets(config, models=selected_models)
coordinator = SwarmCoordinator(store=store, agents=agents)
goal = "test three NewAPI-backed Agnets with different models"
run_id = coordinator.submit_goal(goal)
# The default goal creates plan/build/verify tasks. For this model test we
# add one task per model-specific capability so all three Agnets must run.
for index, model in enumerate(selected_models):
store.add_task(
Task(
kind=f"model_test_{index + 1}",
input=f"{goal}; model={model}",
)
)
result = coordinator.run_until_converged(run_id)
print("run_id:", result.run_id)
print("accepted_score:", result.accepted_score)
print("completed_tasks:", result.completed_tasks)
print("accepted_output:", result.accepted_output)
if __name__ == "__main__":
main()