-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagents.py
More file actions
117 lines (97 loc) · 3.92 KB
/
agents.py
File metadata and controls
117 lines (97 loc) · 3.92 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
from dataclasses import dataclass
from typing import Dict
from models import ExperienceEntry, Interpretation
RUN_1 = "run_1_divergent_memory"
RUN_2 = "run_2_shared_memory"
@dataclass(frozen=True)
class Agent:
agent_id: str
def interpret(self, entry: ExperienceEntry, context: Dict[str, str]) -> Interpretation:
raise NotImplementedError
@dataclass(frozen=True)
class NPCAgentSymbolic(Agent):
agent_id: str = "NPC_A"
def interpret(self, entry: ExperienceEntry, context: Dict[str, str]) -> Interpretation:
if context["scenario_id"] == RUN_1:
return Interpretation(
agent_id=self.agent_id,
mode="symbolic",
meaning_label="symbolic_risk_inference",
feature_vector=(0.95, 0.10, 0.15, 0.85, 0.60),
memory_reference="ASSOCIATIVE_EVENT_12 -> risk_warning",
notes=(
f"{entry.object_id} is interpreted through associative symbolic context"
" as a risk signal."
),
)
return Interpretation(
agent_id=self.agent_id,
mode="symbolic",
meaning_label="symbolic_caution_inference",
feature_vector=(0.70, 0.45, 0.20, 0.55, 0.40),
memory_reference="ALIGNED_CONTEXT_PROFILE_1 -> caution",
notes=(
f"{entry.object_id} remains symbolically interpreted, with inference"
" shifted by aligned context."
),
)
@dataclass(frozen=True)
class NPCAgentLiteral(Agent):
agent_id: str = "NPC_B"
def interpret(self, entry: ExperienceEntry, context: Dict[str, str]) -> Interpretation:
if context["scenario_id"] == RUN_1:
return Interpretation(
agent_id=self.agent_id,
mode="literal",
meaning_label="literal_signal_inference",
feature_vector=(0.10, 0.95, 0.05, 0.20, 0.25),
memory_reference=None,
notes=(
f"{entry.object_id} is interpreted from direct signal structure with"
" minimal contextual shaping."
),
)
return Interpretation(
agent_id=self.agent_id,
mode="literal",
meaning_label="literal_caution_inference",
feature_vector=(0.45, 0.70, 0.15, 0.50, 0.35),
memory_reference="ALIGNED_CONTEXT_PROFILE_1 -> caution",
notes=(
f"{entry.object_id} remains literal, but aligned context reduces semantic"
" distance from NPC_A."
),
)
@dataclass(frozen=True)
class NPCAgentMetaObserver(Agent):
agent_id: str = "NPC_C"
def interpret(self, entry: ExperienceEntry, context: Dict[str, str]) -> Interpretation:
if context["scenario_id"] == RUN_1:
return Interpretation(
agent_id=self.agent_id,
mode="meta_observer",
meaning_label="meta_interpretive_divergence",
feature_vector=(0.35, 0.35, 0.95, 0.60, 0.80),
memory_reference="MODEL_A_B_DISAGREEMENT",
notes=(
f"{entry.object_id} is modeled second-order as interpretive divergence"
" between NPC_A and NPC_B."
),
)
return Interpretation(
agent_id=self.agent_id,
mode="meta_observer",
meaning_label="meta_interpretive_convergence",
feature_vector=(0.35, 0.35, 0.95, 0.45, 0.30),
memory_reference="MODEL_A_B_ALIGNMENT",
notes=(
f"{entry.object_id} is modeled second-order as partial convergence"
" between NPC_A and NPC_B."
),
)
def build_agents() -> Dict[str, Agent]:
return {
"NPC_A": NPCAgentSymbolic(),
"NPC_B": NPCAgentLiteral(),
"NPC_C": NPCAgentMetaObserver(),
}