@agent-cdp/sdk
v1.5.1
Published
Programmatic SDK for agent-cdp runtime integrations.
Readme
@agent-cdp/sdk
@agent-cdp/sdk is the app-side runtime bridge for agent-cdp. It lets running application code trigger a focused subset of daemon-backed inspection and profiling actions from inside the target app.
Install
npm install @agent-cdp/sdkFor workspace development from this repository:
pnpm install
pnpm run buildSetup
- Start the daemon with
agent-cdp start. - Select the running app target with
agent-cdp target listandagent-cdp target select <target-id>. - Call the SDK from app code after the bridge is injected into the selected runtime.
If no target is selected, SDK calls reject because the runtime bridge is not installed.
Usage
import { cpuProfile } from "@agent-cdp/sdk";
export async function runProfiledAction() {
await cpuProfile.start({ name: "checkout-submit" });
try {
await submitCheckout();
await flushPostSubmitWork();
} finally {
const sessionId = await cpuProfile.stop();
console.log("agent-cdp CPU profile session", sessionId);
}
}Available modules
cpuProfile:start,status,stopallocation:start,status,stopallocationTimeline:start,status,stopmemoryUsage:samplememorySnapshot:capturenetwork:start,status,stoptrace:start,status,stopAgentRuntimeClient: direct client when you need custom timeout or binding names
