a2ui-project / a2ui-project/a2ui

[FEATURE]: Ability for Agent to do append-only content generation without managing surfaces and surfaceIds

Đang mở
#1,979 2 bình luận 0 reaction 1 người được giao Được @gspencergoog nhận Xem trên GitHub
P2
Ngôn ngữ chính
TypeScript
Star
16.4k
Fork
1.3k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
134

Mô tả

One source of errors that we've always had with Gen UI and A2UI is when agents don't manage surface IDs correctly, e.g. they create duplicate surfaces or forget to create surfaces at all.

In the most common Gen UI use cases, the agent is just generating content as part of a turn, and never needs to update that content, so there is no need for it to write, read or reason about surface IDs. We should have some well-lit path (even a default!) which makes it this way.

This would eliminate this class of errors, and reduce latency by reducing the output tokens necessary to express a layout.

## Option 1: Hide `surfaceId` from LLM and programmatically inject surface IDs instead

We make it so that the inference format doesn't have any concept of `CreateSurface`. Instead, the LLM just defines components and then we automatically add a `CreateSurface` message.
- The inference APIs need some concept of "parse session" or "turn" etc, so that they know when to inject a new `CreateSurface` message with a surfaceId, and then add that surfaceId to all subsequent updateDataModel and updateComponents messages. We probably need this anyway, to help with validation.
- We can just use UUIDs etc for surfaceId
- This could be an option in the Express inference format etc, for chat use cases. Perhaps a boolean config like `manageSurfacesAutomatically`.

## Option 2: One MessageProcessor per Turn

We could recommend an integration approach where each turn in a conversation has a separate message processor handling the messages for it.

On the agent, we prompt it to just create a surface with any ID, or use option 1) above to inject some arbitrary surface ID so the LLM doesn't need to express it.

There are never surface ID conflicts, because each Turn now has a separate surface ID space. The downside is that the server does not have any ability to update surfaces on previous turns, because new content is always fed to a brand new `MessageProcessor`. But this is fine, and better, for most chat-based use cases.

## Recommendation

I think we should do option 1 first, because it is simpler to set up for the developer, and it's a nice step towards 2) anyway.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

The issue describes modifying the inference format and APIs to automatically manage surface IDs. Start by examining the Express inference format and the message processor logic to understand where `CreateSurface` messages are generated. Look for existing validation or session/turn management code. The goal is to add a configuration option like `manageSurfacesAutomatically` that injects surface IDs and removes the need for the LLM to handle them.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
backend-api-design
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.