RuntimeAgentConfig
public class RuntimeAgentConfig extends AgentConfig
io/agentscope/extensions/scheduler/config/RuntimeAgentConfig.java:75–253运行时智能体配置,保存相关配置项。位于 io.agentscope.extensions.scheduler.config 包,继承自 AgentConfig。核心成员包括 builder、getToolkit、getHooks、getModel、equals、hashCode。
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
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | 构建器,用于构建并配置目标实例。 Builder for creating RuntimeAgentConfig instances. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static Builder builder()static | 创建新的构建器实例。 Create a new builder instance. |
public Toolkit getToolkit() | 获取工具包。 Get the toolkit. |
public List<Hook> getHooks() | 获取 `getHooks`。 Get the hooks. |
public Model getModel() | 获取模型。 Get the pre-created Model instance. |
public boolean equals(Object o) | 设置该参数。 Performs the equals operation. |
public int hashCode() | 返回 `hashCode` 结果。 Returns the hash code. |
public String toString() | 返回 `toString` 结果。 Returns the to string. |
方法详情Method Detail
builder
public static Builder builder()
创建新的构建器实例。
Create a new builder instance.
Builderio/agentscope/extensions/scheduler/config/RuntimeAgentConfig.java:93–95getToolkit
public Toolkit getToolkit()
获取工具包。
Get the toolkit.
Toolkitio/agentscope/extensions/scheduler/config/RuntimeAgentConfig.java:102–104getHooks
public List<Hook> getHooks()
获取 getHooks。
Get the hooks.
List<Hook>io/agentscope/extensions/scheduler/config/RuntimeAgentConfig.java:111–113getModel
public Model getModel()
获取模型。
Get the pre-created Model instance.
Modelio/agentscope/extensions/scheduler/config/RuntimeAgentConfig.java:123–125equals
public boolean equals(Object o)
设置该参数。
Performs the equals operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
o | Object | o(类型 `Object`)。The o. |
booleanio/agentscope/extensions/scheduler/config/RuntimeAgentConfig.java:127–136hashCode
public int hashCode()
返回 hashCode 结果。
Returns the hash code.
intio/agentscope/extensions/scheduler/config/RuntimeAgentConfig.java:138–141toString
public String toString()
返回 toString 结果。
Returns the to string.
Stringio/agentscope/extensions/scheduler/config/RuntimeAgentConfig.java:143–161嵌套类详情Nested Class Detail
Builder
public static class Builder extends AgentConfig.Builder构建器,用于构建并配置目标实例。位于 io.agentscope.extensions.scheduler.config 包,继承自 AgentConfig.Builder。核心成员包括 name、modelConfig、sysPrompt、toolkit、hooks、build。
Builder for creating RuntimeAgentConfig instances.