Feature: AG-UI protocol as native gateway endpoint

Đang mở
#768 0 bình luận 3 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

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

Hướng nghiên cứu

Start by reading the existing /a2a gateway endpoint and /v1/chat/completions SSE handling; the issue names no source files or tests. Then map the requested AG-UI request fields and SSE events to the existing streaming flow, including the optional gateway toggle and CORS requirement. Done means POST /ag-ui accepts the described request and emits the corresponding AG-UI events.

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

Mô tả

Summary

Add AG-UI (Agent-UI) protocol support as a native gateway endpoint at POST /ag-ui, similar to the existing /a2a endpoint. AG-UI is a streaming SSE protocol used by platforms like DataRobot, CopilotKit, and others for connecting agent backends to frontend UIs.

Motivation

NullClaw already supports A2A for agent-to-agent communication (#700). AG-UI is the complementary protocol for agent-to-frontend communication. Without native support, users must run a sidecar proxy (~200 lines of Zig) that translates between NullClaw's /v1/chat/completions SSE and AG-UI SSE events. This works but adds unnecessary complexity and an extra process.

We're currently running this exact sidecar in production at DataRobot — a 64KB static Zig binary that translates the protocol. It works well, but the translation is mechanical and would be better handled natively in the gateway.

What AG-UI looks like

POST /ag-ui accepts a JSON body with messages[] (chat history) and threadId, then streams SSE events:

event: RUN_STARTED
data: {"runId":"...","threadId":"..."}

event: TEXT_MESSAGE_START
data: {"messageId":"...","role":"assistant"}

event: TEXT_MESSAGE_CONTENT
data: {"messageId":"...","delta":"Hello"}

event: TEXT_MESSAGE_CONTENT
data: {"messageId":"...","delta":" world"}

event: TEXT_MESSAGE_END
data: {"messageId":"..."}

event: TOOL_CALL_START
data: {"toolCallId":"...","toolCallName":"search_api"}

event: TOOL_CALL_ARGS
data: {"toolCallId":"...","delta":"{\"query\": \"...\"}"}

event: TOOL_CALL_END
data: {"toolCallId":"..."}

event: RUN_FINISHED
data: {"runId":"...","threadId":"..."}

Translation from existing /v1/chat/completions SSE

The mapping is straightforward:

NullClaw chat completion chunk AG-UI event
First chunk with choices[0].delta.role TEXT_MESSAGE_START
choices[0].delta.content TEXT_MESSAGE_CONTENT
choices[0].delta.tool_calls[].function.name TOOL_CALL_START
choices[0].delta.tool_calls[].function.arguments TOOL_CALL_ARGS
choices[0].finish_reason == "tool_calls" TOOL_CALL_END
choices[0].finish_reason == "stop" TEXT_MESSAGE_END + RUN_FINISHED

Proposed implementation

Add AG-UI as a gateway endpoint alongside the existing ones:

/health          — existing
/webhook         — existing  
/a2a             — existing (agent-to-agent)
/ag-ui           — NEW (agent-to-frontend)
/v1/chat/completions — existing

The implementation would:

  1. Parse the AG-UI request body → extract messages + threadId
  2. Forward as a /v1/chat/completions request internally (streaming)
  3. Translate the streaming chunks to AG-UI SSE events
  4. Include CORS headers (AG-UI clients are typically browser-based)

Config could reuse the existing gateway config with an optional toggle:

{
  "gateway": {
    "ag_ui": true
  }
}

Reference

Why this fits NullClaw

NullClaw already has the best multi-protocol gateway story (A2A, MCP client, 19 channels, OpenAI-compatible API). AG-UI is the missing piece for frontend integration. Adding it natively would make NullClaw a complete drop-in backend for any AI-powered UI.

Ngôn ngữ chính
Zig
Star
8.1k
Fork
945
Merge trung bình
7 giờ 13 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nullclaw/nullclaw

Tất cả issue của nullclaw/nullclaw

Issue tương tự

Thêm issue về Backend & API Design

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.