instrument-existing-agent-with-prefactor-sdk

Installation
SKILL.md

Instrument Existing Agent With Prefactor SDK

Instrument a working agent that was built without Prefactor.

Core principle: instrument boundaries, not business logic.

Quick Start

  1. Bootstrap Prefactor resources with skills/bootstrap-existing-agent-with-prefactor-cli/SKILL.md.
  2. Install required Prefactor packages with the project's existing package manager (bun, npm, pnpm, or yarn).
  3. Identify runtime path: built-in adapter (@prefactor/langchain, @prefactor/ai, @prefactor/openclaw) or custom @prefactor/core adapter.
  4. Add one top-level run span and child spans around LLM/tool boundaries.
  5. Preserve context propagation and package-prefixed span types.
  6. Record error metadata and rethrow original errors.
  7. Finish spans on success, error, cancel, and stream terminal paths.
  8. Verify in your project's build/test/typecheck flow.

Prerequisite

Related skills
Installs
39
GitHub Stars
3
First Seen
Feb 23, 2026