ag-ui-protocol / ag-ui-protocol/ag-ui

[Feature]: Add messageFilter to AgentConfig

オープン
#2,062 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Python
スター
15.9k
フォーク
1.4k
平均マージ
1日 17時間
マージ済み PR(30日)
163

説明

### Pre-flight Checklist

- [x] I have searched existing issues and this hasn't been requested yet.

### Problem or Motivation

When a backend already holds conversation history in memory, there's no way to control which messages get forwarded on each run. The full history is always sent even when only the latest user message is needed.

### Proposed Solution

Add an optional `messageFilter` callback to `AgentConfig`:

```ts
messageFilter?: (messages: Message[]) => Message[]
```

Applied in `prepareRunAgentInput` after stripping `activity` messages, before the input is sent. Stored messages stay untouched. No-op when not set.

### Alternatives Considered

Patching `window.fetch` to strip messages before the request. It works but is hacky and fragile.

### Additional Context

Came up practically in CopilotKit/CopilotKit#1482. I have a working implementation ready.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。