# RunLedger protocol starters

These are small, executable JSONL adapters, not framework plugins. They use the
built-in local `search_docs` demo tool and need no model API key. The agent sends
a tool request, consumes the runner's result, and returns structured output.

Follow https://runledger.io/integrations for copyable download and run commands.
Start in a new, empty project with Python 3.9+ available as `python` and RunLedger
installed (`pipx install runledger`). The Node starter also needs Node.js 20+.

1. Run `runledger init` to generate the demo case, schema, cassette, and baseline.
2. Choose one starter:
   - Python: replace `evals/demo/agent/agent.py` with `agent.py` from this directory.
   - Node: save `agent.mjs` to `evals/demo/agent/agent.mjs` and replace the generated
     `evals/demo/suite.yaml` with `node-suite.yaml`.
3. Run `runledger run ./evals/demo --mode record` and copy its printed run directory.
4. Promote it with `runledger baseline promote --from RUN_DIR --to baselines/demo.json`
   (replace `RUN_DIR`; quote the path if it contains spaces).
5. Run `runledger run ./evals/demo --mode replay --baseline baselines/demo.json`.

The case should pass in record and replay modes. Open `report.html` in the artifacts
directory printed by each run. To prove a failure, add `next_steps` to the required
fields in `evals/demo/schema.json` and replay: the command should exit with code 1.
Restore the schema afterward; do not promote the failing run as a fix.

To adapt your own agent, bridge its tool dispatch through `tool_call` messages and
consume the matching `tool_result` by `call_id`. Stdout must contain only one JSON
message per line; send logs to stderr. Replay substitutes recorded tool responses;
the agent itself still executes. Network/model calls outside this bridge remain live.
For custom tool implementations, use `tool_module` and `tool_registry` in the suite.
