MCPcopy
hub / github.com/aiming-lab/MetaClaw / run_condition

Function run_condition

scripts/run_memory_ablation.py:215–364  ·  view source on GitHub ↗
(condition_name: str, memory_enabled: bool)

Source from the content-addressed store, hash-verified

213# Run one condition #
214# ------------------------------------------------------------------ #
215async def run_condition(condition_name: str, memory_enabled: bool) -> dict:
216 from metaclaw.config import MetaClawConfig
217 from metaclaw.rollout import AsyncRolloutWorker
218 from metaclaw.skill_manager import SkillManager
219
220 logger.info("=" * 60)
221 logger.info(" CONDITION: %s (memory=%s)", condition_name, memory_enabled)
222 logger.info("=" * 60)
223
224 mem_dir = MEMORY_DIR / condition_name
225 if mem_dir.exists():
226 shutil.rmtree(mem_dir)
227 mem_dir.mkdir(parents=True, exist_ok=True)
228
229 config = MetaClawConfig(
230 mode="skills_only",
231 llm_api_base=AZURE_API_BASE,
232 llm_api_key=AZURE_API_KEY,
233 llm_model_id=AZURE_MODEL,
234 served_model_name=AZURE_MODEL,
235 proxy_port=PROXY_PORT,
236 proxy_host="127.0.0.1",
237 use_skills=True,
238 skills_dir=os.path.expanduser("~/.metaclaw/skills"),
239 retrieval_mode="template",
240 skill_top_k=6,
241 task_specific_top_k=10,
242 enable_skill_evolution=False,
243 memory_enabled=memory_enabled,
244 memory_dir=str(mem_dir),
245 memory_store_path=str(mem_dir / "memory.db"),
246 memory_scope="default",
247 memory_retrieval_mode="keyword",
248 memory_auto_extract=True,
249 memory_auto_consolidate=True,
250 memory_max_injected_units=6,
251 memory_max_injected_tokens=800,
252 memory_auto_upgrade_enabled=False,
253 record_enabled=True,
254 record_dir=str(RESULTS_DIR / condition_name),
255 )
256
257 skill_manager = None
258 if config.use_skills:
259 Path(config.skills_dir).mkdir(parents=True, exist_ok=True)
260 skill_manager = SkillManager(
261 skills_dir=config.skills_dir,
262 retrieval_mode=config.retrieval_mode,
263 embedding_model_path=config.embedding_model_path,
264 task_specific_top_k=config.task_specific_top_k,
265 )
266
267 memory_manager = None
268 if config.memory_enabled:
269 from metaclaw.memory.manager import MemoryManager
270 try:
271 memory_manager = MemoryManager.from_config(config)
272 logger.info(" MemoryManager ready: %s", config.memory_store_path)

Callers 1

mainFunction · 0.85

Calls 15

resume_submissionMethod · 0.95
startMethod · 0.95
stopMethod · 0.95
MetaClawConfigClass · 0.90
SkillManagerClass · 0.90
AsyncRolloutWorkerClass · 0.90
compute_recallFunction · 0.85
wait_for_proxyFunction · 0.70
send_chatFunction · 0.70
prm_judgeFunction · 0.70
infoMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected