Spaces:
Paused

nexus / agents /state.py
dushyantsingh0
backend stabilization
b7980f7
Raw History Blame Contribute Delete
1.79 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]
suggested_reply: Optional[str]
kb_suggested_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]