File size: 1,799 Bytes
76962bf
 
 
 
 
 
 
 
 
 
 
b1198f0
76962bf
 
b1198f0
76962bf
 
 
b1198f0
cb505ff
b1198f0
76962bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b1198f0
 
 
76962bf
 
 
 
 
cb505ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from typing import TypedDict, Annotated, List, Union
from langchain_core.messages import BaseMessage
import operator

class AgentState(TypedDict):
    # Standard message history
    messages: Annotated[List[BaseMessage], operator.add]
    
    # Metadata for routing
    user_role: str  # patient, clinician, researcher
    intent_type: str  # diagnosis, treatment, monitoring, general
    trace_id: str
    
    # CDM / FHIR Data
    session_id: str
    patient_id: str
    fhir_data: List[dict]
    trend_analysis: str
    trend_data: dict
    cdm_trend_analysis: dict
    current_medications: List[dict]
    
    # Validation status
    is_valid: bool
    is_safe: bool
    
    # Intermediate outputs
    patient_response: str
    clinician_outputs: List[str]
    research_output: str
    
    # Recovery loop counter
    attempts: int
    
    # Sources for information
    sources: Annotated[List[str], operator.add]
    
    # Evidence citations for clinical recommendations (Bug 12.3)
    evidence_citations: Annotated[List[dict], operator.add]
    
    # Execution logs
    logs: Annotated[List[str], operator.add]
    
    # Metrics (tokens, time)
    metrics: Annotated[List[dict], operator.add]

    # Phase 0 skill runtime metadata
    active_skill_id: str
    active_skill_version: str
    manager_route: dict
    skill_plan: List[dict]
    skill_trace: List[dict]
    request_id: str
    authorization_subject: str
    data_access_scope: List[str]
    consent_status: str
    response_artifacts: List[dict]
    retrieved_sources: Annotated[List[dict], operator.add]
    memory_context: List[dict]
    memory_proposals: Annotated[List[dict], operator.add]
    memory_commit_results: Annotated[List[dict], operator.add]
    gates: dict
    termination_reason: str
    runtime_mode: str