Spaces:
Runtime error
Runtime error
Update agents/executor.py
Browse files- agents/executor.py +4 -9
agents/executor.py
CHANGED
|
@@ -5,7 +5,7 @@ This agent executes SQL queries and reports on the results.
|
|
| 5 |
|
| 6 |
import time
|
| 7 |
import json
|
| 8 |
-
from typing import Dict, Any, List
|
| 9 |
from agents.state import AgentState
|
| 10 |
from anthropic import Anthropic
|
| 11 |
from anthropic.types import MessageParam
|
|
@@ -22,15 +22,11 @@ def executor_agent(anthropic_client: Anthropic, db, state: AgentState) -> AgentS
|
|
| 22 |
Returns:
|
| 23 |
Updated state
|
| 24 |
"""
|
| 25 |
-
# Ensure messages exist and current_agent is a list
|
| 26 |
messages = state.get("messages", [])
|
| 27 |
-
current_agent = state.get("current_agent", "executor_agent")
|
| 28 |
sql_queries = state.get("sql_queries", [])
|
| 29 |
|
| 30 |
-
# Ensure current_agent is a list
|
| 31 |
-
if isinstance(current_agent, str):
|
| 32 |
-
current_agent = [current_agent]
|
| 33 |
-
|
| 34 |
# Add agent-specific instructions
|
| 35 |
system_message = """
|
| 36 |
You are an AI assistant specializing in executing and validating pharmaceutical data pipelines.
|
|
@@ -111,8 +107,7 @@ def executor_agent(anthropic_client: Anthropic, db, state: AgentState) -> AgentS
|
|
| 111 |
# Update status
|
| 112 |
new_state["status"] = "complete"
|
| 113 |
# Append "complete" to current_agent
|
| 114 |
-
current_agent.append("complete")
|
| 115 |
-
new_state["current_agent"] = current_agent
|
| 116 |
|
| 117 |
return new_state
|
| 118 |
|
|
|
|
| 5 |
|
| 6 |
import time
|
| 7 |
import json
|
| 8 |
+
from typing import Dict, Any, List
|
| 9 |
from agents.state import AgentState
|
| 10 |
from anthropic import Anthropic
|
| 11 |
from anthropic.types import MessageParam
|
|
|
|
| 22 |
Returns:
|
| 23 |
Updated state
|
| 24 |
"""
|
| 25 |
+
# Ensure messages exist and current_agent is a list
|
| 26 |
messages = state.get("messages", [])
|
| 27 |
+
current_agent = state.get("current_agent", ["executor_agent"])
|
| 28 |
sql_queries = state.get("sql_queries", [])
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
# Add agent-specific instructions
|
| 31 |
system_message = """
|
| 32 |
You are an AI assistant specializing in executing and validating pharmaceutical data pipelines.
|
|
|
|
| 107 |
# Update status
|
| 108 |
new_state["status"] = "complete"
|
| 109 |
# Append "complete" to current_agent
|
| 110 |
+
new_state["current_agent"].append("complete")
|
|
|
|
| 111 |
|
| 112 |
return new_state
|
| 113 |
|