AS AgentScopeAPI 手册 / API Reference

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
msgMsg消息到观察。The message to observe
返回Returns Mono<Void>
返回Mono。Mono that completes when observation is done
源码Source io/agentscope/core/agent/ObservableAgent.java:44

observe

public Mono<Void> observe(List<Msg> msgs)

接收外部观察消息并写入上下文。

Observe multiple messages without generating a reply.

参数Parameters
名称Name类型Type说明Description
msgsList<Msg>消息到观察。The messages to observe
返回Returns Mono<Void>
返回Mono。Mono that completes when all observations are done
源码Source io/agentscope/core/agent/ObservableAgent.java:52
基于官方固定版本源码静态生成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.