Metadata-Version: 2.4
Name: aimarket-orchestrator
Version: 2.0.0
Summary: Orchestrator as a capability — sells the 'brain', not just muscles
Author-email: AI-Factory <dev@modelmarket.dev>
License-Expression: MIT
Project-URL: Homepage, https://github.com/alexar76/aimarket-plugins
Project-URL: Documentation, https://github.com/alexar76/aimarket-plugins/tree/main/plugins/aimarket-orchestrator#readme
Project-URL: Repository, https://github.com/alexar76/aimarket-plugins
Project-URL: Issues, https://github.com/alexar76/aimarket-plugins/issues
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aimarket-hub>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Dynamic: license-file

# aimarket-orchestrator

## Documentation

| Document | Description |
|----------|-------------|
| [User guide](docs/user-guide.md) | Install, configure, verify plugin is loaded |
| [User cases](docs/user-cases.md) | Personas and cross-plugin workflows |
| [SDK integration](docs/sdk-integration.md) | Code examples and hook behavior |

---

**The planner IS a capability. Priced at 1% of total spend.**
External agents send NL tasks. Orchestrator selects the capability chain, negotiates prices, executes, and returns a signed Bill of Materials. You sell the brain, not just the muscles.

## When to Use
- External agents with "empty head" — just send NL task, get result + BOM
- Complex multi-step workflows requiring capability chaining
- Consumer who doesn't know which capabilities exist — orchestrator plans for them
- Monetization: orchestrator earns 1% of every routed dollar in the ecosystem

## Installation
```bash
pip install aimarket-orchestrator
```

## Example
```python
from aimarket_orchestrator.orchestrator_capability import Orchestrator

orch = Orchestrator(orchestration_fee_pct=0.01)
caps = [
    {"capability_id": "translate.multi@v2", "product_id": "p1", "name": "translate",
     "price_per_call_usd": 0.40, "p50_latency_ms": 8100},
    {"capability_id": "legal.review@v1", "product_id": "p2", "name": "legal",
     "price_per_call_usd": 1.20, "p50_latency_ms": 11400},
]

plan = orch.plan("translate contract to French then legal review", budget_usd=3.0,
                 available_capabilities=caps)
print(f"Steps: {len(plan.steps)}, Est: ${plan.estimated_total_usd:.2f}")
print(f"Orchestration fee: ${plan.orchestration_fee_usd:.4f} (1%)")

def mock_invoke(pid, cid, inp):
    return {"success": True, "result": {"output": f"done {cid}"}, "price_usd": 0.40}

result = orch.execute_plan(plan, mock_invoke)
print(result["bill_of_materials"])
print(f"Tasks completed: {orch.stats()['tasks_completed']}")
print(f"Total fees earned: ${orch.stats()['total_fees_earned_usd']:.4f}")
```

## Pricing
Default 1% of total invocation spend. Configurable at init: `Orchestrator(orchestration_fee_pct=0.02)` for 2%.

## License
MIT · Maintained by AI-Factory
