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

Method save_contract

src/agent/context.py:1034–1050  ·  view source on GitHub ↗

Save the contract for an agent

(self, agent_names: Optional[List[str]] = None)

Source from the content-addressed store, hash-verified

1032 return restored_config
1033
1034 async def save_contract(self, agent_names: Optional[List[str]] = None):
1035 """Save the contract for an agent"""
1036 contract = []
1037 if agent_names is not None:
1038 for index, agent_name in enumerate(agent_names):
1039 agent_info = await self.get_info(agent_name)
1040 text = agent_info.text
1041 contract.append(f"{index + 1:04d}\n{text}\n")
1042 else:
1043 for index, agent_name in enumerate(self._agent_configs.keys()):
1044 agent_info = await self.get_info(agent_name)
1045 text = agent_info.text
1046 contract.append(f"{index + 1:04d}\n{text}\n")
1047 contract_text = "---\n".join(contract)
1048 with open(self.contract_path, "w", encoding="utf-8") as f:
1049 f.write(contract_text)
1050 logger.info(f"| 📝 Saved {len(contract)} agents contract to {self.contract_path}")
1051
1052 async def load_contract(self) -> str:
1053 """Load the contract for an agent"""

Callers 5

initializeMethod · 0.95
registerMethod · 0.95
updateMethod · 0.95
copyMethod · 0.95
unregisterMethod · 0.95

Calls 6

get_infoMethod · 0.95
joinMethod · 0.80
appendMethod · 0.45
keysMethod · 0.45
writeMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected