Package akka.javasdk.ledger
Interface LedgerClient
public interface LedgerClient
Client for fetching records from the ledger, the log of recorded agent interactions and their
evaluations.
A LedgerClient can be injected into any component. An Evaluator uses it to fetch the interaction referenced by its Subject.interactionId().
Not for user extension.
-
Method Summary
Modifier and TypeMethodDescriptiongetEvaluation(String evaluationId) Fetch the record for the evaluation with the givenevaluationId.getEvaluationAsync(String evaluationId) Async variant ofgetEvaluation(String).getEvaluations(String interactionId) Fetch the evaluations recorded about the interaction with the giveninteractionId, newest first.getEvaluationsAsync(String interactionId) Async variant ofgetEvaluations(String).getInteraction(String interactionId) Fetch the full record for the interaction with the given (globally unique)interactionId.getInteractionAsync(String interactionId) Async variant ofgetInteraction(String).
-
Method Details
-
getInteraction
Fetch the full record for the interaction with the given (globally unique)interactionId.Blocks the calling thread until the record has been fetched. Safe to call on a virtual thread. Use
getInteractionAsync(String)for the non-blocking variant.- Parameters:
interactionId- the globally unique id of the interaction to fetch- Returns:
- the interaction record
- Throws:
NoSuchElementException- if no interaction exists with that id
-
getInteractionAsync
Async variant ofgetInteraction(String).- Parameters:
interactionId- the globally unique id of the interaction to fetch- Returns:
- a stage that completes with the interaction record, or fails with
NoSuchElementExceptionif no interaction exists with that id
-
getEvaluation
Fetch the record for the evaluation with the givenevaluationId. An evaluation is recorded when it terminates, so the record exists only once the evaluation has finished.Blocks the calling thread until the record has been fetched. Safe to call on a virtual thread. Use
getEvaluationAsync(String)for the non-blocking variant.- Parameters:
evaluationId- the globally unique id of the evaluation to fetch- Returns:
- the evaluation record
- Throws:
NoSuchElementException- if no evaluation exists with that id
-
getEvaluationAsync
Async variant ofgetEvaluation(String).- Parameters:
evaluationId- the globally unique id of the evaluation to fetch- Returns:
- a stage that completes with the evaluation record, or fails with
NoSuchElementExceptionif no evaluation exists with that id
-
getEvaluations
Fetch the evaluations recorded about the interaction with the giveninteractionId, newest first.Blocks the calling thread until the records have been fetched. Safe to call on a virtual thread. Use
getEvaluationsAsync(String)for the non-blocking variant.- Parameters:
interactionId- the id of the evaluated interaction, as carried byAgent.AgentReply.interactionId()- Returns:
- the evaluations of that interaction, or an empty list when none are recorded
-
getEvaluationsAsync
Async variant ofgetEvaluations(String).- Parameters:
interactionId- the id of the evaluated interaction- Returns:
- a stage that completes with the evaluations of that interaction
-