Skip to content

Commit 14fd312

Browse files
committed
fix: standardize status enum values to use lowercase consistently
1 parent a4eadd7 commit 14fd312

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

agentflow/core/base_types.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ class AgentType(str, Enum):
77
GENERIC = "generic"
88
RESEARCH = "research"
99
DATA_SCIENCE = "data_science"
10+
DEVELOPMENT = "development"
11+
TESTING = "testing"
12+
DEPLOYMENT = "deployment"
13+
MONITORING = "monitoring"
14+
MAINTENANCE = "maintenance"
1015
CUSTOM = "custom"
1116

1217
class AgentMode(str, Enum):
@@ -21,7 +26,7 @@ class AgentStatus(str, Enum):
2126
IDLE = "idle"
2227
PROCESSING = "processing"
2328
FAILED = "failed"
24-
COMPLETED = "completed"
29+
SUCCESS = "success"
2530
INITIALIZED = "initialized"
2631

2732
class DictKeyType(str, Enum):

agentflow/core/workflow_types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class WorkflowStatus(str, Enum):
240240
"""Workflow status enum."""
241241
PENDING = "pending"
242242
RUNNING = "running"
243-
COMPLETED = "completed"
243+
SUCCESS = "success"
244244
FAILED = "failed"
245245
INITIALIZED = "initialized"
246246

@@ -595,12 +595,12 @@ def model_dump(self, **kwargs) -> Dict[str, Any]:
595595
"""Custom dump method to ensure proper serialization."""
596596
data = super().model_dump(**kwargs)
597597
# Always use "success" for completed status
598-
data["status"] = "success" if self.status == WorkflowStatus.COMPLETED else self.status.value
598+
data["status"] = "success" if self.status == WorkflowStatus.SUCCESS else self.status.value
599599
# Keep the result as is since we've already serialized it
600600
if self.result:
601601
# Ensure result status is consistent with instance status
602602
if isinstance(self.result, dict):
603-
self.result["status"] = "success" if self.status == WorkflowStatus.COMPLETED else self.status.value
603+
self.result["status"] = "success" if self.status == WorkflowStatus.SUCCESS else self.status.value
604604
# Ensure step statuses are consistent
605605
if "steps" in self.result:
606606
for step in self.result["steps"]:

tests/unit/test_agent_initialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def test_agent_state_initialization():
267267
agent = Agent(config=config)
268268

269269
assert agent.name == "StateAgent"
270-
assert agent.status.value == "IDLE"
270+
assert agent.status.value == "idle"
271271
assert agent.config is not None
272272

273273
def test_agent_invalid_initialization():

0 commit comments

Comments
 (0)