Metadata-Version: 2.4
Name: agent-generator
Version: 0.2.0
Summary: Turn plain-English requirements into production-ready multi-agent AI projects (CrewAI, LangGraph, WatsonX Orchestrate).
Project-URL: Homepage, https://github.com/ruslanmv/agent-generator
Project-URL: Repository, https://github.com/ruslanmv/agent-generator
Project-URL: Issues, https://github.com/ruslanmv/agent-generator/issues
Author-email: "Ruslan M. V." <contact@ruslanmv.com>
License:                                  Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to the Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by the Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding any notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           Copyright 2024 Ruslan Magana Vsevolodovna
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
License-File: LICENSE
Keywords: LLM,code-generation,crewai,langgraph,multi-agent,orchestrate,watsonx
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.10
Requires-Dist: jinja2<4,>=3.1
Requires-Dist: packaging>=23
Requires-Dist: pydantic-settings<3,>=2.13
Requires-Dist: pydantic<3,>=2.12
Requires-Dist: python-dotenv>=1.0
Requires-Dist: pyyaml<7,>=6.0
Requires-Dist: requests<3,>=2.33
Requires-Dist: rich<15,>=14.0
Requires-Dist: structlog<26,>=25.0
Requires-Dist: typer<1,>=0.24
Provides-Extra: all
Requires-Dist: crewai<2,>=1.12; extra == 'all'
Requires-Dist: fastapi<1,>=0.135; extra == 'all'
Requires-Dist: langchain-core>=0.1; extra == 'all'
Requires-Dist: langgraph<2,>=1.1; extra == 'all'
Requires-Dist: openai<3,>=2.30; extra == 'all'
Requires-Dist: python-multipart>=0.0.18; extra == 'all'
Requires-Dist: requests<3,>=2.33; extra == 'all'
Requires-Dist: tiktoken<1,>=0.12; extra == 'all'
Requires-Dist: uvicorn<1,>=0.42; extra == 'all'
Provides-Extra: crewai
Requires-Dist: crewai<2,>=1.12; extra == 'crewai'
Provides-Extra: dev
Requires-Dist: black>=24.4; extra == 'dev'
Requires-Dist: isort>=5.0; extra == 'dev'
Requires-Dist: mkdocs-material>=9.5; extra == 'dev'
Requires-Dist: mkdocs>=1.6; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pre-commit>=3.7; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest-xdist>=3.5; extra == 'dev'
Requires-Dist: pytest>=8.2; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Provides-Extra: langgraph
Requires-Dist: langchain-core>=0.1; extra == 'langgraph'
Requires-Dist: langgraph<2,>=1.1; extra == 'langgraph'
Provides-Extra: openai
Requires-Dist: openai<3,>=2.30; extra == 'openai'
Requires-Dist: tiktoken<1,>=0.12; extra == 'openai'
Provides-Extra: release
Requires-Dist: build>=1.2; extra == 'release'
Requires-Dist: twine>=5.0; extra == 'release'
Provides-Extra: web
Requires-Dist: fastapi<1,>=0.135; extra == 'web'
Requires-Dist: python-multipart>=0.0.18; extra == 'web'
Requires-Dist: requests<3,>=2.33; extra == 'web'
Requires-Dist: uvicorn<1,>=0.42; extra == 'web'
Description-Content-Type: text/markdown

<p align="left">
  <img src="https://github.com/ruslanmv/agent-generator/blob/master/docs/images/logo.png" alt="agent-generator logo" width="280">
</p>

# agent-generator

**Describe an AI system in one sentence — get a controlled, validated, production-ready project.**

A deterministic generation engine with two jobs: scaffold runnable **multi-agent projects**
(CrewAI · LangGraph · WatsonX Orchestrate · CrewAI Flow · ReAct), and power **Matrix Builder** —
*give AI coders a contract, not a prompt.*

[![PyPI](https://img.shields.io/pypi/v/agent-generator.svg)](https://pypi.org/project/agent-generator/)
[![Python](https://img.shields.io/pypi/pyversions/agent-generator.svg)](https://pypi.org/project/agent-generator/)
[![CI](https://github.com/ruslanmv/agent-generator/actions/workflows/ci.yml/badge.svg)](https://github.com/ruslanmv/agent-generator/actions/workflows/ci.yml)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
[![Standards: signed](https://img.shields.io/badge/standards-signed-22c878)](https://github.com/agent-matrix/matrix-definitions)
[![Demo](https://img.shields.io/badge/demo-Hugging%20Face-yellow)](https://huggingface.co/spaces/ruslanmv/agent-generator)
[![Powered by matrix-hub](https://img.shields.io/badge/powered%20by-matrix--hub-brightgreen)](https://github.com/agent-matrix/matrix-hub)

---

## Why agent-generator

One package, two engines that share a deterministic core (one LLM call to plan, everything else
template-rendered, so the same input yields byte-identical output):

| | What it does | Entry point |
|---|---|---|
| **Project generator** | Turn a sentence into a runnable multi-agent project for your framework of choice. | `agent-generator "<idea>" -f crewai` |
| **Matrix Builder engine** | Turn an idea into a *controlled bundle* (blueprint + locked standards + tasks + per-coder prompts), then **validate** what an AI coder produced against that contract. | `AgentGenerator` SDK · `mb` CLI · HTTP API |

The Matrix engine is the deterministic core behind **[Matrix Builder](https://build.matrixhub.io)**.
It enforces the signed **[Ruslan Magana Definitions](docs/matrix-engine/ruslan-magana-definitions.md)**,
works with **Claude Code, Codex, Cursor, GitPilot, IBM Bob** (and any AI coder), and publishes
validated, signed bundles to **MatrixHub**.

---

## How it works

**1 · Generate a multi-agent project** — one LLM call plans; everything else is deterministic
template rendering, so the same sentence yields byte-identical, safety-scanned code.

<p align="center"><img src="docs/images/how-it-works-generation.svg" alt="agent-generator pipeline: idea → planner (1 LLM call) → validated ProjectSpec → deterministic templates → safety scan → runnable project" width="100%"></p>

**2 · Control an AI coder with `mb`** — AI coders are powerful but *out of control*: left to a raw
prompt they edit any file, invent their own architecture, drift between runs, and produce output you
can't verify. **That is why Matrix Builder exists.** `mb` gives the AI coder a *contract* — a locked
blueprint, scoped batches, allowed-file boundaries, and fail-closed validation — and records every
accepted change as an **immutable, versioned Matrix Commit**. Batches stack into a complete project,
end to end, fully under contract.

<p align="center"><img src="docs/images/how-it-works-matrix.svg" alt="Matrix Builder mb loop: out-of-control prompt vs contract; blueprint → batch → prompt → AI coder → validate → Matrix Commit, with rejected→repair feedback and a versioned batch timeline" width="100%"></p>

---

## Install

```bash
pip install agent-generator            # the CLI + the engine + the mb CLI
pip install "agent-generator[openai]"  # + OpenAI provider
pip install "agent-generator[all]"     # + all providers and frameworks
```

Python 3.10+. No credentials or network are needed for controlled generation and validation —
the engine is deterministic.

---

## Quick start

### A · Generate a multi-agent project

```bash
# pick a provider (WatsonX is the default; OpenAI shown here)
export OPENAI_API_KEY=sk-...; export AGENTGEN_PROVIDER=openai

agent-generator "Research team that finds papers and writes summaries" -f crewai -o team/
cd team && crewai run

# no credentials? generate deterministically with --dry-run
agent-generator "Hello world agent" -f crewai --dry-run
```

### B · Control an AI coder (the Matrix engine)

```python
from agent_generator import AgentGenerator
from agent_generator.contracts import IdeaRequest

engine = AgentGenerator()                                   # deterministic, no credentials
idea   = IdeaRequest(idea="An AI app that analyzes GitHub repositories")

candidates = engine.generate_blueprint_candidates(idea)     # 3 quality-tiered options
blueprint  = engine.generate_controlled_blueprint(idea)     # the locked contract
engine.export_zip(blueprint, "dist/app.zip", release_evidence=True)   # signed bundle

# after your AI coder runs, validate its output against the contract:
report = engine.validate_ai_coder_patch("b1", repo_path="dist/out", blueprint=blueprint)
print(report.status)         # approved | needs-repair | rejected
print(report.repair_prompt)  # bounded fix instructions when not approved
```

Or from the CLI / HTTP:

```bash
agent-generator matrix candidates --idea "An AI app that analyzes GitHub repositories"
agent-generator matrix export     --idea "..." --out dist/app.zip --release-evidence
agent-generator matrix validate   --idea "..." --repo dist/app        # exit 0/1/2

uvicorn agent_generator.http.app:app   # OpenAPI at /openapi.json, routes under /api/v1
```

---

## The `mb` CLI — local-first

`mb` is the **local-first Matrix Builder**: the full *git-for-AI* loop on your machine — offline,
deterministic, zero infrastructure. State lives in a `.mb/` folder that mirrors the server model.

```bash
mb init "A GitHub repo intelligence agent" --quality standard   # idea → controlled blueprint
mb next "Add repo ingestion"                                    # plan a scoped batch
mb prompt --coder claude-code                                   # contract-bound prompt (+ CLAUDE.md)
mb check backend/app/...                                        # validate → an immutable Matrix Commit
mb timeline                                                     # the build history
mb repair                                                       # scoped fix prompt from the last failure
mb login && mb sync                                             # push/pull to the cloud (optional)
mb mcp                                                          # expose the build loop as MCP tools
```

`mb check` is **fail-closed** (exit `0` approved · `1` needs-repair · `2` rejected). A passing check
creates an immutable **Matrix Commit** carrying the prompt snapshot, standards lock, file manifest,
diff, and validation result. Full guide: **[docs/matrix-engine/mb-cli.md](docs/matrix-engine/mb-cli.md)**.

---

## Why it is safe to ship

| Concern | How it is handled |
|---|---|
| **Hallucinated code** | Output is rendered from a validated `ProjectSpec` / locked blueprint, not from raw LLM text. |
| **Drift between runs** | One LLM call to plan; the rest is deterministic — same input → byte-identical output. |
| **Unsafe patterns** | AST scanner blocks `eval`, `exec`, `os.system`, and bare `subprocess`. |
| **Uncontrolled AI edits** | The contract pins allowed files; forbidden edits are **rejected** (RMD), with a bounded repair prompt. |
| **Standards drift** | Rules load from the signed `matrix-definitions` pack and are pinned in `MATRIX_STANDARDS.lock`. |
| **Provenance** | Release bundles ship checksums, a CycloneDX SBOM, and a cosign/attestation bundle. |
| **Secrets** | Only `.env.example` is generated; real secrets live in the platform vault. |

---

## Frameworks & built-in tools

| Framework | What you get |
|---|---|
| **CrewAI** | `crew.py` + `agents.yaml` + `tasks.yaml` + tools + tests |
| **LangGraph** | `graph.py` with a typed `StateGraph` |
| **WatsonX Orchestrate** | `agent.yaml` ready for `orchestrate agents import` |
| **CrewAI Flow** | Flow class with `@start` / `@listen` |
| **ReAct** | Reasoning loop with a tool registry |

Built-in tools available to generated agents: `web_search`, `pdf_reader`, `http_client`,
`sql_query`, `file_writer`, `vector_search`. Runs on **WatsonX** by default, **OpenAI** with one
flag, or local models via **Ollama / OllaBridge**.

Key CLI flags: `-f <framework>` · `-o <path>` · `--dry-run` (no LLM) · `-p openai` ·
`--show-cost` · `--mcp`.

---

## The platform (web · desktop · mobile)

The same engine ships as a full product — a FastAPI backend, a Vite SPA, Tauri desktop installers,
and a Capacitor Android app, from one TypeScript codebase.

```bash
make install      # CLI + backend (FastAPI) + frontend (Vite SPA)
make start        # backend :8000 + SPA :5173  (Ctrl-C stops both)
make build        # SPA bundle + backend Docker image + desktop installer for this host
```

Open <http://localhost:5173>. Signed CI builds (Authenticode, Apple notarization, GPG, Play Store)
live in `.github/workflows/`; the Kubernetes deployment is in [`deploy/helm/`](deploy/helm). A quick
visual wizard is also available standalone: `uvicorn agent_generator.wsgi:app --port 8000`.

---

## Architecture & ecosystem

```
matrix-builder      orchestration + UX (the public product)
agent-generator     generation + validation        ← this repo (the engine)
matrix-definitions  signed rules / standards (RMD)
MatrixHub           registry for trusted artifacts
```

- **Engine API** is versioned (`ENGINE_API_VERSION`) and contracts are versioned
  (`CONTRACTS_VERSION`); the SDK method surface is guarded by parity tests.
- Package **`0.2.0`** satisfies the `matrix-definitions` compatibility gate
  (`compatibility.agent_generator >= 0.2.0`) — it can load and verify a signed standards pack.

See [docs/matrix-engine/compatibility-matrix.md](docs/matrix-engine/compatibility-matrix.md).

---

## Security & supply chain

- **Determinism** — generation/validation need no network or credentials; identical input → identical output.
- **Signed standards** — rules come from the signed `matrix-definitions` pack, checksum-verified at load.
- **Release evidence** — `--release-evidence` bundles ship `checksums.txt`, a CycloneDX **SBOM**, and a **cosign** bundle.
- **Pinned CI** — GitHub Actions pinned to SHAs, least-privilege tokens, CODEOWNERS on workflows/release.

Verify a bundle:

```bash
cd dist/out && sha256sum -c artifacts/checksums.txt
```

---

## Documentation

Full docs (MkDocs) live in [`docs/`](docs). Highlights:

- **Get started** — [Install](docs/installation.md) · [Usage](docs/usage.md) · [Pick a framework](docs/frameworks.md)
- **Matrix engine** — [Quickstart](docs/matrix-engine/quickstart.md) · [`mb` CLI](docs/matrix-engine/mb-cli.md) · [Public engine API](docs/matrix-engine/public-engine-api.md) · [HTTP API](docs/matrix-engine/http-api.md) · [Validation & repair](docs/matrix-engine/validation-and-repair.md) · [Ruslan Magana Definitions](docs/matrix-engine/ruslan-magana-definitions.md)
- **Operations** — [Platform](docs/platform.md) · [Production readiness](docs/production-readiness.md) · [Release process](docs/release-process.md)

Build the docs site locally: `mkdocs serve`.

---

## Contributing

```bash
git clone https://github.com/ruslanmv/agent-generator.git && cd agent-generator
make install      # CLI + backend + frontend
make test         # CLI pytest + backend pytest + frontend type-check & build
make lint         # ruff + black + isort
```

| Target | What it does |
|---|---|
| `make install` | Editable CLI install + backend + SPA |
| `make test` | CLI pytest + backend pytest + frontend `tsc` + Vite build |
| `make lint` | ruff + black `--check` + isort `--check` |
| `make start` / `make stop` | Run / stop the dev servers |
| `make build` / `make build-android` | Host installer / Android APK |
| `make help` | Full list of targets |

Issues and pull requests are welcome. Please run `make lint` and `make test` before opening a PR.

---

## License & author

Licensed under **Apache 2.0** — see [LICENSE](LICENSE).

Created and maintained by **[Ruslan Magana Vsevolodovna](https://ruslanmv.com)**, author of the
**Ruslan Magana Definitions** — the signed standard that keeps AI-built software under contract.
