AS AgentScopeAPI 手册 / API Reference

StreamAdapter

public interface StreamAdapter
源码Source io/agentscope/runtime/adapters/StreamAdapter.java:41–55

定义流适配器契约的接口。位于 io.agentscope.runtime.adapters 包。核心成员包括 adaptFrameworkStream。

StreamAdapter interface provides a unified abstraction for converting streaming events between framework-specific formats and runtime Event streams.

This interface is designed to adapt different Agent Framework streaming event types (e.g., AgentScope Event, AutoGen streaming events, etc.) to runtime Event streams. The returned stream can contain both Message and Content objects, as both inherit from Event.

has a return type of AsyncIterator[Message] but actually yields both Message and Content objects.

Implementations should handle:

  • Converting framework-specific event streams to runtime Event streams

  • Handling reactive streaming models using Flux

  • Preserving streaming state (in-progress, completed) in the converted events

  • Yielding both Message and Content objects as needed for incremental updates

方法摘要Method Summary

方法Method说明Description
public Flux<Event> adaptFrameworkStream(Object sourceStream)
设置该参数。
Adapts framework-specific event stream to runtime Event stream.

方法详情Method Detail

adaptFrameworkStream

public Flux<Event> adaptFrameworkStream(Object sourceStream)

设置该参数。

Adapts framework-specific event stream to runtime Event stream.

参数Parameters
名称Name类型Type说明Description
sourceStreamObject来源流(类型 `Object`)。Framework-specific event stream (type depends on framework)
返回Returns Flux<Event>
返回Flux。Flux of runtime Event objects (Message or Content)
源码Source io/agentscope/runtime/adapters/StreamAdapter.java:53
基于官方固定版本源码静态生成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.