@pactcore/sdk
v0.2.0
Published
TypeScript SDK for integrating with PACT Core services
Maintainers
Readme
PACT SDK
PACT SDK is the runtime toolkit for building on top of pactcore/core.
This package is designed for human-agent protocol participation, not only endpoint calls.
Design Baseline
- protocol semantics come from the PACT whitepaper (
core) - SDK focuses on loop execution, recovery, policy enforcement, and economic composition
- transport helpers are supporting pieces, not the center
Current Capabilities
- typed
PactSdktransport client WorkerRuntimewith:runOnce()runLoop()- event feed polling (cursor-based)
- checkpoint persistence hooks
- event source adapters:
HttpMissionEventFeedInMemoryMissionEventFeed
- in-memory checkpoint store:
InMemoryWorkerRuntimeCheckpointStore
- economics helpers:
buildCompensationModelsummarizeCompensationByAsset
Economic Model Support
Compensation composition supports mixed reward legs such as:
- USDC / stablecoins
- LLM token allowances
- cloud credits
- API quota credits
Install
bun add @pactcore/sdk
# or
npm i @pactcore/sdkQuick Example
import {
createWorkerRuntime,
allowAllWorkerRuntimePolicy,
buildCompensationModel,
} from "@pactcore/sdk";
const compensation = buildCompensationModel({
legs: [
{
payerId: "issuer-1",
payeeId: "agent-1",
assetId: "usdc-mainnet",
amount: 15,
unit: "USDC",
},
],
});
const runtime = createWorkerRuntime({
agentId: "agent-1",
missionSource,
policy: allowAllWorkerRuntimePolicy(),
handlers,
});
await runtime.runLoop({ iterations: 10 });Local Development
bun install
bun test
bun run typecheckDocumentation
docs/architecture.mddocs/agent-sdk-direction.mddocs/runtime-composition.mddocs/compatibility.mddocs/economics.md
