mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-24 23:58:15 +00:00
- Extract base CrewEvent class to a new base_events.py module - Update event imports across multiple event-related files - Modify CrewTestStartedEvent to use eval_llm instead of openai_model_name - Add LLM creation validation in crew testing method - Improve type handling and event consistency
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, Union
|
|
|
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
|
from crewai.tools.base_tool import BaseTool
|
|
from crewai.tools.structured_tool import CrewStructuredTool
|
|
|
|
from .base_events import CrewEvent
|
|
|
|
if TYPE_CHECKING:
|
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
|
|
|
|
|
class AgentExecutionStartedEvent(CrewEvent):
|
|
"""Event emitted when an agent starts executing a task"""
|
|
|
|
agent: BaseAgent
|
|
task: Any
|
|
tools: Optional[Sequence[Union[BaseTool, CrewStructuredTool]]]
|
|
task_prompt: str
|
|
type: str = "agent_execution_started"
|
|
|
|
model_config = {"arbitrary_types_allowed": True}
|
|
|
|
|
|
class AgentExecutionCompletedEvent(CrewEvent):
|
|
"""Event emitted when an agent completes executing a task"""
|
|
|
|
agent: BaseAgent
|
|
task: Any
|
|
output: str
|
|
type: str = "agent_execution_completed"
|
|
|
|
|
|
class AgentExecutionErrorEvent(CrewEvent):
|
|
"""Event emitted when an agent encounters an error during execution"""
|
|
|
|
agent: BaseAgent
|
|
task: Any
|
|
error: str
|
|
type: str = "agent_execution_error"
|