GitHub

ToolLedgerService

API reference for ToolLedgerService.

The records of tool calls, by tool_call_id.

Functions

begin

begin(tool_call_id, tool_name) -> Effect[Begun, ToolLedgerError]

Record the intent to run tool_call_id, atomically, unless the ledger has it: Claimed when this call recorded it, else the entry it found.

ParameterTypeDescription
tool_call_idstr
tool_namestr

Returns Effect[Begun, ToolLedgerError]

@abstractmethod
def begin(self, tool_call_id: str, tool_name: str) -> Effect[Begun, ToolLedgerError]:
    """Record the intent to run ``tool_call_id``, atomically, unless the ledger has it:
    ``Claimed`` when this call recorded it, else the entry it found."""

complete

complete(tool_call_id, outcome) -> Effect[None, ToolLedgerError]

Record the call's outcome.

ParameterTypeDescription
tool_call_idstr
outcomeOutcome

Returns Effect[None, ToolLedgerError]

@abstractmethod
def complete(self, tool_call_id: str, outcome: Outcome) -> Effect[None, ToolLedgerError]:
    """Record the call's ``outcome``."""

lookup

lookup(tool_call_id) -> Effect[Entry | None, ToolLedgerError]

The call's entry, if any.

ParameterTypeDescription
tool_call_idstr

Returns Effect[Entry | None, ToolLedgerError]

@abstractmethod
def lookup(self, tool_call_id: str) -> Effect[Entry | None, ToolLedgerError]:
    """The call's entry, if any."""