Skip to content

ToolCall

The service a tool’s execute runs with: the durable capabilities of the one call it serves. The pi.tool task provides it for each execution.

Since v0.0.0


Signature

declare class ToolCall

Source

Since v0.0.0

Signature

export interface ToolCallShape {
/** The `pi.tool` task executing the call. */
readonly taskId: TaskId
readonly conversationId: ConversationId
/** The model's call ID. */
readonly callId: string
readonly toolName: string
/** The conversation's environment, built for this execution; `undefined` without one. */
readonly env: ExecEnv | undefined
/** Stream output; it is committed with a throttle and shown while the call runs. */
readonly output: (text: string) => Effect.Effect<void, InvocationEnded>
/** Record a remark about this call for the model; it is shown while the call runs and lands in the result. */
readonly diagnostic: (diagnostic: ToolDiagnostic) => Effect.Effect<void, InvocationEnded>
/** Replace the running call's details, for example a child conversation a UI can attach to. */
readonly details: (details: Json) => Effect.Effect<void, CommitError | InvocationEnded | SchedulerClosed>
/** Commit with entries attributed to the call's task. */
readonly commit: <A, E, R>(
body: Effect.Effect<A, E, R>
) => Effect.Effect<A, E | CommitError | InvocationEnded | SchedulerClosed, Exclude<R, Tx>>
/** Committed state. */
readonly snapshot: <A>(ref: State.Ref<A>) => Effect.Effect<Option.Option<A>, ReadError | InvocationEnded>
/**
* A handle of an existing conversation, such as a child this call created in `commit`, bound to this execution:
* its operations fail with `InvocationEnded` once the call returned. `None` when the conversation does not exist.
*/
readonly conversation: (
id: ConversationId
) => Effect.Effect<Option.Option<ConversationHandle>, StorageFailure | SessionPoisoned | InvocationEnded>
}

Source

Since v0.0.0