# Quickstart

Connect your first agent to Agent Flywheel with the Python SDK, the Node SDK, the OpenClaw plugin, or DeepSeek Harness.

## Start your first Agent Flywheel integration

| Integration | Best fit | Capability boundary |
| --- | --- | --- |
| **Python SDK** | A Python agent built by an importable `module:attr` factory, or any CLI agent | Practice tasks (`serve()`), production capture (`attach()`), approved model and prompt handed back for you to apply |
| **Node SDK** | A JavaScript or TypeScript agent on Node `>=22.22.3`: Vercel AI SDK, LangChain.js, LangGraph.js, or your own loop | Production capture (`fw.turn()`), practice tasks (`fw.serve()`), approved model and prompt handed to your agent on each turn |
| **OpenClaw** | An OpenClaw agent on Node `>=22.22.3` | Full workflow: recording, practice tasks, production capture, and the approved prompt and model applied for you. Needs conversation access enabled in OpenClaw |
| **DeepSeek Harness** | A `dsh` agent on Node `>=22.22.3` | Records tool outcomes only. No practice tasks, no production capture, no prompt or model changes |

Every path has the same shape: get a key, install, start your agent.

## 1\. Get a key

Sign up at [launch.percepteye.ai](https://launch.percepteye.ai/onboard/agent-sdk), choose **Add our SDK to your agent's code**, name your agent, and copy its `pefw_` key. The key is shown once and is scoped to that one agent. The name you give is the `agent_id` your code reports.

You can also get the key from the terminal once the package is installed (step 2):

```bash
agent-flywheel login --agent-id my-coding-agent          # Python SDK
npx @percepteye/agent-flywheel login --agent-id my-agent # Node SDK
```

Either command prints a short code and opens the browser with it filled in. Sign in, check the code matches, and click **Approve**. The key is stored in `~/.percepteye/credentials.json` (mode 0600) and both SDKs read the same file.

## 2\. Install and start

### Python SDK

**Install the SDK.** Python 3.10 to 3.13. One runtime dependency, `httpx`.

```bash
pip install agent-flywheel
export PERCEPTEYE_API_KEY=pefw_...
export PERCEPTEYE_AGENT_MODE=training   # unset means production: serve() runs nothing
```

> **Note:**
> 
> Training takes two switches, one on each side. `PERCEPTEYE_AGENT_MODE=training` on your process says it may run practice tasks. **Allow practice runs** on the agent in Mission Control (an org admin turns it on) says the platform may send them. With either one off, no practice task runs, and the side that is off says so. Point a training process at a test or sandbox backend: it runs generated tasks through your agent's real tools.

**Serve your agent.** Pass an importable factory so each practice task rebuilds your agent in a fresh child process:

```python
import agent_flywheel as fw

fw.serve(
    "my_package.agent:build",
    agent_id="my-coding-agent",
    input_shape="text",     # "text", "messages" or "dict"
    max_rollouts=8,         # bound your first run
)
```

`serve()` claims practice tasks, runs them, reports outcomes, and blocks until it stops. Everything that can be misconfigured is checked before the first task and raises there.

> **Tip:**
> 
> Practice tasks are real runs on your real credentials. Bound the first one with `max_rollouts=8` and point `artifacts_dir=` somewhere you don't mind it writing.

**A CLI agent?** Pass its command line instead. The task arrives on stdin:

```python
fw.serve(["my-agent", "run"], agent_id="my-cli-agent", input_shape="text")
```

**Already serving users?** Use [`attach()`](https://docs.percepteye.ai/guides-production-capture.md) to record the turns you serve instead.

### Node SDK

**Install the SDK.** Node 22.22.3 or later. Zero runtime dependencies, and TypeScript declarations included.

```bash
npm install @percepteye/agent-flywheel
export PERCEPTEYE_API_KEY=pefw_...        # from https://launch.percepteye.ai/onboard/agent-sdk
export PERCEPTEYE_AGENT_ID=support-agent  # the name you gave the agent there
```

**Wrap each turn you serve.** `fw.turn(input, fn)` runs your agent and returns what it returns. It records the user's message, every tool call, and the answer.

```typescript
import { flywheel } from "@percepteye/agent-flywheel";

const fw = flywheel({ agentId: "support-agent", framework: "ai-sdk" });

app.post("/chat", async (req, res) => {
  const answer = await fw.turn(req.body.message, (t) => runAgent(t), {
    conversationId: req.body.conversationId,
  });
  res.json({ answer });
});

process.on("SIGTERM", () => fw.close());   // sends what is waiting, bounded
```

`runAgent` is your agent. Its tool calls are recorded by the [adapter for its framework](https://docs.percepteye.ai/sdk-node.md#frameworks), or by `recordToolCall()` where your tools run. Once a person approves a better system prompt and model, `fn` is handed both: `t.systemPrompt(yours)` and `t.model`.

**Let it practise** in a separate process pointed at a test or sandbox backend, with `PERCEPTEYE_AGENT_MODE=training`:

```typescript
// PERCEPTEYE_AGENT_MODE=training node train.js
const fw = flywheel({ agentId: "support-agent", framework: "ai-sdk" });
await fw.serve(runAgent, { maxRollouts: 8 });
```

In a practice task `t.model` is always set, and your agent must call it. See [Node SDK](https://docs.percepteye.ai/sdk-node.md).

### OpenClaw

**Install the plugin.** No import, no wrapper process, no sidecar.

```bash
openclaw plugins install @percepteye/agent-flywheel
export PERCEPTEYE_API_KEY=pefw_...
export PERCEPTEYE_AGENT_MODE=training   # for practice tasks; unset means production
```

**Enable conversation access** in your OpenClaw config. Installing the plugin does not grant it.

```jsonc
{ "plugins": { "entries": { "agent-flywheel": {
    "hooks": { "allowConversationAccess": true } } } } }
```

This lets the plugin read your agent's answer, describe your agent, and point your agent at the approved model. Without it the plugin refuses to claim practice tasks and says so once at startup.

**Restart OpenClaw.** The startup line says which state the plugin is in. If your host runs more than one agent, set `agentId` (see [Node SDK configuration](https://docs.percepteye.ai/sdk-node.md#configuration)).

### DeepSeek Harness

**Install the plugin** for a `dsh` profile:

```bash
dsh plugin --profile <name> add @percepteye/agent-flywheel
```

> **Warning:**
> 
> DeepSeek Harness is record-only. It writes tool outcomes to `PERCEPTEYE_TRAJECTORY_DIR` and, with that unset, writes nothing. It does not claim practice tasks, capture production turns, or apply prompt or model changes.

## 3\. Watch the first lap land

The dashboard marks your agent **Connected** on its first call. From there:

1.  **Allow practice runs** on the agent's page if this process runs practice tasks.
2.  **Allow learning.** On the agent's page, turn on **Let us learn from its conversations, including the message text**. Until both permissions are on, nothing is uploaded.
3.  **Start improving.** Click **Start improving** on the agent's page.
4.  **Approve the winner** in **Decisions** when a candidate beats your current best.
5.  **Run the approved version.** See [Apply the approved model and prompt](https://docs.percepteye.ai/guides-apply-approved-policy.md).

## Next steps

-   [Concepts](https://docs.percepteye.ai/concepts.md): what happens on each lap.
-   [Modes](https://docs.percepteye.ai/concepts-modes.md): the one switch between training and production.
-   [Troubleshooting](https://docs.percepteye.ai/help-center-troubleshooting.md): if the dashboard never sees your agent.

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