agent_k.core.exceptions
Custom exceptions for AGENT-K.
agent_k.core.exceptions
Exception hierarchy for AGENT-K system.
@notice: | Exception hierarchy for AGENT-K system.
@dev: | See module for implementation details and extension points.
@graph: id: agent_k.core.exceptions provides: - agent_k.core.exceptions pattern: exception-hierarchy
@agent-guidance: do: - "Use agent_k.core.exceptions as the canonical home for this capability." do_not: - "Create parallel modules without updating @similar or @graph."
@human-review: last-verified: 2026-01-26 owners: - agent-k-core
(c) Mike Casale 2025. Licensed under the MIT License.
AgentKError
Bases: Exception
Base exception for all AGENT-K errors.
All exceptions in the system inherit from this class, enabling
catch-all handling at application boundaries.
@notice: | Base exception for all AGENT-K errors.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-base
rationale: "Root exception with context and recoverability metadata."
Attributes:
| Name | Type | Description |
|---|---|---|
context |
Additional context for debugging. |
|
recoverable |
Whether the error can potentially be recovered. |
Source code in agent_k/core/exceptions.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
AgentError
Bases: AgentKError
Base exception for agent-related errors.
@notice: | Base exception for agent-related errors.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-category
rationale: "Category base for agent execution errors."
Source code in agent_k/core/exceptions.py
93 94 95 96 97 98 99 100 101 102 103 104 105 | |
AgentExecutionError
Bases: AgentError
Raised when agent execution fails.
@notice: | Raised when agent execution fails.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures agent name and cause for debugging."
Source code in agent_k/core/exceptions.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
ToolExecutionError
Bases: AgentError
Raised when a tool execution fails.
@notice: | Raised when a tool execution fails.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures tool name and arguments for debugging."
Source code in agent_k/core/exceptions.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
OutputValidationError
Bases: AgentError
Raised when agent output fails validation.
@notice: | Raised when agent output fails validation.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures validation errors for structured output failures."
Source code in agent_k/core/exceptions.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
AdapterError
Bases: AgentKError
Base exception for adapter-related errors.
@notice: | Base exception for adapter-related errors.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-category
rationale: "Category base for platform adapter errors."
Source code in agent_k/core/exceptions.py
179 180 181 182 183 184 185 186 187 188 189 190 191 | |
PlatformConnectionError
Bases: AdapterError
Raised when connection to platform fails.
@notice: | Raised when connection to platform fails.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures platform name for connection failures."
Source code in agent_k/core/exceptions.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
AuthenticationError
Bases: AdapterError
Raised when platform authentication fails.
@notice: | Raised when platform authentication fails.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Non-recoverable authentication failure."
Source code in agent_k/core/exceptions.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
RateLimitError
Bases: AdapterError
Raised when platform rate limit is exceeded.
@notice: | Raised when platform rate limit is exceeded.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Recoverable with retry_after hint for backoff."
Attributes:
| Name | Type | Description |
|---|---|---|
retry_after |
Seconds to wait before retry. |
Source code in agent_k/core/exceptions.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
CompetitionError
Bases: AgentKError
Base exception for competition-related errors.
@notice: | Base exception for competition-related errors.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-category
rationale: "Category base for Kaggle competition errors."
Source code in agent_k/core/exceptions.py
255 256 257 258 259 260 261 262 263 264 265 266 267 | |
CompetitionNotFoundError
Bases: CompetitionError
Raised when competition does not exist.
@notice: | Raised when competition does not exist.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Non-recoverable missing competition."
Source code in agent_k/core/exceptions.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
CompetitionRulesNotAcceptedError
Bases: CompetitionError
Raised when competition rules have not been accepted.
@notice: | Raised when competition rules have not been accepted.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Non-recoverable until user accepts rules manually."
Source code in agent_k/core/exceptions.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
SubmissionError
Bases: CompetitionError
Raised when submission fails.
@notice: | Raised when submission fails.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures submission context for retry logic."
Source code in agent_k/core/exceptions.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
DeadlinePassedError
Bases: CompetitionError
Raised when competition deadline has passed.
@notice: | Raised when competition deadline has passed.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Non-recoverable deadline expiration."
Source code in agent_k/core/exceptions.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
EvolutionError
Bases: AgentKError
Base exception for evolution-related errors.
@notice: | Base exception for evolution-related errors.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-category
rationale: "Category base for evolutionary algorithm errors."
Source code in agent_k/core/exceptions.py
362 363 364 365 366 367 368 369 370 371 372 373 374 | |
ConvergenceError
Bases: EvolutionError
Raised when evolution fails to converge within limits.
@notice: | Raised when evolution fails to converge within limits.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures evolution progress for analysis."
Source code in agent_k/core/exceptions.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | |
PopulationExtinctError
Bases: EvolutionError
Raised when all population members fail fitness evaluation.
@notice: | Raised when all population members fail fitness evaluation.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Non-recoverable population extinction."
Source code in agent_k/core/exceptions.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
FitnessEvaluationError
Bases: EvolutionError
Raised when fitness evaluation fails.
@notice: | Raised when fitness evaluation fails.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures solution and execution context for debugging."
Source code in agent_k/core/exceptions.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
MemoryError
Bases: AgentKError
Base exception for memory-related errors.
@notice: | Base exception for memory-related errors.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-category
rationale: "Category base for memory and checkpoint errors."
Source code in agent_k/core/exceptions.py
448 449 450 451 452 453 454 455 456 457 458 459 460 | |
CheckpointError
Bases: MemoryError
Raised when checkpoint operations fail.
@notice: | Raised when checkpoint operations fail.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures checkpoint name and operation for debugging."
Source code in agent_k/core/exceptions.py
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
MemoryCapacityError
Bases: MemoryError
Raised when memory capacity is exceeded.
@notice: | Raised when memory capacity is exceeded.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures size metrics for capacity planning."
Source code in agent_k/core/exceptions.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | |
GraphError
Bases: AgentKError
Base exception for graph-related errors.
@notice: | Base exception for graph-related errors.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-category
rationale: "Category base for state machine errors."
Source code in agent_k/core/exceptions.py
509 510 511 512 513 514 515 516 517 518 519 520 521 | |
StateTransitionError
Bases: GraphError
Raised when state transition is invalid.
@notice: | Raised when state transition is invalid.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures transition context for state machine debugging."
Source code in agent_k/core/exceptions.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | |
PhaseTimeoutError
Bases: GraphError
Raised when a phase exceeds its timeout.
@notice: | Raised when a phase exceeds its timeout.
@dev: | See module for implementation details and extension points.
@pattern:
name: exception-specific
rationale: "Captures timing metrics for timeout analysis."
Source code in agent_k/core/exceptions.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | |
classify_error
classify_error(exc: Exception) -> tuple[ErrorCategory, RecoveryStrategy]
Classify errors into recovery categories and strategies.
@notice: | Maps exceptions to error categories and recovery strategies.
@dev: | Used by error handlers to determine retry vs abort behavior. Returns (category, strategy) tuple for the exception type.
Source code in agent_k/core/exceptions.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | |