MCPcopy Create free account
hub / github.com/SkyworkAI/DeepResearchAgent / _store

Method _store

src/environment/context.py:383–415  ·  view source on GitHub ↗

Add environment information to the embedding index. Args: env_config: Environment configuration

(self, env_config: EnvironmentConfig)

Source from the content-addressed store, hash-verified

381 return env_configs
382
383 async def _store(self, env_config: EnvironmentConfig):
384 """Add environment information to the embedding index.
385
386 Args:
387 env_config: Environment configuration
388 """
389 if self._faiss_service is None:
390 return
391
392 try:
393 # Create comprehensive text representation
394 env_text = f"Environment: {env_config.name}\nDescription: {env_config.description}"
395
396 # Add action descriptions if available
397 if env_config.actions:
398 action_descriptions = [f"{name}: {action.description}" for name, action in env_config.actions.items()]
399 if action_descriptions:
400 env_text += f"\nActions: {'; '.join(action_descriptions)}"
401
402 # Add to FAISS index
403 request = FaissAddRequest(
404 texts=[env_text],
405 metadatas=[{
406 "name": env_config.name,
407 "description": env_config.description,
408 "version": env_config.version
409 }]
410 )
411
412 await self._faiss_service.add_documents(request)
413
414 except Exception as e:
415 logger.warning(f"| ⚠️ Failed to add environment {env_config.name} to FAISS index: {e}")
416
417 async def build(self, env_config: EnvironmentConfig) -> EnvironmentConfig:
418 """Build an environment instance from config (internal helper, similar to tool's build).

Callers 3

registerMethod · 0.95
updateMethod · 0.95
copyMethod · 0.95

Calls 4

FaissAddRequestClass · 0.90
joinMethod · 0.80
warningMethod · 0.80
add_documentsMethod · 0.45

Tested by

no test coverage detected