AS AgentScopeAPI 手册 / API Reference

ExecutionConfig

public class ExecutionConfig
源码Source 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_ERRORS
staticfinal
Predicate<Throwable>
RETRYABLE 错误字段。
Predicate that determines if an error should be retried.
MODEL_DEFAULTS
staticfinal
ExecutionConfig
模型 DEFAULTS字段。
Standard defaults for model API calls.
TOOL_DEFAULTS
staticfinal
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
staticfinal

RETRYABLE 错误字段。声明为 public static final Predicate RETRYABLE_ERRORS。

Predicate that determines if an error should be retried.

源码Source io/agentscope/core/model/ExecutionConfig.java:91

MODEL_DEFAULTS

public static final ExecutionConfig MODEL_DEFAULTS
staticfinal

模型 DEFAULTS字段。声明为 public static final ExecutionConfig MODEL_DEFAULTS。

Standard defaults for model API calls.

源码Source io/agentscope/core/model/ExecutionConfig.java:145–153

TOOL_DEFAULTS

public static final ExecutionConfig TOOL_DEFAULTS
staticfinal

工具 DEFAULTS字段。声明为 public static final ExecutionConfig TOOL_DEFAULTS。

Standard defaults for tool executions.

源码Source io/agentscope/core/model/ExecutionConfig.java:163–164

方法详情Method Detail

getTimeout

public Duration getTimeout()

获取超时时长。

Gets the timeout duration.

返回Returns Duration
返回时长。the timeout duration, or null if not set
源码Source io/agentscope/core/model/ExecutionConfig.java:180–182

getMaxAttempts

public Integer getMaxAttempts()

获取最大尝试次数。

Gets the maximum number of attempts.

返回Returns Integer
返回数值结果。the max attempts (including initial attempt), or null if not set
源码Source io/agentscope/core/model/ExecutionConfig.java:189–191

getInitialBackoff

public Duration getInitialBackoff()

获取 getInitialBackoff。

Gets the initial backoff duration.

返回Returns Duration
返回时长。the initial backoff duration, or null if not set
源码Source io/agentscope/core/model/ExecutionConfig.java:198–200

getMaxBackoff

public Duration getMaxBackoff()

获取最大退避。

Gets the maximum backoff duration.

返回Returns Duration
返回时长。the max backoff duration, or null if not set
源码Source io/agentscope/core/model/ExecutionConfig.java:207–209

getBackoffMultiplier

public Double getBackoffMultiplier()

获取 getBackoffMultiplier。

Gets the backoff multiplier.

返回Returns Double
返回数值结果。the backoff multiplier, or null if not set
源码Source io/agentscope/core/model/ExecutionConfig.java:216–218

getRetryOn

public Predicate<Throwable> getRetryOn()

获取重试 On。

Gets the retry predicate.

返回Returns Predicate<Throwable>
返回Predicate。the predicate to determine if an error should be retried, or null if not set
源码Source io/agentscope/core/model/ExecutionConfig.java:225–227

builder

public static Builder builder()
static

创建新的构建器用于 ExecutionConfig。

Creates a new builder for ExecutionConfig.

返回Returns Builder
一种新的构建器实例。a new Builder instance
源码Source io/agentscope/core/model/ExecutionConfig.java:234–236

mergeConfigs

public static ExecutionConfig mergeConfigs(ExecutionConfig primary, ExecutionConfig fallback)
static

合并 mergeConfigs。

Merges two ExecutionConfig instances, with primary config taking precedence.

参数Parameters
名称Name类型Type说明Description
primaryExecutionConfigprimary(类型 `ExecutionConfig`)。the primary config (higher priority)
fallbackExecutionConfig回退(类型 `ExecutionConfig`)。the fallback config (lower priority)
返回Returns ExecutionConfig
返回ExecutionConfig。merged config, or null if both are null
源码Source io/agentscope/core/model/ExecutionConfig.java:269–291

嵌套类详情Nested Class Detail

Builder

public static class Builder

ExecutionConfig的构建器。位于 io.agentscope.core.model 包。核心成员包括 timeout、maxAttempts、initialBackoff、maxBackoff、backoffMultiplier、retryOn。

Builder for ExecutionConfig.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.