> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Orq.ai is the control plane for model and MCP traffic: one key reaches the workspace's enabled models, MCP servers, and resources. The setup depends on where the agent runs.
> Hosted assistant (ChatGPT, claude.ai, a hosted sandbox): install nothing. Tell the human to add https://my.orq.ai/v2/mcp as a remote MCP connector and finish the Orq.ai sign-in. With OAuth, send no Authorization header; otherwise send an API key as a bearer token.
> Local coding agent (Claude Code, Codex, Cursor, OpenCode): run `curl -fsSL https://cli.orq.ai/install.sh | sh`. It installs the CLI and runs `orq setup`, which signs in, writes a project-scoped key to `~/.orq/env`, and wires the detected agents through the AI Gateway. It can also add the Orq MCP server and Orq Skills, the workflows for agents, evaluations, and traces: https://docs.orq.ai/ai-studio/integrations/code-assistants/orq-skills.md. Cursor receives the Orq MCP server and Orq Skills only; its model calls are not routed through the AI Gateway. Verify with `orq status`.
> Headless or CI: read `ORQ_API_KEY` from the environment; a human creates the key at https://docs.orq.ai/ai-studio/organization/api-keys.md.
> Send model traffic to https://my.orq.ai/v3/router with `Authorization: Bearer $ORQ_API_KEY`; the Anthropic SDK uses https://my.orq.ai/v3/anthropic. New integrations go on `/v3/router`: `/v2/router` stays published for backward compatibility, and `orq.prompt` works only on `/v2/router/chat/completions`.
> To enable a model for the workspace, ask a human to enable it in the Model Garden, or call `POST /v2/workspace-models` with a Management Key that has `workspace-model` write; API keys are rejected with `403`. Use the model's exact `provider/model` id. A call fails while the workspace has neither credits nor a provider key.
> On `/chat/completions`, a reasoning model rejects `tools` with a `reasoning_effort` other than `none`; `/responses` keeps reasoning.
> On a failure, branch on `error.code` and follow `error.doc_url`; a budget rejection answers 429.

# Loop templates

> Start a Loop from a template for CI fixes, dependency updates, changelogs, pull request cleanup and security scans.

Beta

> [!NOTE]
>
> **Factory** is in private preview and is enabled per workspace by the **Orq.ai** team.

A template is a prefilled [Loop](https://docs.orq.ai/factory/loops.md). It sets the triggers, the Loop instructions and the system instructions, and leaves the workspace-specific choices to fill in. The gallery opens when **Loop** is clicked on the **Loops** page.

## Use a template

1. Pick the template in the gallery.
2. Select the repository. A template that reacts to a GitHub event works on the repository the event names.
3. Add Skills and MCP servers if the job needs them. Templates leave both empty.
4. Adjust the schedule or the conditions, then click **Create**.

A template whose trigger needs an [integration](https://docs.orq.ai/factory/integrations.md) that is not connected asks to connect it first.

## React to events

These templates run when something happens.

| Template | Trigger | What each run does |
| - | - | - |
| **Fix CI failures** | GitHub check run | Reads the build logs of failing checks, finds the cause and pushes a fix. |
| **/factory issue fix** | GitHub issue comment | Opens a fix pull request when a collaborator comments `/factory` on an issue. |
| **Fix error reports daily** | Webhook | Picks the top unresolved errors from incoming reports and opens a fix pull request for each. |

## Keep the codebase healthy

These templates run on a schedule.

| Template | Schedule | What each run does |
| - | - | - |
| **Weekly dependency update** | Weekly, Monday | Scans outdated packages, reads changelogs and opens update pull requests. |
| **Weekly changelog** | Weekly, Friday | Turns merged pull requests into a categorized changelog and opens a pull request. |
| **Stale PR cleanup** | Weekly | Finds pull requests untouched for a week, checks conflicts and posts a summary. |
| **Code pattern enforcer** | Weekly | Compares the code against a reference repository and flags deviations. |

## Scan for security issues

These templates run on a schedule and report or fix what they find.

| Template | Schedule | What each run does |
| - | - | - |
| **Dependency vulnerabilities** | Daily | Scans for known CVEs, ordered by severity, and opens upgrade pull requests. |
| **Secret scanner** | Daily | Scans the codebase for leaked credentials, API keys and tokens. |
| **OWASP security hardening** | Weekly | Scans for OWASP Top 10 issues such as injection, XSS and insecure defaults. |

## After creating the Loop

A Loop made from a template is a regular Loop. Edit its instructions in the **Studio** tab, and follow its runs in the **Sessions** and **Activity** tabs. See [Loops](https://docs.orq.ai/factory/loops.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.