ExecutionConfig
public class ExecutionConfig
io/agentscope/core/model/ExecutionConfig.java:54–388用于超时和重试行为的统一执行配置。位于 io.agentscope.core.model 包。核心成员包括 getTimeout、getMaxAttempts、getInitialBackoff、getMaxBackoff、getBackoffMultiplier、getRetryOn。
Unified execution configuration for timeout and retry behavior.
This class replaces the previous TimeoutConfig and RetryConfig classes, providing a single unified configuration for controlling execution behavior of both model API calls and tool executions.
Use the builder pattern to construct instances. All fields are optional and nullable.
Standard Defaults
-
#MODEL_DEFAULTS: 5 minutes timeout, 3 retry attempts with exponential backoff -
#TOOL_DEFAULTS: 5 minutes timeout, no retry (1 attempt only)
Configuration Merging
Use #mergeConfigs(ExecutionConfig, ExecutionConfig) to combine configurations with
parameter-by-parameter precedence. This allows layering configs from different sources:
`// Priority: per-request > agent-level > component-defaults > system-defaults
ExecutionConfig effective = ExecutionConfig.mergeConfigs(
perRequestConfig,
ExecutionConfig.mergeConfigs(agentConfig, ExecutionConfig.MODEL_DEFAULTS)
);
`
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | ExecutionConfig的构建器。 Builder for ExecutionConfig. |
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
RETRYABLE_ERRORSstaticfinal | Predicate<Throwable> | RETRYABLE 错误字段。 Predicate that determines if an error should be retried. |
MODEL_DEFAULTSstaticfinal | ExecutionConfig | 模型 DEFAULTS字段。 Standard defaults for model API calls. |
TOOL_DEFAULTSstaticfinal | ExecutionConfig | 工具 DEFAULTS字段。 Standard defaults for tool executions. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Duration getTimeout() | 获取超时时长。 Gets the timeout duration. |
public Integer getMaxAttempts() | 获取最大尝试次数。 Gets the maximum number of attempts. |
public Duration getInitialBackoff() | 获取 `getInitialBackoff`。 Gets the initial backoff duration. |
public Duration getMaxBackoff() | 获取最大退避。 Gets the maximum backoff duration. |
public Double getBackoffMultiplier() | 获取 `getBackoffMultiplier`。 Gets the backoff multiplier. |
public Predicate<Throwable> getRetryOn() | 获取重试 On。 Gets the retry predicate. |
public static Builder builder()static | 创建新的构建器用于 ExecutionConfig。 Creates a new builder for ExecutionConfig. |
public static ExecutionConfig mergeConfigs(ExecutionConfig primary, ExecutionConfig fallback)static | 合并 `mergeConfigs`。 Merges two ExecutionConfig instances, with primary config taking precedence. |
字段详情Field Detail
RETRYABLE_ERRORS
public static final Predicate<Throwable> RETRYABLE_ERRORS
RETRYABLE 错误字段。声明为 public static final Predicate RETRYABLE_ERRORS。
Predicate that determines if an error should be retried.
io/agentscope/core/model/ExecutionConfig.java:91MODEL_DEFAULTS
public static final ExecutionConfig MODEL_DEFAULTS
模型 DEFAULTS字段。声明为 public static final ExecutionConfig MODEL_DEFAULTS。
Standard defaults for model API calls.
io/agentscope/core/model/ExecutionConfig.java:145–153TOOL_DEFAULTS
public static final ExecutionConfig TOOL_DEFAULTS
工具 DEFAULTS字段。声明为 public static final ExecutionConfig TOOL_DEFAULTS。
Standard defaults for tool executions.
io/agentscope/core/model/ExecutionConfig.java:163–164方法详情Method Detail
getTimeout
public Duration getTimeout()
获取超时时长。
Gets the timeout duration.
Durationio/agentscope/core/model/ExecutionConfig.java:180–182getMaxAttempts
public Integer getMaxAttempts()
获取最大尝试次数。
Gets the maximum number of attempts.
Integerio/agentscope/core/model/ExecutionConfig.java:189–191getInitialBackoff
public Duration getInitialBackoff()
获取 getInitialBackoff。
Gets the initial backoff duration.
Durationio/agentscope/core/model/ExecutionConfig.java:198–200getMaxBackoff
public Duration getMaxBackoff()
获取最大退避。
Gets the maximum backoff duration.
Durationio/agentscope/core/model/ExecutionConfig.java:207–209getBackoffMultiplier
public Double getBackoffMultiplier()
获取 getBackoffMultiplier。
Gets the backoff multiplier.
Doubleio/agentscope/core/model/ExecutionConfig.java:216–218getRetryOn
public Predicate<Throwable> getRetryOn()
获取重试 On。
Gets the retry predicate.
Predicate<Throwable>io/agentscope/core/model/ExecutionConfig.java:225–227builder
public static Builder builder()
创建新的构建器用于 ExecutionConfig。
Creates a new builder for ExecutionConfig.
Builderio/agentscope/core/model/ExecutionConfig.java:234–236mergeConfigs
public static ExecutionConfig mergeConfigs(ExecutionConfig primary, ExecutionConfig fallback)
合并 mergeConfigs。
Merges two ExecutionConfig instances, with primary config taking precedence.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
primary | ExecutionConfig | primary(类型 `ExecutionConfig`)。the primary config (higher priority) |
fallback | ExecutionConfig | 回退(类型 `ExecutionConfig`)。the fallback config (lower priority) |
ExecutionConfigio/agentscope/core/model/ExecutionConfig.java:269–291嵌套类详情Nested Class Detail
Builder
public static class BuilderExecutionConfig的构建器。位于 io.agentscope.core.model 包。核心成员包括 timeout、maxAttempts、initialBackoff、maxBackoff、backoffMultiplier、retryOn。
Builder for ExecutionConfig.