Spaces:
Paused

miracle / agents /state.py
dushyantsingh0
fix: resolve typescript build errors in internal portal navigation
0509823
Raw History Blame Contribute Delete
1.84 kB
from typing import TypedDict, List, Optional, Any, Dict, Annotated
from uuid import UUID
def merge_list(current: List[Any], new: List[Any]) -> List[Any]:
return (current or []) + (new or [])
def merge_dict(current: Dict[str, Any], new: Dict[str, Any]) -> Dict[str, Any]:
_c = current.copy() if current else {}
if new:
_c.update(new)
return _c
class AgentState(TypedDict):
"""
Shared state for the Customer Portal Agentic Workflow.
"""
# Source Info
ticket_id: UUID
workspace_id: UUID
thread_id: Optional[UUID]
title: str
description: str
attachments: Optional[List[Any]] # Serialized attachment data (id, filename, ai_caption)
# --- Consolidated AI Ingestion ---
embedding: Optional[List[float]] # Shared Centroid Vector (Nomic-768)
vision_context: Optional[List[Dict[str, Any]]] # Image Captions/Refs
# Processed Results
category: Optional[str]
priority: Optional[str]
sentiment: Optional[str]
# Duplication Info
is_duplicate: bool
duplicate_of_id: Optional[UUID]
# Generated Outputs
assigned_to: Optional[UUID]
status: Optional[str]
kb_suggested_solution: Optional[str]
root_cause_analysis: Optional[str]
proposed_technical_solution: Optional[str]
internal_summary: Optional[str]
kb_extracts: Optional[List[Dict[str, Any]]] # Relevant KB articles or chunks
is_new_topic: bool = False # Flag for KB expansion
# Flow Control
target_team: Optional[str] # Identified department (Engineering, SecOps, etc.)
next_node: Optional[str]
proposed_insights: Annotated[List[Dict[str, Any]], merge_list]
errors: Annotated[List[str], merge_list]
metadata: Annotated[Dict[str, Any], merge_dict]
processed_steps: Annotated[List[Dict[str, Any]], merge_list]