Guides
Instrument A Custom Framework
Use adapter-kit patterns when there is no dedicated framework integration.
Use @isplay/adapter-kit when the app has its own agent loop or an unsupported framework. The kit wraps common capture patterns without forcing a specific framework model.
What To Wrap
| Boundary | Kit helper or SDK method |
|---|---|
| Run start/end | init() and withRun() from @isplay/sdk |
| Prompt, memory, retrieval, state | annotateContext() or kit annotations |
| Model call | captureModelCall() or SDK model methods |
| Tool call | wrapTool() |
| Framework lifecycle event | recordFrameworkEvent() |
| State snapshot | checkpoint() |
Basic Shape
import { init } from "@isplay/sdk";
import { createAdapterKit } from "@isplay/adapter-kit";
const client = init({
projectId: process.env.ISPLAY_PROJECT_ID!,
baseUrl: process.env.ISPLAY_API_URL,
serviceName: "custom-agent",
});
const kit = createAdapterKit({ client });
const search = kit.wrapTool(
{
name: "search",
sideEffectClass: "read",
schemaVersion: "1",
},
async (args: { query: string }) => {
return searchBackend(args.query);
},
);Add Framework Events
await kit.recordFrameworkEvent({
framework: "custom",
type: "step.started",
payload: {
step: "retrieve",
inputSummary: "claim policy lookup",
},
});Custom events are allowed by the event schema. Keep them compact and use stable names.
Annotation Strategy
Annotate the context that the framework hides:
- Planner or router prompts.
- Tool schema descriptions generated by the framework.
- Retrieval inputs and returned chunks.
- Memory read/write values.
- Graph node state.
- Human approval decisions.
Replay Readiness Checklist
| Question | Required work |
|---|---|
| Can a branch resume before the decision? | Add checkpoint before the decision. |
| Can a replay identify changed tool args? | Capture tool proposal and execution args. |
| Can missing output be matched? | Capture stable args hashes and tool names. |
| Can risky tools be blocked or fixture-backed? | Classify side effects and wrap before execution. |
| Can a report cite context? | Annotate context with paths and provenance. |