Package org.bsc.langgraph4j
Class RunnableConfig
java.lang.Object
org.bsc.langgraph4j.RunnableConfig
- All Implemented Interfaces:
HasMetadata
A final class representing configuration for a runnable task.
This class holds various parameters such as thread ID, checkpoint ID, next node,
and stream mode, providing methods to modify these parameters safely
without permanently altering the original configuration.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder pattern class for constructingRunnableConfigobjects. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringMetadata key used to disable state cloning during graph execution.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringkey that contains boolean value to inform that graph is executing in studio environment Warning: it is a RESERVED METADATA KEY don't use itstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic RunnableConfig.Builderbuilder()Creates a new instance of theRunnableConfig.Builderclass.static RunnableConfig.Builderbuilder(RunnableConfig config) Creates a newBuilderinstance with the specifiedRunnableConfig.Returns the currentcheckPointIdwrapped in anOptional.<State extends AgentState,Output extends NodeOutput<State>>
GraphDefinition.Dispatcher<State, Output> static RunnableConfigempty()graphId()Deprecated.booleanReturns whether state cloning is disabled for this runnable configuration.booleanbooleanChecks if the graph is running within a studio environment.return metadata value for keyreturn metadata keysnextNode()Returns anOptionaldescribing the next node in the sequence, or an emptyOptionalif there is no such node.nodeId()nodePath()Returns the path of the currently executing node within the graph hierarchy.Returns the maximum number of iterations allowed for this invocation.removeMetadata(String... keys) Returns the stream mode of the compiled graph.threadId()Returns the thread ID as anOptional.toString()updateMetadata(Map<String, Object> newMetadata) Updates the metadata of the configuration with the provided new metadata.withCheckPointId(String checkPointId) Updates the checkpoint ID of the configuration.withStreamMode(CompiledGraph.StreamMode streamMode) Create a new RunnableConfig with the same attributes as this one but with a differentCompiledGraph.StreamMode.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bsc.langgraph4j.HasMetadata
metadata
-
Field Details
-
STUDIO_METADATA_KEY
key that contains boolean value to inform that graph is executing in studio environment Warning: it is a RESERVED METADATA KEY don't use it- See Also:
-
NODE_ID
- See Also:
-
GRAPH_PATH
- See Also:
-
GRAPH_NODE_PATH
- See Also:
-
GRAPH_ID
- See Also:
-
SUBGRAPH_RESUME_UPDATE_DATA
- See Also:
-
CUSTOM_DISPATCHER
- See Also:
-
DISABLE_CLONE_STATE
Metadata key used to disable state cloning during graph execution.- Since:
- 1.9
- See Also:
-
-
Method Details
-
builder
Creates a new instance of theRunnableConfig.Builderclass.- Returns:
- A new
Builderobject.
-
builder
Creates a newBuilderinstance with the specifiedRunnableConfig.- Parameters:
config- The configuration for theBuilder.- Returns:
- A new
Builderinstance.
-
empty
-
streamMode
Returns the stream mode of the compiled graph.- Returns:
StreamModerepresenting the current stream mode.
-
recursionLimit
-
threadId
-
checkPointId
Returns the currentcheckPointIdwrapped in anOptional.- Returns:
- an
Optionalcontaining thecheckPointId, orOptional.empty()if it is null.
-
nextNode
-
withStreamMode
Create a new RunnableConfig with the same attributes as this one but with a differentCompiledGraph.StreamMode.- Parameters:
streamMode- the new stream mode- Returns:
- a new RunnableConfig with the updated stream mode
-
withCheckPointId
Updates the checkpoint ID of the configuration.- Parameters:
checkPointId- The new checkpoint ID to set.- Returns:
- A new instance of
RunnableConfigwith the updated checkpoint ID, or the current instance if no change is needed.
-
updateMetadata
Updates the metadata of the configuration with the provided new metadata.- Parameters:
newMetadata- The map containing the new metadata to be merged.- Returns:
- A new
RunnableConfiginstance with updated metadata, or the current instance if no changes are needed.
-
removeMetadata
-
metadataKeys
Description copied from interface:HasMetadatareturn metadata keys- Specified by:
metadataKeysin interfaceHasMetadata- Returns:
- metadata keys if any or empty set
-
metadata
return metadata value for key- Specified by:
metadatain interfaceHasMetadata- Parameters:
key- given metadata key- Returns:
- metadata value for key if any
-
isRunningInStudio
public boolean isRunningInStudio()Checks if the graph is running within a studio environment.- Returns:
trueif theSTUDIO_METADATA_KEYmetadata key is present and its value istrue,falseotherwise.
-
nodeId
-
graphId
-
graphPath
Deprecated. -
nodePath
-
isCloneStateDisabled
public boolean isCloneStateDisabled()Returns whether state cloning is disabled for this runnable configuration.- Returns:
trueif state cloning is disabled,falseotherwise- Since:
- 1.9
-
isResumeSubgraph
public boolean isResumeSubgraph() -
customDispatcher
public <State extends AgentState,Output extends NodeOutput<State>> GraphDefinition.Dispatcher<State,Output> customDispatcher() -
toString
-