chore: collapse multi-line argument definitions into single lines across multiple modules
This commit is contained in:
@@ -93,9 +93,7 @@ class AgentCommunicationBus:
|
||||
|
||||
self.conn.commit()
|
||||
|
||||
def get_messages(
|
||||
self, agent_id: str, unread_only: bool = True
|
||||
) -> List[AgentMessage]:
|
||||
def get_messages(self, agent_id: str, unread_only: bool = True) -> List[AgentMessage]:
|
||||
cursor = self.conn.cursor()
|
||||
if unread_only:
|
||||
cursor.execute(
|
||||
@@ -135,17 +133,13 @@ class AgentCommunicationBus:
|
||||
|
||||
def mark_as_read(self, message_id: str):
|
||||
cursor = self.conn.cursor()
|
||||
cursor.execute(
|
||||
"UPDATE agent_messages SET read = 1 WHERE message_id = ?", (message_id,)
|
||||
)
|
||||
cursor.execute("UPDATE agent_messages SET read = 1 WHERE message_id = ?", (message_id,))
|
||||
self.conn.commit()
|
||||
|
||||
def clear_messages(self, session_id: Optional[str] = None):
|
||||
cursor = self.conn.cursor()
|
||||
if session_id:
|
||||
cursor.execute(
|
||||
"DELETE FROM agent_messages WHERE session_id = ?", (session_id,)
|
||||
)
|
||||
cursor.execute("DELETE FROM agent_messages WHERE session_id = ?", (session_id,))
|
||||
else:
|
||||
cursor.execute("DELETE FROM agent_messages")
|
||||
self.conn.commit()
|
||||
@@ -156,9 +150,7 @@ class AgentCommunicationBus:
|
||||
def receive_messages(self, agent_id: str) -> List[AgentMessage]:
|
||||
return self.get_messages(agent_id, unread_only=True)
|
||||
|
||||
def get_conversation_history(
|
||||
self, agent_a: str, agent_b: str
|
||||
) -> List[AgentMessage]:
|
||||
def get_conversation_history(self, agent_a: str, agent_b: str) -> List[AgentMessage]:
|
||||
cursor = self.conn.cursor()
|
||||
cursor.execute(
|
||||
"""
|
||||
|
||||
@@ -19,17 +19,14 @@ class AgentInstance:
|
||||
task_count: int = 0
|
||||
|
||||
def add_message(self, role: str, content: str):
|
||||
self.message_history.append(
|
||||
{"role": role, "content": content, "timestamp": time.time()}
|
||||
)
|
||||
self.message_history.append({"role": role, "content": content, "timestamp": time.time()})
|
||||
|
||||
def get_system_message(self) -> Dict[str, str]:
|
||||
return {"role": "system", "content": self.role.system_prompt}
|
||||
|
||||
def get_messages_for_api(self) -> List[Dict[str, str]]:
|
||||
return [self.get_system_message()] + [
|
||||
{"role": msg["role"], "content": msg["content"]}
|
||||
for msg in self.message_history
|
||||
{"role": msg["role"], "content": msg["content"]} for msg in self.message_history
|
||||
]
|
||||
|
||||
|
||||
@@ -128,14 +125,10 @@ class AgentManager:
|
||||
self.communication_bus.send_message(message, self.session_id)
|
||||
return message.message_id
|
||||
|
||||
def get_agent_messages(
|
||||
self, agent_id: str, unread_only: bool = True
|
||||
) -> List[AgentMessage]:
|
||||
def get_agent_messages(self, agent_id: str, unread_only: bool = True) -> List[AgentMessage]:
|
||||
return self.communication_bus.get_messages(agent_id, unread_only)
|
||||
|
||||
def collaborate_agents(
|
||||
self, orchestrator_id: str, task: str, agent_roles: List[str]
|
||||
):
|
||||
def collaborate_agents(self, orchestrator_id: str, task: str, agent_roles: List[str]):
|
||||
orchestrator = self.get_agent(orchestrator_id)
|
||||
if not orchestrator:
|
||||
orchestrator_id = self.create_agent("orchestrator")
|
||||
@@ -153,9 +146,7 @@ Available specialized agents:
|
||||
|
||||
Break down the task and delegate subtasks to appropriate agents. Coordinate their work and integrate results."""
|
||||
|
||||
orchestrator_result = self.execute_agent_task(
|
||||
orchestrator_id, orchestration_prompt
|
||||
)
|
||||
orchestrator_result = self.execute_agent_task(orchestrator_id, orchestration_prompt)
|
||||
|
||||
results = {"orchestrator": orchestrator_result, "agents": []}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user