Class AgiConfig
java.lang.Object
uno.anahata.asi.agi.event.BasicPropertyChangeSource
uno.anahata.asi.agi.AgiConfig
- All Implemented Interfaces:
PropertyChangeSource, Rebindable
- Direct Known Subclasses:
SwingAgiConfig
The definitive configuration blueprint for an individual Agi session.
Defines the operational parameters, enabled toolkits, AI providers, and context management policies. This class serves as the 'DNA' of an Agi, ensuring architectural consistency and facilitating model-agnostic orchestration across session restarts.
- Author:
- anahata
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AgiA late-binding reference to the parent Agi.private longThe initial delay in milliseconds before the first retry.private longThe maximum delay in milliseconds between retries.private intThe maximum number of times to retry an API call on failure.private @NonNull AbstractAsiContainerA reference to the global, application-wide configuration.private booleanIf true, the agi loop will automatically re-prompt the model after executing tools.private intThe default maximum depth a BlobPart should be kept in context.private intThe default maximum depth a model code execution part should be kept in context.The default response modalities for this agi session.private intThe default maximum depth a TextPart should be kept in context.private intThe default maximum depth a model thought should be kept in context.private intThe default maximum depth a ToolResponse should be kept in context.private intThe default maximum depth a web search call part should be kept in context.private booleanIf true, thought parts are initially expanded in the UI.private ExpandToolsPreferencePreference for expanding tool calls in the UI.private booleanIf true, server-side tools (like Google Search) are enabled.private booleanIf true, the model is requested to include its internal thought process in the response.private booleanIf true, local Java tools are enabled.private StringThe UUID of the AGI that spawned this session, if any.The list of AI provider UUIDs available for this agi session.private StringThe ID of the AI model currently selected for this session.private StringThe UUID of the AI provider currently selected for this session.private @NonNull StringThe unique identifier for this specific agi session.private booleanIf true, token streaming is enabled for model responses.private intThe maximum number of tokens allowed in the context window.The list of tool classes to be used in this agi session.Fields inherited from class BasicPropertyChangeSource
propertyChangeSupport -
Constructor Summary
ConstructorsConstructorDescriptionAgiConfig(@NonNull AbstractAsiContainer asiConfig) Constructs a new AgiConfig with a randomly generated session ID.AgiConfig(@NonNull AbstractAsiContainer asiConfig, @NonNull String sessionId) Constructs a new AgiConfig with a specific session ID. -
Method Summary
Modifier and TypeMethodDescriptioncreateResourceHandle(URI uri) Creates a specializedResourceHandlebased on the URI scheme.Convenience method to get the host application ID from the parent AsiContainer.intGets the maximum number of tokens allowed in the context window.voidsetApiInitialDelayMillis(long apiInitialDelayMillis) Sets the initial API retry delay and fires a property change event.voidsetApiMaxDelayMillis(long apiMaxDelayMillis) Sets the max API retry delay and fires a property change event.voidsetApiMaxRetries(int apiMaxRetries) Sets the max API retries and fires a property change event.voidsetAutoReplyTools(boolean autoReplyTools) Sets whether tool calls should be auto-replied and fires a property change event.voidsetDefaultBlobPartMaxDepth(int defaultBlobPartMaxDepth) Sets the default blob part max depth and fires a property change event.voidsetDefaultModelCodeExecutionMaxDepth(int defaultModelCodeExecutionMaxDepth) Sets the default model code execution max depth and fires a property change event.voidsetDefaultTextPartMaxDepth(int defaultTextPartMaxDepth) Sets the default text part max depth and fires a property change event.voidsetDefaultThoughtPartMaxDepth(int defaultThoughtPartMaxDepth) Sets the default thought part max depth and fires a property change event.voidsetDefaultToolMaxDepth(int defaultToolMaxDepth) Sets the default tool response max depth and fires a property change event.voidsetDefaultWebSearchMaxDepth(int defaultWebSearchMaxDepth) Sets the default web search max depth and fires a property change event.voidsetExpandThoughts(boolean expandThoughts) Sets whether thoughts should be expanded and fires a property change event.voidsetExpandTools(ExpandToolsPreference expandTools) Sets the tool expansion preference and fires a property change event.voidsetHostedToolsEnabled(boolean enabled) Configures the session to utilize hosted server-side tools (e.g., Google Search).voidsetIncludeThoughts(boolean includeThoughts) Sets whether thoughts should be included and fires a property change event.voidsetLocalToolsEnabled(boolean enabled) Configures the session to utilize local Java-based toolkits.voidsetSelectedModelId(String selectedModelId) Sets the selected model ID and fires a property change event.voidsetSelectedProviderUuid(String selectedProviderUuid) Sets the selected provider UUID and fires a property change event.voidsetStreaming(boolean streaming) Sets whether streaming is enabled and fires a property change event.voidsetTokenThreshold(int tokenThreshold) Sets the token threshold and fires a property change event.Methods inherited from class BasicPropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, rebind, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PropertyChangeSource
getPropertyChangeSupport
-
Field Details
-
asiContainer
A reference to the global, application-wide configuration. -
sessionId
The unique identifier for this specific agi session. -
parentUuid
The UUID of the AGI that spawned this session, if any. -
agi
A late-binding reference to the parent Agi. Set during Agi construction. -
selectedProviderUuid
The UUID of the AI provider currently selected for this session. -
selectedModelId
The ID of the AI model currently selected for this session. -
providerUuids
-
toolClasses
-
localToolsEnabled
private boolean localToolsEnabledIf true, local Java tools are enabled. -
hostedToolsEnabled
private boolean hostedToolsEnabledIf true, server-side tools (like Google Search) are enabled. -
autoReplyTools
private boolean autoReplyToolsIf true, the agi loop will automatically re-prompt the model after executing tools. -
streaming
private boolean streamingIf true, token streaming is enabled for model responses. -
includeThoughts
private boolean includeThoughtsIf true, the model is requested to include its internal thought process in the response. -
expandThoughts
private boolean expandThoughtsIf true, thought parts are initially expanded in the UI. -
expandTools
Preference for expanding tool calls in the UI. -
apiMaxRetries
private int apiMaxRetriesThe maximum number of times to retry an API call on failure. -
apiInitialDelayMillis
private long apiInitialDelayMillisThe initial delay in milliseconds before the first retry. -
apiMaxDelayMillis
private long apiMaxDelayMillisThe maximum delay in milliseconds between retries. -
tokenThreshold
private int tokenThresholdThe maximum number of tokens allowed in the context window. -
defaultBlobPartMaxDepth
private int defaultBlobPartMaxDepthThe default maximum depth a BlobPart should be kept in context. -
defaultToolMaxDepth
private int defaultToolMaxDepthThe default maximum depth a ToolResponse should be kept in context. -
defaultThoughtPartMaxDepth
private int defaultThoughtPartMaxDepthThe default maximum depth a model thought should be kept in context. -
defaultTextPartMaxDepth
private int defaultTextPartMaxDepthThe default maximum depth a TextPart should be kept in context. -
defaultModelCodeExecutionMaxDepth
private int defaultModelCodeExecutionMaxDepthThe default maximum depth a model code execution part should be kept in context. -
defaultWebSearchMaxDepth
private int defaultWebSearchMaxDepthThe default maximum depth a web search call part should be kept in context. -
defaultResponseModalities
-
-
Constructor Details
-
AgiConfig
Constructs a new AgiConfig with a randomly generated session ID.- Parameters:
asiConfig- The global AI configuration.
-
AgiConfig
public AgiConfig(@NonNull @NonNull AbstractAsiContainer asiConfig, @NonNull @NonNull String sessionId) Constructs a new AgiConfig with a specific session ID.- Parameters:
asiConfig- The global AI configuration.sessionId- The unique session ID.
-
-
Method Details
-
setSelectedProviderUuid
Sets the selected provider UUID and fires a property change event.- Parameters:
selectedProviderUuid- The UUID of the selected provider.
-
setSelectedModelId
Sets the selected model ID and fires a property change event.- Parameters:
selectedModelId- The ID of the selected model.
-
setAutoReplyTools
public void setAutoReplyTools(boolean autoReplyTools) Sets whether tool calls should be auto-replied and fires a property change event.- Parameters:
autoReplyTools- true to enable auto-reply.
-
setStreaming
public void setStreaming(boolean streaming) Sets whether streaming is enabled and fires a property change event.- Parameters:
streaming- true to enable streaming.
-
setIncludeThoughts
public void setIncludeThoughts(boolean includeThoughts) Sets whether thoughts should be included and fires a property change event.- Parameters:
includeThoughts- true to include thoughts.
-
setExpandTools
Sets the tool expansion preference and fires a property change event.- Parameters:
expandTools- The expansion preference.
-
setExpandThoughts
public void setExpandThoughts(boolean expandThoughts) Sets whether thoughts should be expanded and fires a property change event.- Parameters:
expandThoughts- true to expand thoughts.
-
setApiMaxRetries
public void setApiMaxRetries(int apiMaxRetries) Sets the max API retries and fires a property change event.- Parameters:
apiMaxRetries- The maximum number of retries.
-
setApiInitialDelayMillis
public void setApiInitialDelayMillis(long apiInitialDelayMillis) Sets the initial API retry delay and fires a property change event.- Parameters:
apiInitialDelayMillis- The initial delay in milliseconds.
-
setApiMaxDelayMillis
public void setApiMaxDelayMillis(long apiMaxDelayMillis) Sets the max API retry delay and fires a property change event.- Parameters:
apiMaxDelayMillis- The maximum delay in milliseconds.
-
setTokenThreshold
public void setTokenThreshold(int tokenThreshold) Sets the token threshold and fires a property change event.- Parameters:
tokenThreshold- The threshold token count.
-
setDefaultTextPartMaxDepth
public void setDefaultTextPartMaxDepth(int defaultTextPartMaxDepth) Sets the default text part max depth and fires a property change event.- Parameters:
defaultTextPartMaxDepth- The default max depth.
-
setDefaultToolMaxDepth
public void setDefaultToolMaxDepth(int defaultToolMaxDepth) Sets the default tool response max depth and fires a property change event.- Parameters:
defaultToolMaxDepth- The default max depth.
-
setDefaultBlobPartMaxDepth
public void setDefaultBlobPartMaxDepth(int defaultBlobPartMaxDepth) Sets the default blob part max depth and fires a property change event.- Parameters:
defaultBlobPartMaxDepth- The default max depth.
-
setDefaultThoughtPartMaxDepth
public void setDefaultThoughtPartMaxDepth(int defaultThoughtPartMaxDepth) Sets the default thought part max depth and fires a property change event.- Parameters:
defaultThoughtPartMaxDepth- The default max depth.
-
setDefaultModelCodeExecutionMaxDepth
public void setDefaultModelCodeExecutionMaxDepth(int defaultModelCodeExecutionMaxDepth) Sets the default model code execution max depth and fires a property change event.- Parameters:
defaultModelCodeExecutionMaxDepth- The default max depth.
-
setDefaultWebSearchMaxDepth
public void setDefaultWebSearchMaxDepth(int defaultWebSearchMaxDepth) Sets the default web search max depth and fires a property change event.- Parameters:
defaultWebSearchMaxDepth- The default max depth.
-
setLocalToolsEnabled
public void setLocalToolsEnabled(boolean enabled) Configures the session to utilize local Java-based toolkits.Enabling local tools automatically disables hosted server tools to maintain environmental consistency.
- Parameters:
enabled- true to enable local toolkits.
-
setHostedToolsEnabled
public void setHostedToolsEnabled(boolean enabled) Configures the session to utilize hosted server-side tools (e.g., Google Search).Enabling hosted tools automatically disables local Java toolkits to prevent capability conflicts.
- Parameters:
enabled- true to enable server-side tools.
-
getTokenThreshold
public int getTokenThreshold()Gets the maximum number of tokens allowed in the context window.- Returns:
- The token threshold.
-
createResourceHandle
Creates a specializedResourceHandlebased on the URI scheme.Supports 'file' schemes via
PathHandleand fallbacks toUrlHandlefor remote resources.- Parameters:
uri- The resource URI to wrap.- Returns:
- A concrete handle implementation for the specified URI.
-
getHostApplicationId
Convenience method to get the host application ID from the parent AsiContainer.- Returns:
- The host application ID.
-

