INNER CODE UNIT · Python
_init_agent
tomtommyyuan/spmind · gradio_app.py:18
def _init_agent(self):
"""Initialize the SP-Mind agent."""
try:
self.agent = SPMindAgent(
path="./data",
model=self.model,
permission_mode="bypassPermissions",
)
except Exception as e:
print(f"Agent initialization failed: {e}")
self.agent = None
def reset_conversation(self):
"""Reset the agent session and clear chat history."""
if self.agent:
self.agent.reset_session()
return [], ""