|
| 1 | +# Agent Contract |
| 2 | + |
| 3 | +This contract defines when an implementation agent is **RQM-compliant** while building against RQM Platform docs and APIs. |
| 4 | + |
| 5 | +## Contract summary |
| 6 | + |
| 7 | +An RQM-compliant agent must: |
| 8 | + |
| 9 | +- Start from documented agent entrypoints. |
| 10 | +- Select work from published manifests and recipes. |
| 11 | +- Confirm API route/schema details in Swagger UI when exact request/response shape is required. |
| 12 | +- Enforce validate-before-optimize behavior for circuit workflows. |
| 13 | +- Preserve reproducible artifacts and metadata. |
| 14 | +- Keep production behavior separate from research concepts. |
| 15 | + |
| 16 | +## Required agent behaviors |
| 17 | + |
| 18 | +1. Read `/llms.txt` first. |
| 19 | +2. Read `/capabilities.json` and `/agent-tasks.json` before selecting a workflow. |
| 20 | +3. Use [Agent Recipes](recipes/index.md) before inventing a custom flow. |
| 21 | +4. Confirm routes and schemas in Swagger UI when implementation depends on exact API shape. |
| 22 | +5. Validate circuit payloads before optimize/analyze flows. |
| 23 | +6. Preserve request/response artifacts. |
| 24 | +7. Preserve metadata where available. |
| 25 | +8. Label research-only concepts clearly. |
| 26 | +9. Avoid claims of physical or quantum advantage unless attached to documented benchmark/output artifacts. |
| 27 | + |
| 28 | +## Forbidden agent behaviors |
| 29 | + |
| 30 | +- Inventing undocumented endpoints. |
| 31 | +- Treating internal IR as a public API contract. |
| 32 | +- Presenting research concepts as production guarantees. |
| 33 | +- Dropping unknown fields silently. |
| 34 | +- Claiming performance improvement without reproducible evidence. |
| 35 | +- Treating RQM Studio as canonical computation layer. |
| 36 | + |
| 37 | +## Required artifacts |
| 38 | + |
| 39 | +For integration and review, preserve at minimum: |
| 40 | + |
| 41 | +- Request payload JSON. |
| 42 | +- Response envelope JSON. |
| 43 | +- Validation outcomes and error reports. |
| 44 | +- Optimization comparison/diff or metrics artifacts when optimization is used. |
| 45 | +- Metadata (request IDs, timestamps, correlation IDs) when available. |
| 46 | + |
| 47 | +## Production vs research handling |
| 48 | + |
| 49 | +- **Production/documented:** implement directly from API docs, boundary docs, and Swagger-confirmed routes. |
| 50 | +- **Research/conceptual:** mark clearly as research-only and keep out of production guarantees. |
| 51 | +- **Planned/proposed:** do not treat as currently available behavior. |
| 52 | + |
| 53 | +## Validate-before-optimize requirement |
| 54 | + |
| 55 | +For circuit flows, validation is mandatory before analyze/optimize. |
| 56 | + |
| 57 | +If validation fails: |
| 58 | + |
| 59 | +1. Stop downstream optimize/execution steps. |
| 60 | +2. Persist failure artifacts. |
| 61 | +3. Repair payload against documented public boundary. |
| 62 | +4. Re-run validation before continuing. |
| 63 | + |
| 64 | +## Swagger/API confirmation requirement |
| 65 | + |
| 66 | +When coding concrete request/response models, confirm exact route/schema details in Swagger UI. |
| 67 | + |
| 68 | +- Use docs as workflow and boundary guidance. |
| 69 | +- Use Swagger UI as route/schema confirmation surface. |
| 70 | +- Do not infer missing fields or undocumented variants. |
| 71 | + |
| 72 | +## Public circuit boundary requirement |
| 73 | + |
| 74 | +Use public `rqm-circuits` boundary semantics for external payloads. |
| 75 | + |
| 76 | +- Do not expose internal optimizer IR as public contract. |
| 77 | +- Do not treat internal transformations as user-facing schema guarantees. |
| 78 | + |
| 79 | +## RQM Studio workflow-layer boundary |
| 80 | + |
| 81 | +RQM Studio is an orchestration/workflow layer above `rqm-api`. |
| 82 | + |
| 83 | +- Studio coordinates states and user experience. |
| 84 | +- API endpoints remain canonical service boundary. |
| 85 | +- Studio is not canonical computation layer. |
| 86 | + |
| 87 | +## Trust/verification requirement |
| 88 | + |
| 89 | +Optimization outcomes are trust-sensitive. |
| 90 | + |
| 91 | +- Preserve evidence artifacts. |
| 92 | +- Use conservative wording such as “optimization candidate” unless verified by documented outputs. |
| 93 | +- Avoid advantage claims without reproducible benchmark/output artifacts. |
| 94 | + |
| 95 | +## Example good agent behavior |
| 96 | + |
| 97 | +- Reads `/llms.txt`, `/capabilities.json`, and `/agent-tasks.json`. |
| 98 | +- Selects Validate → Optimize recipe before custom design. |
| 99 | +- Confirms exact optimize route/schema in Swagger UI before coding. |
| 100 | +- Saves validate/optimize request+response artifacts with metadata. |
| 101 | +- Labels research notes as research-only. |
| 102 | + |
| 103 | +## Example bad agent behavior |
| 104 | + |
| 105 | +- Implements an undocumented route. |
| 106 | +- Runs optimize before validation. |
| 107 | +- Treats internal IR as public payload schema. |
| 108 | +- Claims guaranteed advantage without evidence artifacts. |
| 109 | +- Presents research concepts as production guarantees. |
0 commit comments