# Core Concepts

How evidence is captured, tasks generated, outcomes graded, candidates trained, and approved behavior delivered back to your agent.

## Agent Flywheel architecture

```text
 YOUR INFRASTRUCTURE                    │  PERCEPTEYE CONTROL PLANE
                                        │
 your agent (unchanged)                 │
   ↕ SDK or plugin                      │
   ├─ describe the agent (once) ───────►│  register; tasks from your real tool surface
   ├─ claim a practice task ───────────►│  lease + heartbeat
   ├─ run it, record outcomes          │
   ├─ report trajectory + answer ──────►│  grade → dataset → train → evaluate
   ├─ upload served turns (opt-in) ────►│  learn from production; evolve the prompt
   └─ read /policy/current,  ◄──────────┤  serve what a person approved
      /prompt/current                   │
                                        │
 every arrow is opened from your side   │  no inbound port, no listening socket
```

The SDK or plugin never reproduces server-side work. Task generation, grading, training, prompt optimization and evaluation run on PerceptEye's GPUs.

## Agent Flywheel lifecycle

**⓪ Describe.** Once at startup, the SDK reads the shape of your agent from inside its own process: the system prompt it really assembled, the tools it really registered (names, descriptions, JSON Schemas), provider and model, and sub-agents to depth 4. Never your tools' source, their return values, your credentials or your data. Turn it off with `introspect=False` or `PERCEPTEYE_INTROSPECT=0`. An agent nothing can read declares itself with `describe=`.

**① Claim.** In training mode, your process long-polls for a practice task (a _rollout_). Leases heartbeat while the task runs. Results held from earlier runs are delivered before new work is claimed.

**② Run.** Each task runs in a fresh child process with its own environment and a single-use credential. Your agent is unchanged.

**③ Record.** Every tool call lands as `ok`, `failed` or `unknown`, from adapters that observe from the outside or from an explicit `record_tool_call()`. Artifacts are collected on every path, including timeouts and non-zero exits.

**④ Grade and train.** Tasks generated from your real tool surface are graded against compiled checks. Graded runs become the dataset; the policy is trained and each candidate is measured against the model you run today.

**⑤ Improve.** A person approves the candidate in Decisions. Your production agent picks up the approved model and prompt. The next lap runs on the better agent, which generates better evidence.

## Runtime and operator responsibilities

|  | Runtime integration (SDK or plugin) | Operator (dashboard or `mck_` key) |
| --- | --- | --- |
| **Primary role** | Produce evidence; apply what was approved | Decide what trains and what ships |
| **Data source** | Your agent's own runs and served turns | What the runtime sent |
| **Training and promotion** | Never trains, never promotes | Starts rounds, approves or rejects candidates |
| **Local training** | None | None: training runs on the control plane |

### Runtime method reference

| Method | Python | Node plugin | Purpose |
| --- | --- | --- | --- |
| Practice tasks | `serve()` | Training mode (OpenClaw) | Claim graded tasks, run them, report outcomes |
| Production capture | `attach()` | Production mode (OpenClaw) | Record the turns you already serve; upload only once enabled |
| Explicit outcome | `record_tool_call()` | Shell append to `tool_calls.jsonl` | Record a verdict you know |
| Approved model | `apply_current_policy()`, `policy_source()` | Applied automatically | Point your agent at the approved endpoint |
| Approved prompt | `current_prompt()`, `prompt_decision()` | Applied automatically | Swap in the approved system prompt |

## Outcome statuses

| Status | Meaning |
| --- | --- |
| `ok` | Observed success |
| `failed` | Observed failure |
| `unknown` | No trustworthy verdict. Legal, expected, and never counted as a success |

Details in [Outcomes](https://docs.percepteye.ai/concepts-outcomes.md).

## Learn more

-   [Outcomes](https://docs.percepteye.ai/concepts-outcomes.md): the tri-state verdict and why `unknown` matters.
-   [Modes](https://docs.percepteye.ai/concepts-modes.md): training versus production.
-   [Approvals](https://docs.percepteye.ai/concepts-approvals.md): how a change reaches your users.
-   [Wire contract](https://docs.percepteye.ai/advanced-wire-contract.md): the schema both SDKs share.

---
Source: https://docs.percepteye.ai/#concepts · Index: https://docs.percepteye.ai/llms.txt
