MCPcopy
hub / github.com/stitionai/devika / set_agent_active

Method set_agent_active

src/state.py:109–123  ·  view source on GitHub ↗
(self, project: str, is_active: bool)

Source from the content-addressed store, hash-verified

107 return None
108
109 def set_agent_active(self, project: str, is_active: bool):
110 with Session(self.engine) as session:
111 agent_state = session.query(AgentStateModel).filter(AgentStateModel.project == project).first()
112 if agent_state:
113 state_stack = json.loads(agent_state.state_stack_json)
114 state_stack[-1]["agent_is_active"] = is_active
115 agent_state.state_stack_json = json.dumps(state_stack)
116 session.commit()
117 else:
118 state_stack = [self.new_state()]
119 state_stack[-1]["agent_is_active"] = is_active
120 agent_state = AgentStateModel(project=project, state_stack_json=json.dumps(state_stack))
121 session.add(agent_state)
122 session.commit()
123 emit_agent("agent-state", state_stack)
124
125 def is_agent_active(self, project: str):
126 with Session(self.engine) as session:

Callers 2

subsequent_executeMethod · 0.80
executeMethod · 0.80

Calls 3

new_stateMethod · 0.95
emit_agentFunction · 0.90
AgentStateModelClass · 0.85

Tested by

no test coverage detected