Module agentforge4j.runtime
Record Class LlmCallContext
java.lang.Object
java.lang.Record
com.agentforge4j.runtime.interceptor.LlmCallContext
- Record Components:
runId- owning run id; never blankstepId- step the call belongs to; may benull/blank when not step-scopedagentId- the agent making the call; never blankprovider- the resolved provider name (e.g."claude"); never blankresolvedModel- the model the runtime resolved and will send; may benullfor a provider defaultmaxOutputTokens- the request's generated-token cap, ornullwhen unset (the embedding application falls back to its governing default)assembledPromptLength- character length of the assembled system prompt plus user input (>= 0); a length, not a token countcachedInputUnknown- whether cached-input status is unknown at this point (alwaystruepre-call — size against the non-cached ceiling)
public record LlmCallContext(String runId, String stepId, String agentId, String provider, String resolvedModel, Integer maxOutputTokens, int assembledPromptLength, boolean cachedInputUnknown)
extends Record
Neutral context for
RunExecutionInterceptor.beforeLlmCall(LlmCallContext), supplied immediately before each
LLM provider call (after model resolution, before dispatch).
Deliberately carries no prompt text: an embedding application that needs to size a worst-case
cost envelope gets the assembled prompt's character length (a plain
String.length(), not a tokenizer) and applies its own heuristic. Keeping OSS tokenizer-free and not spraying
prompt content across this control SPI is intentional. Input-token counts are not known before the call
(cachedInputUnknown() is therefore always true here); the actual usage is reconciled after the call
via the existing LlmCallObserver / LLM_CALL_COMPLETED event.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionagentId()Returns the value of theagentIdrecord component.intReturns the value of theassembledPromptLengthrecord component.booleanReturns the value of thecachedInputUnknownrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themaxOutputTokensrecord component.provider()Returns the value of theproviderrecord component.Returns the value of theresolvedModelrecord component.runId()Returns the value of therunIdrecord component.stepId()Returns the value of thestepIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LlmCallContext
public LlmCallContext(String runId, String stepId, String agentId, String provider, String resolvedModel, Integer maxOutputTokens, int assembledPromptLength, boolean cachedInputUnknown) Creates an instance of aLlmCallContextrecord class.- Parameters:
runId- the value for therunIdrecord componentstepId- the value for thestepIdrecord componentagentId- the value for theagentIdrecord componentprovider- the value for theproviderrecord componentresolvedModel- the value for theresolvedModelrecord componentmaxOutputTokens- the value for themaxOutputTokensrecord componentassembledPromptLength- the value for theassembledPromptLengthrecord componentcachedInputUnknown- the value for thecachedInputUnknownrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
runId
Returns the value of therunIdrecord component.- Returns:
- the value of the
runIdrecord component
-
stepId
Returns the value of thestepIdrecord component.- Returns:
- the value of the
stepIdrecord component
-
agentId
Returns the value of theagentIdrecord component.- Returns:
- the value of the
agentIdrecord component
-
provider
Returns the value of theproviderrecord component.- Returns:
- the value of the
providerrecord component
-
resolvedModel
Returns the value of theresolvedModelrecord component.- Returns:
- the value of the
resolvedModelrecord component
-
maxOutputTokens
Returns the value of themaxOutputTokensrecord component.- Returns:
- the value of the
maxOutputTokensrecord component
-
assembledPromptLength
public int assembledPromptLength()Returns the value of theassembledPromptLengthrecord component.- Returns:
- the value of the
assembledPromptLengthrecord component
-
cachedInputUnknown
public boolean cachedInputUnknown()Returns the value of thecachedInputUnknownrecord component.- Returns:
- the value of the
cachedInputUnknownrecord component
-