AS AgentScopeAPI 手册 / API Reference

ToolRequestConfig

public record ToolRequestConfig( Map<String, SchemaOnlyTool> externalTools, ToolMergeMode mergeMode )
源码Source io/agentscope/core/tool/ToolRequestConfig.java:41–119

承载工具请求配置数据的记录类型。位于 io.agentscope.core.tool 包。核心成员包括 externalTools、mergeMode、ToolRequestConfig、NONE。

Immutable per-call tool request config. Composed (NOT copied) with a shared, stateless Toolkit to produce the tool surface for one call. Never mutates nor copies the shared toolkit.

Produced by any external-tool-injection layer (AG-UI adapter today); #NONE means "use the shared toolkit as-is". #externalTools() are SchemaOnlyTool instances — in this framework an external tool is by definition schema-only (no local implementation), and SchemaOnlyTool carries only a schema (no groupManager/registry back-reference), so they are safe to construct per-call and carry in an immutable request config. The concrete type (Map<String, SchemaOnlyTool> rather than Map<String, AgentTool>) makes "external tool ⇒ schema-only" a compile-time invariant.

Contract: externalTools always take priority over the backend regardless of mergeMode — mergeMode only governs backend visibility (ToolMergeMode#EXTERNAL_ONLY hides the backend without changing the registry). AGENT_ONLY therefore only ever pairs with an empty tool map (that is #NONE); a non-empty externalTools combined with AGENT_ONLY is rejected.

记录组件摘要Record Component Summary

组件Component类型Type说明Description
externalToolsMap<String, SchemaOnlyTool>
执行外部工具相关操作。
Performs the external tools operation.
mergeModeToolMergeMode
合并模式。
Performs the merge mode operation.

字段摘要Field Summary

字段Field类型Type说明Description
NONE
staticfinal
ToolRequestConfig
NONE字段。
Sentinel meaning "use the shared toolkit as-is".

构造器摘要Constructor Summary

构造器Constructor说明Description
public ToolRequestConfig(Map<String, SchemaOnlyTool> externalTools, ToolMergeMode mergeMode)
初始化 `ToolRequestConfig` 实例。
Creates a new instance.

记录组件详情Record Component Detail

externalTools

Map<String, SchemaOnlyTool> externalTools

执行外部工具相关操作。

Performs the external tools operation.

源码Source io/agentscope/core/tool/ToolRequestConfig.java:41–119

mergeMode

ToolMergeMode mergeMode

合并模式。

Performs the merge mode operation.

源码Source io/agentscope/core/tool/ToolRequestConfig.java:41–119

字段详情Field Detail

NONE

public static final ToolRequestConfig NONE
staticfinal

NONE字段。声明为 public static final ToolRequestConfig NONE。

Sentinel meaning "use the shared toolkit as-is".

源码Source io/agentscope/core/tool/ToolRequestConfig.java:49–50

构造器详情Constructor Detail

ToolRequestConfig

public ToolRequestConfig(Map<String, SchemaOnlyTool> externalTools, ToolMergeMode mergeMode)

初始化 ToolRequestConfig 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
externalToolsMap<String, SchemaOnlyTool>外部工具(类型 `Map`)。The external tools.
mergeModeToolMergeModemerge 模式(类型 `ToolMergeMode`)。The merge mode.
源码Source io/agentscope/core/tool/ToolRequestConfig.java:52–80
基于官方固定版本源码静态生成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.