@@ -43,7 +43,7 @@ def build_agent(
43
43
config : formative_memories .AgentConfig ,
44
44
model : language_model .LanguageModel ,
45
45
memory : basic_associative_memory .AssociativeMemoryBank ,
46
- clock : game_clock .MultiIntervalClock ,
46
+ clock : game_clock .MultiIntervalClock | None = None ,
47
47
) -> entity_agent_with_logging .EntityAgentWithLogging :
48
48
"""Build an agent.
49
49
@@ -69,11 +69,16 @@ def build_agent(
69
69
logging_channel = measurements .get_channel ('Instructions' ).on_next ,
70
70
)
71
71
72
- time_display = agent_components .report_function .ReportFunction (
73
- function = clock .current_time_interval_str ,
74
- pre_act_key = '\n Current time' ,
75
- logging_channel = measurements .get_channel ('TimeDisplay' ).on_next ,
76
- )
72
+ if clock :
73
+ clock_now = clock .now
74
+ time_display = agent_components .report_function .ReportFunction (
75
+ function = clock .current_time_interval_str ,
76
+ pre_act_key = '\n Current time' ,
77
+ logging_channel = measurements .get_channel ('TimeDisplay' ).on_next ,
78
+ )
79
+ else :
80
+ clock_now = None
81
+ time_display = None
77
82
78
83
observation_to_memory = agent_components_v2 .observation .ObservationToMemory (
79
84
logging_channel = measurements .get_channel (
@@ -123,7 +128,7 @@ def build_agent(
123
128
situation_representation_label
124
129
),
125
130
},
126
- clock_now = clock . now ,
131
+ clock_now = clock_now ,
127
132
pre_act_key = person_by_situation_label ,
128
133
logging_channel = measurements .get_channel ('PersonBySituation' ).on_next ,
129
134
)
@@ -156,7 +161,6 @@ def build_agent(
156
161
157
162
entity_components = (
158
163
# Components that provide pre_act context.
159
- time_display ,
160
164
relevant_memories ,
161
165
self_perception ,
162
166
situation_representation ,
@@ -171,6 +175,8 @@ def build_agent(
171
175
components_of_agent [
172
176
agent_components_v2 .observation .DEFAULT_OBSERVATION_COMPONENT_NAME
173
177
] = observation
178
+ if time_display :
179
+ components_of_agent ['TimeDisplay' ] = time_display
174
180
175
181
component_order = list (components_of_agent .keys ())
176
182
0 commit comments