Files
fengqun/examples/run_demo.py
T
gongzhiyong 111be3e435 Promote the minimal swarm prototype to the repository root
The standalone prototype should be the root-level project shape for fengqun while preserving the existing planning documents already at the root. This keeps README, examples, tests, and the Python package directly discoverable without deleting the prior docs.

Constraint: User clarified that swarm-minimal is the repository root, but other existing root files must remain.
Rejected: Deleting existing root docs | They are part of the fengqun repository context and were explicitly protected.
Confidence: high
Scope-risk: narrow
Directive: Keep secrets in ignored .env only; do not commit live credentials.
Tested: python3 -B -m unittest discover -s tests; git diff --check; secret-pattern scan showed only placeholders/test values/task-id false positives.
Not-tested: Remote web UI rendering after push.
2026-05-16 13:32:11 +08:00

31 lines
967 B
Python

from pathlib import Path
import sys
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
from swarm_minimal.azure_resources import azure_resource_plan
from swarm_minimal.core import InMemorySwarmStore, SwarmCoordinator, default_agents
def main() -> None:
store = InMemorySwarmStore()
coordinator = SwarmCoordinator(store=store, agents=default_agents())
run_id = coordinator.submit_goal("design a minimal Azure-backed agent swarm")
result = coordinator.run_until_converged(run_id)
print("run_id:", result.run_id)
print("accepted_output:", result.accepted_output)
print("accepted_score:", result.accepted_score)
print("completed_tasks:", result.completed_tasks)
print("azure_resources:")
for resource in azure_resource_plan():
required = "required" if resource.required else "optional"
print(f"- {resource.key}: {resource.service} ({required})")
if __name__ == "__main__":
main()