> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-07-07-docs-update-ts-examples-to-prefer-calling.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GenAI 트레이스 채팅



## OpenAPI

````yaml ko/weave/reference/service-api/openapi.json POST /agents/traces/chat
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security: []
paths:
  /agents/traces/chat:
    post:
      tags:
        - Agents
      summary: GenAI 트레이스 채팅
      operationId: genai_traces_chat_agents_traces_chat_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentTraceChatReq'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentTraceChatRes'
          description: 성공 응답
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: 검증 오류
components:
  schemas:
    AgentTraceChatReq:
      description: 트레이스의 구조화된 채팅 / 트래젝터리 뷰를 조회하기 위한 요청입니다.
      properties:
        include_feedback:
          default: false
          title: Include Feedback
          type: boolean
        project_id:
          title: Project Id
          type: string
        trace_id:
          title: Trace Id
          type: string
      required:
        - project_id
        - trace_id
      title: AgentTraceChatReq
      type: object
    AgentTraceChatRes:
      description: '구조화된 채팅 뷰: 단일 트레이스의 에이전트 트래젝터리를 나타내는 선형 메시지 시퀀스입니다.'
      properties:
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
        agent_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Version
        ended_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Ended At
        feedback:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentChatFeedback'
              type: array
            - type: 'null'
          title: Feedback
        messages:
          items:
            $ref: '#/components/schemas/AgentChatMessage'
          title: Messages
          type: array
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider
        root_span_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Root Span Name
        started_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Started At
        status_code:
          anyOf:
            - enum:
                - UNSET
                - OK
                - ERROR
              type: string
            - type: 'null'
          title: Status Code
        total_cache_creation_input_tokens:
          default: 0
          title: Total Cache Creation Input Tokens
          type: integer
        total_cache_read_input_tokens:
          default: 0
          title: Total Cache Read Input Tokens
          type: integer
        total_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Cost Usd
        total_duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          description: 트레이스 루트 span의 실제 경과 시간(밀리초)입니다. 이는 하위 span 기간의 합이 아닙니다.
          title: Total Duration Ms
        total_input_tokens:
          default: 0
          title: Total Input Tokens
          type: integer
        total_output_tokens:
          default: 0
          title: Total Output Tokens
          type: integer
        total_reasoning_tokens:
          default: 0
          title: Total Reasoning Tokens
          type: integer
        trace_id:
          title: Trace Id
          type: string
        wb_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Wb User Id
      required:
        - trace_id
        - root_span_name
        - agent_name
        - agent_version
        - status_code
        - provider
        - started_at
        - ended_at
        - wb_user_id
        - total_duration_ms
        - total_cost_usd
        - total_input_tokens
        - total_output_tokens
        - total_reasoning_tokens
        - total_cache_creation_input_tokens
        - total_cache_read_input_tokens
        - messages
        - feedback
      title: AgentTraceChatRes
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    AgentChatFeedback:
      description: |-
        에이전트 채팅 `include_feedback` 프로젝션의 피드백 행입니다.

        필드 이름은 FEEDBACK_QUERY_FIELDS와 일치합니다. 이는 피드백
        테이블 행이나 FeedbackCreateReq가 아니며, project_id 및 span_*은
        선택되지 않습니다.
      properties:
        annotation_ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Annotation Ref
        call_ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Call Ref
        created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Created At
        creator:
          anyOf:
            - type: string
            - type: 'null'
          title: Creator
        feedback_type:
          title: Feedback Type
          type: string
        id:
          title: Id
          type: string
        payload:
          additionalProperties: true
          title: Payload
          type: object
        runnable_ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Runnable Ref
        scorer_rating_confidences:
          additionalProperties:
            type: number
          title: Scorer Rating Confidences
          type: object
        scorer_rating_reasons:
          additionalProperties:
            type: string
          title: Scorer Rating Reasons
          type: object
        scorer_ratings:
          additionalProperties:
            type: number
          title: Scorer Ratings
          type: object
        scorer_tag_confidences:
          additionalProperties:
            type: number
          title: Scorer Tag Confidences
          type: object
        scorer_tag_reasons:
          additionalProperties:
            type: string
          title: Scorer Tag Reasons
          type: object
        scorer_tags:
          items:
            type: string
          title: Scorer Tags
          type: array
        trigger_ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Trigger Ref
        wb_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Wb User Id
        weave_ref:
          title: Weave Ref
          type: string
      required:
        - id
        - feedback_type
        - weave_ref
        - payload
        - creator
        - created_at
        - wb_user_id
        - runnable_ref
        - call_ref
        - trigger_ref
        - annotation_ref
        - scorer_tags
        - scorer_tag_reasons
        - scorer_tag_confidences
        - scorer_ratings
        - scorer_rating_reasons
        - scorer_rating_confidences
      title: AgentChatFeedback
      type: object
    AgentChatMessage:
      description: |-
        구조화된 에이전트 트래젝터리 / 채팅 뷰의 단일 요소입니다.

        공통 event 필드는 최상위 수준에 있습니다. 유형별 필드는
        `type`에 해당하는 payload 아래에 그룹화되며, payload는 정확히 하나만
        설정되어야 합니다. 이렇게 하면 호출자를 위한 단일한
        순차 타임라인 모델을 유지하면서도 하위 유형의 null 허용 여부를 명시적으로 표현할 수 있습니다.
      properties:
        agent_handoff:
          anyOf:
            - $ref: '#/components/schemas/AgentChatAgentHandoff'
            - type: 'null'
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
        agent_start:
          anyOf:
            - $ref: '#/components/schemas/AgentChatAgentStart'
            - type: 'null'
        agent_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Version
        assistant_message:
          anyOf:
            - $ref: '#/components/schemas/AgentChatAssistantMessage'
            - type: 'null'
        context_compacted:
          anyOf:
            - $ref: '#/components/schemas/AgentChatContextCompacted'
            - type: 'null'
        feedback:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentChatFeedback'
              type: array
            - type: 'null'
          title: Feedback
        span_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Span Id
        started_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Started At
        status_code:
          anyOf:
            - enum:
                - UNSET
                - OK
                - ERROR
              type: string
            - type: 'null'
          title: Status Code
        tool_call:
          anyOf:
            - $ref: '#/components/schemas/AgentChatToolCall'
            - type: 'null'
        type:
          enum:
            - user_message
            - assistant_message
            - tool_call
            - agent_handoff
            - agent_start
            - context_compacted
          title: Type
          type: string
        user_message:
          anyOf:
            - $ref: '#/components/schemas/AgentChatUserMessage'
            - type: 'null'
      required:
        - type
        - span_id
        - agent_name
        - agent_version
        - status_code
        - started_at
        - user_message
        - assistant_message
        - tool_call
        - agent_start
        - agent_handoff
        - context_compacted
        - feedback
      title: AgentChatMessage
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    AgentChatAgentHandoff:
      description: 향후 에이전트 간 핸드오프 event용 payload입니다.
      properties: {}
      title: AgentChatAgentHandoff
      type: object
    AgentChatAgentStart:
      description: 에이전트 라이프사이클 경계용 payload입니다.
      properties:
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        status:
          anyOf:
            - enum:
                - UNSET
                - OK
                - ERROR
              type: string
            - type: 'null'
          title: Status
        system_instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: System Instructions
        tool_definitions:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Definitions
      required:
        - model
        - system_instructions
        - tool_definitions
        - status
      title: AgentChatAgentStart
      type: object
    AgentChatAssistantMessage:
      description: 에이전트 또는 LLM span이 생성한 assistant 텍스트용 payload입니다.
      properties:
        content_refs:
          items:
            type: string
          title: Content Refs
          type: array
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
        input_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Input Cost Usd
        input_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Input Tokens
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        output_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Output Cost Usd
        output_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Output Tokens
        reasoning_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Reasoning Content
        reasoning_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Reasoning Tokens
        status:
          anyOf:
            - enum:
                - UNSET
                - OK
                - ERROR
              type: string
            - type: 'null'
          title: Status
        text:
          title: Text
          type: string
        total_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Cost Usd
      required:
        - text
        - model
        - reasoning_content
        - reasoning_tokens
        - input_tokens
        - output_tokens
        - input_cost_usd
        - output_cost_usd
        - total_cost_usd
        - duration_ms
        - status
        - content_refs
      title: AgentChatAssistantMessage
      type: object
    AgentChatContextCompacted:
      description: 컨텍스트 윈도우 압축 event용 payload입니다.
      properties:
        compaction_items_after:
          anyOf:
            - type: integer
            - type: 'null'
          title: Compaction Items After
        compaction_items_before:
          anyOf:
            - type: integer
            - type: 'null'
          title: Compaction Items Before
        compaction_summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Compaction Summary
      required:
        - compaction_summary
        - compaction_items_before
        - compaction_items_after
      title: AgentChatContextCompacted
      type: object
    AgentChatToolCall:
      description: 도구 Call 타임라인 event용 payload입니다.
      properties:
        content_refs:
          items:
            type: string
          title: Content Refs
          type: array
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
        status:
          anyOf:
            - enum:
                - UNSET
                - OK
                - ERROR
              type: string
            - type: 'null'
          title: Status
        tool_arguments:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Arguments
        tool_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Name
        tool_result:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Result
      required:
        - tool_name
        - tool_arguments
        - tool_result
        - duration_ms
        - status
        - content_refs
      title: AgentChatToolCall
      type: object
    AgentChatUserMessage:
      description: 채팅 타임라인의 사용자 prompt용 payload입니다.
      properties:
        content_refs:
          items:
            type: string
          title: Content Refs
          type: array
        text:
          title: Text
          type: string
      required:
        - text
        - content_refs
      title: AgentChatUserMessage
      type: object

````