ObservableAgent
public interface ObservableAgent
源码Source
io/agentscope/core/agent/ObservableAgent.java:36–53定义 Observable 智能体契约的接口。位于 io.agentscope.core.agent 包。核心成员包括 observe。
Interface for agents that can observe messages without generating replies.
This interface enables agents to receive and process messages from other agents or the environment without responding. It's commonly used in multi-agent collaboration scenarios where agents need to be aware of each other's actions.
Use cases include:
-
Passive monitoring of conversation flow
-
Building shared context in multi-agent systems
-
Implementing observer patterns in agent pipelines
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Mono<Void> observe(Msg msg) | 接收外部观察消息并写入上下文。 Observe a single message without generating a reply. |
public Mono<Void> observe(List<Msg> msgs) | 接收外部观察消息并写入上下文。 Observe multiple messages without generating a reply. |
方法详情Method Detail
observe
public Mono<Void> observe(Msg msg)
接收外部观察消息并写入上下文。
Observe a single message without generating a reply.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息到观察。The message to observe |
Mono<Void>返回Mono。Mono that completes when observation is done
源码Source
io/agentscope/core/agent/ObservableAgent.java:44observe
public Mono<Void> observe(List<Msg> msgs)
接收外部观察消息并写入上下文。
Observe multiple messages without generating a reply.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息到观察。The messages to observe |
Mono<Void>返回Mono。Mono that completes when all observations are done
源码Source
io/agentscope/core/agent/ObservableAgent.java:52