- AG-UI Agent๋ ์์ฒญ์ ์ฒ๋ฆฌํ๊ณ ์ด๋ฒคํธ ์คํธ๋ฆผ์ผ๋ก ์๋ต์ ์์ฑํ๋ AG-UI ํ๋กํ ์ฝ์ ์คํ ๋จ์
- LLM/RAG/๋ฉํฐ ์์ด์ ํธ ๋ฑ ์ด๋ค AI ์์คํ ๋ ๋์ผ ์ธํฐํ์ด์ค๋ก ์ถ์ํํ๋ ๋ฒค๋ ์ค๋ฆฝ ์ปดํฌ๋ํธ
- AbstractAgent ๊ณ์ฝ์ ๋ฐ๋ฅด๋ ํ์คํ๋ ๊ตฌ์ฒด ๊ตฌํ์ฒด
- ๋ฉ์์งยท์ํยท๋๊ตฌยท๊ธฐ์ตยท๋ฉํ๋ฐ์ดํฐ๋ฅผ ํ ๋จ์๋ก ๋ฌถ์ ํฉ์ฑ ์ถ์ํ (compound abstraction)
ํด๋น ๊ฐ๋ ์ด ํ์ํ ์ด์
- ๋ค์ํ AI ๋ฐฑ์๋(LangGraph, CrewAI, Mastraโฆ)๋ฅผ ๋์ผํ UI์์ ์ฐ๊ฒฐํ ํ์ค ๋จ์ ๋ถ์ฌ ํด๊ฒฐ
- LLM ํธ์ถ์ stateless์ด์ง๋ง ์ค์ ์ฌ์ฉ์ ๊ฒฝํ์ ๋ํยท์ํยท๋๊ตฌยท๊ธฐ์ต์ ๋์ ์ ์๊ตฌ
- Multi-Agent, HITL, Reasoning ํ์ ๋ฑ ๊ณ ์ฐจ ์ํฌํ๋ก์ฐ๋ฅผ ๋จ์ผ ํ์ค ๋ชจ๋ธ๋ก ํํ ํ์
AS-IS โ ํน์ AI ์๋น์ค์ ์ง์ ๋ฌถ์ธ ์ฝ๋
sequenceDiagram autonumber participant UI as Frontend participant SVC as Specific AI Service UI->>SVC: ๋ฒค๋ ์ ์ฉ ์์ฒญ SVC-->>UI: ๋ฒค๋ ์ ์ฉ ์๋ต Note over UI,SVC: ๋ฐฑ์๋ ๊ต์ฒด ์<br/>UI ์ ์ฒด ์์ ํ์<br/>๋๊ตฌยท์ํยท๊ธฐ์ต ๋ณ๋ ๊ตฌํ
TO-BE โ Agent ์ถ์ํ๋ก ์บก์ํ
sequenceDiagram autonumber participant UI as Frontend participant Agent as "AG-UI Agent (AbstractAgent)" participant Any as Any AI System UI->>Agent: runAgent(input) Agent->>Any: ๋ด๋ถ ์์ (LLM/RAG/Multi-Agent...) Any-->>Agent: ๊ฒฐ๊ณผ Agent-->>UI: BaseEvent ์คํธ๋ฆผ Note over Agent: ๋ฉ์์งยท์ํยท๋๊ตฌยท๊ธฐ์ต<br/>ํ์ค ์ธํฐํ์ด์ค๋ก ๋ ธ์ถ
Agent์ ์ ์ฒด์ฑ โ ๋จ์ LLM ํธ์ถ์ด ์๋ ์ด์
Agent๋ LLM ํธ์ถ ํจ์๊ฐ ์๋๋ผ ์ฌ๋ฌ ๋ฅ๋ ฅ์ ๋ฌถ์ ํฉ์ฑ ์ถ์ํ๋ค.
| ์ฐจ์ | LLM ํธ์ถ | AG-UI Agent |
|---|---|---|
| ์ ์ถ๋ ฅ | prompt โ completion | AG-UI Event ์คํธ๋ฆผ โ ์๋ฐฉํฅ |
| ์ํ | stateless | AG-UI State Management ๋ณด์ |
| ๊ธฐ์ต | ๋งค๋ฒ ์ฌ๊ตฌ์ฑ | AG-UI Messages ์๋ ๋์ |
| ๋๊ตฌ | ํธ์ถ์๊ฐ ๋งค๋ฒ ๊ฒฐํฉ | AG-UI Tools ํ์ค ์ฑ๋ |
| ์๋ณ | ์์ | agentId, threadId, runId |
Agent Type 3๊ฐ์ง
1. AbstractAgent โ ์ถ์ ๋ฒ ์ด์ค
AbstractAgent๋ ๋ชจ๋ ์์ด์ ํธ๊ฐ ๊ตฌํํด์ผ ํ๋ ์ถ์ ํด๋์ค๋ก, run(input) โ Observable<BaseEvent> ๋จ ํ๋์ ๊ณ์ฝ๋ง ๊ฐ์ ํ๋ค. ์ํยท๋ฉ์์งยท์ด๋ฒคํธ ๊ฒ์ฆยท๋ฏธ๋ค์จ์ดยท๊ตฌ๋
์ ์๋ฆผ์ ๋ฒ ์ด์ค ํด๋์ค๊ฐ ์๋ ์ฒ๋ฆฌํ๋ค.
2. HttpAgent โ ํ์ค HTTP ๊ตฌํ์ฒด
AbstractAgent๋ฅผ ์์ํ๋ ํด๋ผ์ด์ธํธ ์ธก ๊ตฌ์ฒด ๊ตฌํ์ผ๋ก, ์๊ฒฉ AG-UI ํธํ ์๋ํฌ์ธํธ์ SSE/Binary ํ๋กํ ์ฝ๋ก ํต์ ํ๋ค. Frontend์์ ๊ฐ์ฅ ํํ ์ฌ์ฉ๋๋ค.
const agent = new HttpAgent({
url: "https://your-agent-endpoint.com/agent",
headers: { Authorization: "Bearer your-api-key" },
})3. Custom Agent โ ์ง์ ๊ตฌํ
AbstractAgent๋ฅผ ์์ํด ์์์ AI ์์คํ (์์ฒด LLM, RAG ํ์ดํ๋ผ์ธ, ๋ฉํฐ ์์ด์ ํธ ์ปจํธ๋กค๋ฌ)๊ณผ ๊ฒฐํฉ ๊ฐ๋ฅํ๋ค.
Agent Capabilities 7๊ฐ์ง
๊ณต์ ๋ฌธ์๊ฐ ์ ์ํ๋ Agent์ 7๊ฐ์ง ๋ฅ๋ ฅ ์นดํ๋ก๊ทธ. ๊ฐ ๋ฅ๋ ฅ์ ๋ณ๋ ์ปดํฌ๋ํธ๋ก ๋ถํด๋๋ค.
1. Interactive Communication
์ค์๊ฐ ์๋ฐฉํฅ ์คํธ๋ฆผ. ์์ธ๋ AG-UI Event ์ฐธ์กฐ.
2. Tool Usage
Frontend๊ฐ ์ ์ํ๊ณ Agent๊ฐ ํธ์ถํ๋ ํ์ค ํจ์ ์ธํฐํ์ด์ค. ์์ธ๋ AG-UI Tools ์ฐธ์กฐ. CopilotKit์ useCopilotAction ํ
์ด React์์ ์ด ํจํด์ ๋จ์ํํ ๋ํ ์ฌ๋ก.
3. State Management
๊ตฌ์กฐํ๋ ๊ณต์ ์ํ๋ฅผ STATE_SNAPSHOT / STATE_DELTA๋ก ๋๊ธฐํ. ์์ธ๋ AG-UI State Management ์ฐธ์กฐ.
4. Multi-Agent Collaboration
Agent ๊ฐ ์์ ์์(handoff)ยทํ์ ์ด ํ๋กํ ์ฝ ์ฐจ์์์ ๊ฐ๋ฅํ๋ค. ๋จ, ๋๊ฐ ๋ผ์ฐํ ์ ๊ฒฐ์ ํ๋๊ฐ(=orchestration ์ฃผ์ฒด)๋ AG-UI๊ฐ ๊ฐ์ ํ์ง ์๋๋ค. ํ๋กํ ์ฝ์ ๊ฒฐ๊ณผ ์ด๋ฒคํธ ์คํธ๋ฆผ ํฌ๋งท๋ง ํ์คํํ๊ณ , orchestration์ ์ฌ์ฉ ์๋๋ฆฌ์ค์ ๋ฐ๋ผ 4๊ฐ์ง ํจํด ์ค ํ๋๊ฐ ๋ด๋นํ๋ค.
| Orchestration ํจํด | ์ฃผ์ฒด | ๋ํ ์ฌ๋ก |
|---|---|---|
| Supervisor Agent | ๊ฐ๋ ์ญํ ์ ์์ด์ ํธ๊ฐ ํ์ ์์ด์ ํธ๋ฅผ ๋ผ์ฐํ | LangGraph supervisor, CrewAI manager |
| Workflow Engine | ํ๋ ์์ํฌ๊ฐ ์ ์ํ ๊ทธ๋ํ/DAG๊ฐ ์๋ ์ ์ด | LangGraph state graph |
| Frontend Router | UI๊ฐ ์๋ยท๋๋ฉ์ธ์ ๋ถ์ํด ์ ์ ํ ์์ด์ ํธ ์ ํ | CopilotKit selfManagedAgents ๋ถ๊ธฐ |
| Peer-to-peer Handoff | ์์ด์ ํธ๊ฐ ์ง์ ๋ค๋ฅธ ์์ด์ ํธ๋ก ์์ | OpenAI Swarm ์คํ์ผ ์ง์ handoff |
3๊ฐ ์์ด์ ํธ๊ฐ ํ์ ํ๋ Supervisor ํจํด ์์:
sequenceDiagram autonumber participant UI as Frontend participant SUP as Supervisor Agent<br/>(orchestrator) participant CA as Coding Agent participant RA as Research Agent participant DOC as Doc Writer Agent UI->>SUP: "์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์กฐ์ฌ ํ<br/>์ํ ์ฝ๋ ์ง๊ณ ๋ฌธ์ํํด์ค" Note over SUP: ์๋ ๋ถ์ โ ์์ ๋ถํด<br/>์คํ ๊ณํ ์๋ฆฝ SUP->>RA: ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์กฐ์ฌ ์์ (state + messages) RA-->>SUP: ์กฐ์ฌ ๊ฒฐ๊ณผ (state ๊ฐฑ์ ) SUP->>CA: ์ํ ์ฝ๋ ์์ฑ ์์ (์กฐ์ฌ ๊ฒฐ๊ณผ ์ปจํ ์คํธ ํฌํจ) CA-->>SUP: ์ฝ๋ + tool call ๊ฒฐ๊ณผ SUP->>DOC: ๋ฌธ์ํ ์์ (์ฝ๋ + ์กฐ์ฌ ๊ฒฐ๊ณผ) DOC-->>UI: TEXT_MESSAGE ์คํธ๋ฆผ Note over UI: ์์ด์ ํธ ์ ํ์ ํฌ๋ช <br/>๋ํยท์ํ ์ฐ์์ฑ ์ ์ง
ํต์ฌ ์์ฑ:
- ์์ ์ ์ ๋ฌธ ์์ด์ ํธ๋ก ์์ ๊ฐ๋ฅ (์ญํ ๋ถ๋ฆฌ)
- ์ํ์ ์ปจํ ์คํธ๊ฐ ์์ด์ ํธ ๊ฐ ์ด์ ๋จ (handoff)
- Orchestration ์ฃผ์ฒด๋ ํ๋กํ ์ฝ ์ธ๋ถ์์ ๊ฒฐ์ (AG-UI๋ ๊ฒฐ๊ณผ ์คํธ๋ฆผ๋ง ๊ท์ )
- Frontend๋ ์์ด์ ํธ ์ ํ ์ค์๋ ์ผ๊ด๋ ๊ฒฝํ ์ ๊ณต
5. Human-in-the-Loop
์คํ ์ค ์ฌ์ฉ์ ๊ฐ์ (์น์ธยท์์ ยท๊ฑฐ์ ). ์์ธ๋ Human-in-the-Loop ์ฐธ์กฐ.
6. Conversational Memory
๋ํ ์ด๋ ฅ์ ์๋ ๋์ ยท๋๊ธฐํ. ์์ธ๋ AG-UI Messages ์ฐธ์กฐ.
7. Metadata & Instrumentation
Agent๊ฐ ์์ ์ ๋ด๋ถ ์ฒ๋ฆฌ ๊ณผ์ ์ ๋ํ ๋ฉํ๋ฐ์ดํฐ๋ฅผ emitํด Frontend๊ฐ ํฌ๋ช ์ฑ์ ์ ๊ณตํ ์ ์๊ฒ ํ๋ค.
| ์ข ๋ฅ | ์ฉ๋ | ํ์ ์์ |
|---|---|---|
| Reasoning steps | ์ฌ๊ณ ํ๋ฆ ๋ ธ์ถ | โThinkingโฆโ ํจ๋ |
| Performance metrics | ์คํ ์๊ฐ/ํ ํฐ ์ฌ์ฉ๋ | ๋๋ฒ๊ทธ ์ค๋ฒ๋ ์ด |
| Source citations | ์ฐธ์กฐ ๋ฌธํยท์ถ์ฒ | ์ธ๋ผ์ธ ๊ฐ์ฃผ |
| Confidence scores | ์๋ต๋ณ ํ์ ๋ | ์์ ๊ฐ๋ |
sequenceDiagram autonumber participant Agent participant UI Agent-->>UI: REASONING_START Agent-->>UI: REASONING_CONTENT (์ฌ๊ณ ๊ณผ์ ํ ์คํธ) Agent-->>UI: REASONING_END Agent-->>UI: TEXT_MESSAGE_START Agent-->>UI: TEXT_MESSAGE_CONTENT (citation ๋ฉํ ํฌํจ) Agent-->>UI: TEXT_MESSAGE_END Note over UI: ์ฌ๊ณ ๊ณผ์ ๊ณผ ์ต์ข ๋ต๋ณ์<br/>๋ถ๋ฆฌํด ๋ ๋
Agent Configuration
Agent ์ธ์คํด์ค๋ AgentConfig๋ฅผ ํตํด ์ ์ฒด์ฑยท์ด๊ธฐ ์ํ๋ฅผ ์ฃผ์
๋ฐ๋๋ค.
interface AgentConfig {
agentId?: string // ์์ด์ ํธ ์๋ณ์
description?: string // ์ฌ๋์ด ์ฝ๋ ์ค๋ช
(multi-agent ๋ผ์ฐํ
์ ํ์ฉ)
threadId?: string // ๋ํ ์ธ์
์๋ณ์
initialMessages?: Message[] // ์ด๊ธฐ ๋ฉ์์ง (system prompt ๋ฑ)
initialState?: State // ์ด๊ธฐ ๊ณต์ ์ํ
}
const agent = new HttpAgent({
agentId: "my-agent-123",
description: "A helpful assistant",
threadId: "thread-456",
initialMessages: [
{ id: "1", role: "system", content: "You are a helpful assistant." },
],
initialState: { preferredLanguage: "English" },
})์ค์ ํ๋์ ์ญํ ๋ถ๋ด:
| ํ๋ | ์ญํ | ๋น๊ณ |
|---|---|---|
agentId | ์์ด์ ํธ ์๋ณ | Multi-agent ๋ผ์ฐํ ํค |
description | ๋ฅ๋ ฅยท์ญํ ๋ฉํ์ ๋ณด | Handoff ๊ฒฐ์ ์ ํ์ฉ |
threadId | ๋ํ ์ธ์ ์๋ณ | AbstractAgent์์ ์๋ ์์ฑ๋ ๊ฐ๋ฅ |
initialMessages | system promptยทfew-shot | AG-UI Messages ๋์ ์ ์๋ |
initialState | ๊ณต์ ์ํ ์๋ | AG-UI State Management ์ด๊ธฐ๊ฐ |
agent.clone()์ผ๋ก ์ํ๋ฅผ ๋ณต์ ํ ๋ถ๊ธฐ ์ธ์คํด์ค๋ฅผ ๋ง๋ค ์ ์์ด, ์๋ฎฌ๋ ์ด์
ยทwhat-if ๋ถ์์๋ ํ์ฉ ๊ฐ๋ฅํ๋ค.