 b6bff318d9
			
		
	
	b6bff318d9
	
	
	
		
			
			- Agent roles integration progress - Various backend and frontend updates - Storybook cache cleanup 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			52 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| """
 | |
| Task model for SQLAlchemy ORM
 | |
| """
 | |
| 
 | |
| from sqlalchemy import Column, String, Text, Integer, DateTime, ForeignKey, UUID as SqlUUID, Float, Boolean
 | |
| from sqlalchemy.dialects.postgresql import JSONB
 | |
| from sqlalchemy.sql import func
 | |
| from sqlalchemy.orm import relationship
 | |
| from ..core.database import Base
 | |
| import uuid
 | |
| 
 | |
| 
 | |
| class Task(Base):
 | |
|     __tablename__ = "tasks"
 | |
|     
 | |
|     # Primary identification
 | |
|     id = Column(SqlUUID(as_uuid=True), primary_key=True, index=True, default=uuid.uuid4)
 | |
|     
 | |
|     # Task details
 | |
|     title = Column(String(255), nullable=False)
 | |
|     description = Column(Text)
 | |
|     priority = Column(Integer, default=5)
 | |
|     status = Column(String(50), default='pending')
 | |
|     
 | |
|     # Relationships
 | |
|     assigned_agent_id = Column(String(255), ForeignKey("agents.id"), nullable=True)
 | |
|     workflow_id = Column(SqlUUID(as_uuid=True), ForeignKey("workflows.id"), nullable=True)
 | |
|     execution_id = Column(SqlUUID(as_uuid=True), ForeignKey("executions.id"), nullable=True)
 | |
|     
 | |
|     # Task metadata (includes context and payload)
 | |
|     task_metadata = Column("metadata", JSONB, nullable=True)
 | |
|     
 | |
|     # RL Context Curator outcome tracking fields
 | |
|     completion_time = Column(Integer, nullable=True)  # Time to complete in seconds
 | |
|     errors_encountered = Column(Integer, default=0)   # Number of errors during execution
 | |
|     follow_up_questions = Column(Integer, default=0)  # Number of follow-up questions
 | |
|     success_rate = Column(Float, nullable=True)       # Success rate (0.0 to 1.0)
 | |
|     context_used = Column(JSONB, nullable=True)       # Context IDs used in this task
 | |
|     context_relevance_score = Column(Float, nullable=True)  # Average relevance of used context
 | |
|     feedback_collected = Column(Boolean, default=False)     # Whether feedback was collected
 | |
|     task_outcome = Column(String(50), nullable=True)        # completed, failed, abandoned
 | |
|     outcome_confidence = Column(Float, nullable=True)       # Confidence in outcome classification
 | |
|     
 | |
|     # Timestamps
 | |
|     created_at = Column(DateTime(timezone=True), server_default=func.now())
 | |
|     started_at = Column(DateTime(timezone=True), nullable=True)
 | |
|     completed_at = Column(DateTime(timezone=True), nullable=True)
 | |
|     
 | |
|     # Relationships
 | |
|     assigned_agent = relationship("Agent", back_populates="tasks")
 | |
|     workflow = relationship("Workflow", back_populates="tasks")
 | |
|     execution = relationship("Execution", back_populates="tasks") |