State tracking for a tool currently being executed.
| 235 | |
| 236 | |
| 237 | class ToolExecutionState(BaseModel): |
| 238 | """State tracking for a tool currently being executed.""" |
| 239 | |
| 240 | name: str = Field(description="Tool name") |
| 241 | arguments: dict[str, Any] = Field( |
| 242 | default_factory=dict, description="Tool arguments" |
| 243 | ) |
| 244 | start_time: float = Field(description="Execution start time (timestamp)") |
| 245 | result: str | None = Field(default=None, description="Tool execution result") |
| 246 | success: bool = Field(default=True, description="Whether execution succeeded") |
| 247 | elapsed: float | None = Field(default=None, description="Elapsed time in seconds") |
| 248 | completed: bool = Field(default=False, description="Whether execution is complete") |
| 249 | |
| 250 | model_config = {"frozen": False} |
| 251 | |
| 252 | def elapsed_time(self, current_time: float) -> float: |
| 253 | """Calculate elapsed time from start.""" |
| 254 | return current_time - self.start_time |
| 255 | |
| 256 | |
| 257 | class ChatStatus(BaseModel): |
no outgoing calls