Class RuntimeAgentConfig

java.lang.Object
io.agentscope.extensions.scheduler.config.AgentConfig
io.agentscope.extensions.scheduler.config.RuntimeAgentConfig

public class RuntimeAgentConfig extends AgentConfig
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:
  • Method Details

    • builder

      public static RuntimeAgentConfig.Builder 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

      public List<io.agentscope.core.hook.Hook> 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

      public boolean equals(Object o)
      Overrides:
      equals in class AgentConfig
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AgentConfig
    • toString

      public String toString()
      Overrides:
      toString in class AgentConfig