eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
28 lines (27 loc) • 1.8 kB
TypeScript
import { type Tracer } from "#compiled/@opentelemetry/api/index.js";
import type { AgentTraceStateStore } from "#tracing/agent-trace-state.js";
import type { AgentSpanIdGenerator } from "#tracing/agent-span-id-generator.js";
import type { TraceCapturePolicy } from "#tracing/otel-declaration.js";
import type { InstrumentationContextRunner, InstrumentationProviderDefinition, InstrumentationSessionStartedEvent, InstrumentationTraceSeed, InstrumentationTurnStartedEvent } from "#instrumentation/lifecycle.js";
import { type AgentSamplingOperation } from "#tracing/agent-span-contract.js";
export interface AgentOtelInstrumentationInput {
/** Whether any destination records model and tool inputs. */
readonly recordInputs?: boolean;
/** Whether any destination records model and tool outputs. */
readonly recordOutputs?: boolean;
readonly frameworkVersion: string;
readonly idGenerator: AgentSpanIdGenerator;
readonly samplesTrace?: (traceId: string, operation?: AgentSamplingOperation) => boolean;
readonly stateStore: AgentTraceStateStore;
readonly tracer: Tracer;
readonly tracePolicy?: TraceCapturePolicy;
}
/** OTel event definition and its trusted framework context runner. */
export interface AgentOtelInstrumentation {
readonly hook: InstrumentationProviderDefinition;
readonly prepareSessionTrace: (event: InstrumentationSessionStartedEvent) => Promise<InstrumentationTraceSeed>;
readonly prepareTurnTrace: (event: InstrumentationTurnStartedEvent) => Promise<InstrumentationTraceSeed>;
readonly runInContext: InstrumentationContextRunner;
}
/** Creates OTel instrumentation for eve's structural and GenAI spans. */
export declare function createAgentOtelInstrumentation(input: AgentOtelInstrumentationInput): AgentOtelInstrumentation;