Class RuntimeAgentConfig
java.lang.Object
io.agentscope.extensions.scheduler.config.AgentConfig
io.agentscope.extensions.scheduler.config.RuntimeAgentConfig
Runtime Agent configuration that extends AgentConfig with non-serializable runtime objects.
This subclass adds runtime objects like Toolkit and Hooks that cannot be serialized. Use this class when you need to configure agents with tools and lifecycle hooks in the same JVM process.
When to Use:
- RuntimeAgentConfig - When scheduling in the same JVM with toolkit/hooks
- AgentConfig - When persisting config or using distributed scheduling
Usage Example:
// Create toolkit
Toolkit toolkit = new Toolkit();
toolkit.registerTool(new WeatherTool());
// Create hooks
List<Hook> hooks = Arrays.asList(
new LoggingHook(),
new MetricsHook()
);
// Create runtime configuration
RuntimeAgentConfig config = RuntimeAgentConfig.builder()
.name("MyAgent")
.modelConfig(modelConfig)
.sysPrompt("You are a helpful assistant.")
.toolkit(toolkit) // Runtime object
.hooks(hooks) // Runtime object
.build();
// Schedule with runtime configuration
ScheduleAgentTask task = scheduler.schedule(config, scheduleConfig);
Design Notes:
- Extends AgentConfig to inherit serializable configuration
- Adds toolkit and hooks as runtime-only properties
- Not suitable for serialization or distributed scenarios
- Immutable after construction
- See Also:
-
AgentConfigToolkitHook
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating RuntimeAgentConfig instances. -
Method Summary
Modifier and TypeMethodDescriptionstatic RuntimeAgentConfig.Builderbuilder()Create a new builder instance.booleanList<io.agentscope.core.hook.Hook>getHooks()Get the hooks.io.agentscope.core.model.ModelgetModel()Get the pre-created Model instance.io.agentscope.core.tool.ToolkitGet the toolkit.inthashCode()toString()Methods inherited from class io.agentscope.extensions.scheduler.config.AgentConfig
getModelConfig, getName, getSysPrompt
-
Method Details
-
builder
Create a new builder instance.- Returns:
- A new RuntimeAgentConfig.Builder
-
getToolkit
public io.agentscope.core.tool.Toolkit getToolkit()Get the toolkit.- Returns:
- The toolkit instance, may be null
-
getHooks
Get the hooks.- Returns:
- The list of hooks, never null but may be empty
-
getModel
public io.agentscope.core.model.Model getModel()Get the pre-created Model instance.The model is automatically created from ModelConfig during the build process. This avoids repeated model creation for each agent execution.
- Returns:
- The Model instance, may be null if not set
-
equals
- Overrides:
equalsin classAgentConfig
-
hashCode
public int hashCode()- Overrides:
hashCodein classAgentConfig
-
toString
- Overrides:
toStringin classAgentConfig
-