Files
openclaw/docs/openclaw-agent-runtime.md
Peter Steinberger 22bad620fc refactor: remove pi runtime internals
Rename remaining Pi-shaped agent surfaces to OpenClaw agent runtime names, delete obsolete Pi docs and package graph checks, and add the third-party notice for incorporated code.
2026-05-27 18:15:26 +01:00

2.6 KiB

summary, title, read_when
summary title read_when
Developer workflow for OpenClaw agent runtime: build, test, and live validation OpenClaw agent runtime workflow
Working on OpenClaw agent runtime code or tests
Running agent-runtime lint, typecheck, and live test flows

A sane workflow for working on the OpenClaw agent runtime in OpenClaw.

Type checking and linting

  • Default local gate: pnpm check
  • Build gate: pnpm build when the change can affect build output, packaging, or lazy-loading/module boundaries
  • Full landing gate for agent-runtime changes: pnpm check && pnpm test

Running Agent Runtime Tests

Run the agent-runtime test set directly with Vitest:

pnpm test \
  "src/agents/agent-*.test.ts" \
  "src/agents/embedded-agent-*.test.ts" \
  "src/agents/agent-tools*.test.ts" \
  "src/agents/agent-settings.test.ts" \
  "src/agents/agent-tool-definition-adapter*.test.ts" \
  "src/agents/agent-hooks/**/*.test.ts"

To include the live provider exercise:

OPENCLAW_LIVE_TEST=1 pnpm test src/agents/embedded-agent-runner-extraparams.live.test.ts

This covers the main agent runtime unit suites:

  • src/agents/agent-*.test.ts
  • src/agents/embedded-agent-*.test.ts
  • src/agents/agent-tools*.test.ts
  • src/agents/agent-settings.test.ts
  • src/agents/agent-tool-definition-adapter.test.ts
  • src/agents/agent-hooks/*.test.ts

Manual testing

Recommended flow:

  • Run the gateway in dev mode:
    • pnpm gateway:dev
  • Trigger the agent directly:
    • pnpm openclaw agent --message "Hello" --thinking low
  • Use the TUI for interactive debugging:
    • pnpm tui

For tool call behavior, prompt for a read or exec action so you can see tool streaming and payload handling.

Clean slate reset

State lives under the OpenClaw state directory. Default is ~/.openclaw. If OPENCLAW_STATE_DIR is set, use that directory instead.

To reset everything:

  • openclaw.json for config
  • agents/<agentId>/agent/auth-profiles.json for model auth profiles (API keys + OAuth)
  • credentials/ for provider/channel state that still lives outside the auth profile store
  • agents/<agentId>/sessions/ for agent session history
  • agents/<agentId>/sessions/sessions.json for the session index
  • sessions/ if legacy paths exist
  • workspace/ if you want a blank workspace

If you only want to reset sessions, delete agents/<agentId>/sessions/ for that agent. If you want to keep auth, leave agents/<agentId>/agent/auth-profiles.json and any provider state under credentials/ in place.

References