AS AgentScopeAPI 手册 / API Reference

ThinkingBlock

public final class ThinkingBlock extends ContentBlock
源码Source io/agentscope/core/message/ThinkingBlock.java:37–133

Thinking 块,在智能体、模型与前端之间传递结构化消息和事件。位于 io.agentscope.core.message 包,继承自 ContentBlock。核心成员包括 getThinking、getMetadata、builder、METADATA_REASONING_DETAILS。

Represents reasoning or thinking content in a message.

This content block is used to capture the internal reasoning process of an agent before taking action. It provides transparency into how the agent arrived at its decisions or tool choices.

Thinking blocks are particularly useful in ReAct agents and other reasoning-intensive systems where understanding the agent's thought process is valuable for debugging and analysis.

The optional metadata field can store additional reasoning information such as OpenRouter's reasoning_details (reasoning.text, reasoning.encrypted, reasoning.summary) that need to be preserved and restored when formatting messages back to the API.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
构建器,用于构建并配置目标实例。
Builder for constructing ThinkingBlock instances.

字段摘要Field Summary

字段Field类型Type说明Description
METADATA_REASONING_DETAILS
staticfinal
String
元数据推理详情字段。
Metadata key for storing OpenRouter/Gemini reasoning details list.

方法摘要Method Summary

方法Method说明Description
public String getThinking()
获取 `getThinking`。
Gets the thinking/reasoning content of this block.
public Map<String, Object> getMetadata()
获取元数据。
Gets the metadata associated with this thinking block.
public static Builder builder()
static
返回构建器实例。
Creates a new builder for constructing ThinkingBlock instances.

字段详情Field Detail

METADATA_REASONING_DETAILS

public static final String METADATA_REASONING_DETAILS
staticfinal

元数据推理详情字段。声明为 public static final String METADATA_REASONING_DETAILS。

Metadata key for storing OpenRouter/Gemini reasoning details list.

源码Source io/agentscope/core/message/ThinkingBlock.java:40

方法详情Method Detail

getThinking

public String getThinking()

获取 getThinking。

Gets the thinking/reasoning content of this block.

返回Returns String
返回字符串结果。The thinking content
源码Source io/agentscope/core/message/ThinkingBlock.java:64–66

getMetadata

public Map<String, Object> getMetadata()

获取元数据。

Gets the metadata associated with this thinking block.

返回Returns Map<String, Object>
返回映射。The metadata map, or null if no metadata is set
源码Source io/agentscope/core/message/ThinkingBlock.java:80–82

builder

public static Builder builder()
static

返回构建器实例。

Creates a new builder for constructing ThinkingBlock instances.

返回Returns Builder
一种新的构建器实例。A new builder instance
源码Source io/agentscope/core/message/ThinkingBlock.java:89–91

嵌套类详情Nested Class Detail

Builder

public static class Builder

构建器,用于构建并配置目标实例。位于 io.agentscope.core.message 包。核心成员包括 thinking、metadata、build。

Builder for constructing ThinkingBlock instances.

基于官方固定版本源码静态生成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.