@prefactor/core
Prefactor TypeScript SDK / @prefactor/core
@prefactor/core
Section titled “@prefactor/core”Shared runtime, tracing primitives, and transport abstractions for Prefactor SDK adapters.
@prefactor/core overview
Section titled “@prefactor/core overview”@prefactor/core is the foundation for Prefactor integrations. Use it when you want direct
control over tracing lifecycle, transport behavior, and custom instrumentation in your app.
The package supports validated runtime configuration through createConfig, runtime
initialization through createCore, manual instrumentation through withSpan and
Tracer.startSpan, and graceful lifecycle handling with shutdown and
registerShutdownHandler.
Quick start: initialize runtime directly
Section titled “Quick start: initialize runtime directly”import { createConfig, createCore } from '@prefactor/core';
const config = createConfig({ transportType: 'http', httpConfig: { apiUrl: 'https://api.prefactor.ai', apiToken: process.env.PREFACTOR_API_TOKEN!, agentIdentifier: '1.0.0', },});
const core = createCore(config);// core.tracer, core.agentManager, core.shutdown()Example: instrument custom work
Section titled “Example: instrument custom work”import { withSpan } from '@prefactor/core';
const result = await withSpan( { name: 'custom-operation', spanType: 'app:task', inputs: { jobId: 'job-123' }, }, async () => { return { ok: true }; });Functions
Section titled “Functions”- createConfig
- createCore
- registerShutdownHandler
- shutdown
- createSpanTypePrefixer
- withSpan
- configureLogging
- getLogger
- serializeValue
- truncateString
Classes
Section titled “Classes”- AgentInstanceManager
- SpanContext
- Tracer
- AgentInstanceClient
- AgentSpanClient
- HttpClient
- HttpClientError
- HttpTransport
Enumerations
Section titled “Enumerations”Interfaces
Section titled “Interfaces”Type Aliases
Section titled “Type Aliases”- Config
- HttpTransportConfig
- PartialHttpConfig
- CoreRuntime
- SpanType
- AgentInstanceFinishOptions
- AgentInstanceRegisterPayload
- AgentInstanceResponse
- AgentInstanceStartOptions
- AgentSpanCreatePayload
- AgentSpanFinishOptions
- AgentSpanResponse
- AgentSpanStatus
- AgentInstanceOptions