Skip to content

A2A 통신 전환: Agent 서버 분리 + POST /tasks/send + error_type + tool_call 어댑터 #28

Description

@SteadyCHOI

지금은 A2ATaskRequest/A2ATaskResponse 모델과 Agent Card 조회(GET) 엔드포인트만 있고, 실제 태스크 송수신이 없음. knowledge/execution/perception이 별도 서버로 뜬 적이 없어서(리포 전체에 main.py가 Supervisor용 8001 하나뿐, docker-compose.yml도 비어있음) StateGraph 노드가 지금도 from app.agents.execution import run_execution 식으로 로컬 함수를 직접 import해서 그래프에 꽂고 있고, 그 함수들(knowledge_node/run_execution/perception_node)도 전체 AgentState 객체를 그대로 받는 in-process 구조로 짜여 있음. 함수 호출을 지우고 A2A만으로 E2E가 되려면 아래를 다 채워야 함.

  1. knowledge/execution/perception 각각을 위한 독립 main.py(FastAPI app) 신설, 포트 8002/8003/8004 바인딩
  2. 그 3개 서버 각각에 POST /tasks/send 핸들러 추가 (A2ATaskRequest 수신 → 해당 agent 로직 실행 → A2ATaskResponse 반환). Supervisor 쪽이 아니라 서브 에이전트 서버 쪽에 붙어야 함
  3. A2ATaskResponse에 error_type 필드 추가 ("timeout" | "parameter" | "invalid_tool" | "sql")
  4. A2AClient에 태스크 전송 메서드 추가 (fetch_card/fetch_all_cards 옆에 send_task 추가)
  5. knowledge_node / run_execution / perception_node 시그니처를 state: AgentState 전체 수신 방식에서 A2ATaskRequest 수신 → A2ATaskResponse 반환 방식으로 재작성. AgentState.messages(LangChain 메시지 객체)를 A2ATaskRequest.context(Dict)로 실어 보낼 직렬화 규약도 함께 정의
  6. Supervisor의 StateGraph 노드에서 로컬 함수 import 호출을 A2AClient.send_task() 호출로 교체하고, 응답(A2ATaskResponse) → tool_calls dict 변환 어댑터 추가
  7. WS 스트리밍은 sub-agent에서 되쏘지 않고 Supervisor가 A2A 호출 경계에서 합성: A2AClient.send_task() 호출 직전 tool_start, 응답 수신 직후 tool_result를 Supervisor가 프론트엔드로 전송. sub-agent(execution.py/perception.py)에 있는 app/graph/ws.py 의존(websocket_manager, streamer_proxy)은 제거하고 Supervisor 프로세스에만 남김
    • 트레이드오프: Multi-Turn Tool Calling(여러 MCP tool 순차 호출)이 한 A2A 라운드트립 안에서 일어나면 tool 단위가 아니라 A2A 요청 단위로 tool_start/tool_result가 찍힘. 차량용 에이전트라 개별 tool 단위 실시간 UI 업데이트의 중요도가 낮다고 보고 이 방식으로 확정. 세부 진행률 표시가 필요해지면 그때 콜백 방식 재검토
  8. 3~4개 프로세스를 동시에 띄우는 실행 스크립트 또는 docker-compose.yml 작성 (현재 비어있음)

주의: 그래프 엣지(라우팅 흐름) 자체는 그대로 유지, A2A는 노드 내부의 실행 주체를 찾고 통신하는 계층으로만 추가

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions