Exceptions
exceptions ¶
Exception hierarchy for gepa-adk.
This module defines the exception hierarchy following ADR-009 guidelines. All gepa-adk specific exceptions inherit from EvolutionError.
| ATTRIBUTE | DESCRIPTION |
|---|---|
EvolutionError | Base exception for all gepa-adk errors. TYPE: |
ConfigurationError | Raised when configuration validation fails. TYPE: |
Examples:
Handling configuration errors:
from gepa_adk.domain.exceptions import ConfigurationError
try:
raise ConfigurationError(
"Invalid value", field="max_iterations", value=-1, constraint=">= 0"
)
except ConfigurationError as e:
print(f"Field: {e.field}, Value: {e.value}")
# Output: Field: max_iterations, Value: -1
Note
The exception hierarchy provides structured error handling with contextual information for debugging and error recovery.
EvolutionError ¶
Bases: Exception
flowchart TD
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Base exception for all gepa-adk errors.
All custom exceptions in gepa-adk should inherit from this class to allow for unified exception handling.
Examples:
Catching evolution errors:
from gepa_adk.domain.exceptions import EvolutionError
try:
raise EvolutionError("Evolution failed unexpectedly")
except EvolutionError as e:
print(f"Caught: {e}")
# Output: Caught: Evolution failed unexpectedly
Note
Always use this base class or its subclasses for domain errors. Standard Python exceptions should still be raised for programming errors (e.g., TypeError, ValueError for developer mistakes).
Source code in src/gepa_adk/domain/exceptions.py
ConfigurationError ¶
Bases: EvolutionError
flowchart TD
gepa_adk.domain.exceptions.ConfigurationError[ConfigurationError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ConfigurationError
click gepa_adk.domain.exceptions.ConfigurationError href "" "gepa_adk.domain.exceptions.ConfigurationError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when configuration validation fails.
This exception is raised during EvolutionConfig initialization when a parameter violates its validation constraints.
| ATTRIBUTE | DESCRIPTION |
|---|---|
field | The name of the configuration field that failed validation. TYPE: |
value | The invalid value that was provided. TYPE: |
constraint | Description of the validation constraint that was violated. TYPE: |
Examples:
Creating a configuration error with context:
from gepa_adk.domain.exceptions import ConfigurationError
error = ConfigurationError(
"max_iterations must be non-negative",
field="max_iterations",
value=-5,
constraint=">= 0",
)
print(error.field, error.value, error.constraint)
# Output: max_iterations -5 >= 0
Note
Arises from user-provided invalid settings, not programming errors. Should be caught and reported with clear guidance on valid values.
Source code in src/gepa_adk/domain/exceptions.py
__init__ ¶
__init__(
message: str,
*,
field: str | None = None,
value: object = None,
constraint: str | None = None,
) -> None
Initialize ConfigurationError with context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
field | Name of the invalid configuration field. TYPE: |
value | The invalid value provided. TYPE: |
constraint | Description of the validation constraint. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string representation with context.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted error message including field and value context. |
Note
Outputs formatted error message with field and value context when available, preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
NoCandidateAvailableError ¶
Bases: EvolutionError
flowchart TD
gepa_adk.domain.exceptions.NoCandidateAvailableError[NoCandidateAvailableError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.NoCandidateAvailableError
click gepa_adk.domain.exceptions.NoCandidateAvailableError href "" "gepa_adk.domain.exceptions.NoCandidateAvailableError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when no candidates are available for selection.
| ATTRIBUTE | DESCRIPTION |
|---|---|
cause | Original exception that caused this error. TYPE: |
context | Extra context (candidate_idx, frontier_type). TYPE: |
Examples:
Note
Arises when candidate selector cannot find any valid candidates from the Pareto frontier, typically due to empty frontier or filtering constraints.
Source code in src/gepa_adk/domain/exceptions.py
__init__ ¶
Initialize NoCandidateAvailableError with context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
cause | Original exception that caused this error. TYPE: |
**context | Additional context such as candidate_idx or frontier_type. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string with context and cause details.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted error message including context and cause information. |
Note
Outputs formatted error message with context dict and cause chain when available, preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
EvaluationError ¶
Bases: EvolutionError
flowchart TD
gepa_adk.domain.exceptions.EvaluationError[EvaluationError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.EvaluationError
click gepa_adk.domain.exceptions.EvaluationError href "" "gepa_adk.domain.exceptions.EvaluationError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when batch evaluation fails.
This exception indicates failures during agent evaluation, such as agent execution errors, timeout, or malformed output.
| ATTRIBUTE | DESCRIPTION |
|---|---|
cause | Original exception that caused this error. TYPE: |
context | Additional context for debugging. TYPE: |
Examples:
Wrapping an ADK error:
from gepa_adk.domain.exceptions import EvaluationError
try:
result = await runner.run_async(...)
except ADKError as e:
raise EvaluationError(
"Agent execution failed",
cause=e,
agent_name="my_agent",
) from e
Note
Always preserves the original cause for debugging while providing a consistent interface for error handling.
Source code in src/gepa_adk/domain/exceptions.py
__init__ ¶
Initialize EvaluationError with cause and context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
cause | Original exception that caused this error. TYPE: |
**context | Additional context for debugging (agent_name, etc.). TYPE: |
Note
Context is passed via keyword arguments. Positional arguments after message are not allowed.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string with cause chain if present.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted message with context and cause information. |
Note
Outputs formatted error message with context dict and cause chain when available, preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
AdapterError ¶
Bases: EvaluationError
flowchart TD
gepa_adk.domain.exceptions.AdapterError[AdapterError]
gepa_adk.domain.exceptions.EvaluationError[EvaluationError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.EvaluationError --> gepa_adk.domain.exceptions.AdapterError
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.EvaluationError
click gepa_adk.domain.exceptions.AdapterError href "" "gepa_adk.domain.exceptions.AdapterError"
click gepa_adk.domain.exceptions.EvaluationError href "" "gepa_adk.domain.exceptions.EvaluationError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when an adapter operation fails.
This exception is used by adapter implementations (e.g., ADKAdapter) for adapter-specific failures such as session errors or configuration issues.
Examples:
Raising an adapter error:
from gepa_adk.domain.exceptions import AdapterError
if not self._session_service:
raise AdapterError(
"Session service unavailable",
adapter="ADKAdapter",
operation="evaluate",
)
Note
AdapterError is a subclass of EvaluationError, so callers can catch either for different granularity of error handling.
Source code in src/gepa_adk/domain/exceptions.py
RestoreError ¶
Bases: AdapterError
flowchart TD
gepa_adk.domain.exceptions.RestoreError[RestoreError]
gepa_adk.domain.exceptions.AdapterError[AdapterError]
gepa_adk.domain.exceptions.EvaluationError[EvaluationError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.AdapterError --> gepa_adk.domain.exceptions.RestoreError
gepa_adk.domain.exceptions.EvaluationError --> gepa_adk.domain.exceptions.AdapterError
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.EvaluationError
click gepa_adk.domain.exceptions.RestoreError href "" "gepa_adk.domain.exceptions.RestoreError"
click gepa_adk.domain.exceptions.AdapterError href "" "gepa_adk.domain.exceptions.AdapterError"
click gepa_adk.domain.exceptions.EvaluationError href "" "gepa_adk.domain.exceptions.EvaluationError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when agent restoration fails after evaluation.
This exception is raised when one or more agent components fail to restore to their original state after candidate evaluation. Uses best-effort restoration: all components are attempted even if some fail, then errors are aggregated into this exception.
| ATTRIBUTE | DESCRIPTION |
|---|---|
errors | List of (qualified_name, exception) pairs for each failed restoration. TYPE: |
Examples:
Handling partial restore failures:
from gepa_adk.domain.exceptions import RestoreError
try:
adapter._restore_agents(originals)
except RestoreError as e:
for qualified_name, error in e.errors:
print(f"Failed to restore {qualified_name}: {error}")
Aggregating restoration failures:
errors = []
for name, original in originals.items():
try:
handler.restore(agent, original)
except Exception as exc:
errors.append((name, exc))
if errors:
raise RestoreError(
f"Failed to restore {len(errors)} components",
errors=errors,
)
Note
As a subclass of AdapterError, this exception indicates that the agent state may be corrupted and manual intervention may be required to reset agents to a known state.
Source code in src/gepa_adk/domain/exceptions.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
__init__ ¶
__init__(
message: str,
*,
errors: list[tuple[str, Exception]],
cause: Exception | None = None,
) -> None
Initialize RestoreError with aggregated failures.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error summary. TYPE: |
errors | List of (qualified_name, exception) pairs for each failed restoration. Must be non-empty when raising this exception. TYPE: |
cause | Optional underlying cause exception. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string with failed component names.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted message including list of failed qualified names. |
Note
Outputs formatted error message with list of failed qualified names, preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
ScoringError ¶
Bases: EvolutionError
flowchart TD
gepa_adk.domain.exceptions.ScoringError[ScoringError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Base exception for all scoring-related errors.
All scoring exceptions inherit from this class to allow for unified exception handling in scoring operations.
| ATTRIBUTE | DESCRIPTION |
|---|---|
cause | Original exception that caused this error. TYPE: |
Examples:
Catching scoring errors:
from gepa_adk.domain.exceptions import ScoringError
try:
score, metadata = await scorer.async_score(...)
except ScoringError as e:
print(f"Scoring failed: {e}")
Note
All scoring exceptions inherit from this base class. ScoringError extends EvolutionError, following ADR-009 exception hierarchy guidelines.
Source code in src/gepa_adk/domain/exceptions.py
__init__ ¶
Initialize ScoringError with message and optional cause.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
cause | Original exception that caused this error. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string with cause chain if present.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted message with cause information. |
Note
Outputs formatted error message with cause chain when available, preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
CriticOutputParseError ¶
Bases: ScoringError
flowchart TD
gepa_adk.domain.exceptions.CriticOutputParseError[CriticOutputParseError]
gepa_adk.domain.exceptions.ScoringError[ScoringError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.ScoringError --> gepa_adk.domain.exceptions.CriticOutputParseError
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
click gepa_adk.domain.exceptions.CriticOutputParseError href "" "gepa_adk.domain.exceptions.CriticOutputParseError"
click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when critic agent output cannot be parsed as valid JSON.
This exception indicates that the critic agent returned output that could not be parsed as JSON or did not conform to the expected schema.
| ATTRIBUTE | DESCRIPTION |
|---|---|
raw_output | The unparseable output from critic. TYPE: |
parse_error | Description of parsing failure. TYPE: |
Examples:
Handling parse errors:
from gepa_adk.domain.exceptions import CriticOutputParseError
try:
score, metadata = await scorer.async_score(...)
except CriticOutputParseError as e:
print(f"Invalid JSON: {e.raw_output}")
print(f"Error: {e.parse_error}")
Note
Arises when critic agent output cannot be parsed as valid JSON. Typically occurs when LLM output doesn't follow structured format despite output_schema being set.
Source code in src/gepa_adk/domain/exceptions.py
__init__ ¶
__init__(
message: str,
*,
raw_output: str,
parse_error: str,
cause: Exception | None = None,
) -> None
Initialize CriticOutputParseError with context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
raw_output | The unparseable output string from critic. TYPE: |
parse_error | Description of the parsing failure. TYPE: |
cause | Original exception that caused this error. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string with parse error details.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted message including parse error and raw output preview. |
Note
Outputs formatted error message with parse error and raw output preview (truncated to 100 chars), preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
OutputParseError ¶
Bases: ScoringError
flowchart TD
gepa_adk.domain.exceptions.OutputParseError[OutputParseError]
gepa_adk.domain.exceptions.ScoringError[ScoringError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.ScoringError --> gepa_adk.domain.exceptions.OutputParseError
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
click gepa_adk.domain.exceptions.OutputParseError href "" "gepa_adk.domain.exceptions.OutputParseError"
click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when agent output cannot be parsed as valid JSON.
This exception indicates that the agent returned output that could not be parsed as JSON.
| ATTRIBUTE | DESCRIPTION |
|---|---|
raw_output | The unparseable output from agent. TYPE: |
parse_error | Description of parsing failure. TYPE: |
Examples:
Handling parse errors:
from gepa_adk.domain.exceptions import OutputParseError
try:
score, metadata = scorer.score(input_text, output)
except OutputParseError as e:
print(f"Invalid JSON: {e.raw_output[:50]}")
print(f"Error: {e.parse_error}")
Note
Arises when agent output cannot be parsed as valid JSON. Typically occurs when LLM output doesn't follow structured format.
Source code in src/gepa_adk/domain/exceptions.py
__init__ ¶
__init__(
message: str,
*,
raw_output: str,
parse_error: str,
cause: Exception | None = None,
) -> None
Initialize OutputParseError with context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
raw_output | The unparseable output string from agent. TYPE: |
parse_error | Description of the parsing failure. TYPE: |
cause | Original exception that caused this error. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string with parse error details.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted message including parse error and raw output preview. |
Note
Outputs formatted error message with parse error and raw output preview (truncated to 100 chars), preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
SchemaValidationError ¶
Bases: ScoringError
flowchart TD
gepa_adk.domain.exceptions.SchemaValidationError[SchemaValidationError]
gepa_adk.domain.exceptions.ScoringError[ScoringError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.ScoringError --> gepa_adk.domain.exceptions.SchemaValidationError
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
click gepa_adk.domain.exceptions.SchemaValidationError href "" "gepa_adk.domain.exceptions.SchemaValidationError"
click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when output fails Pydantic schema validation.
This exception indicates that the agent output was valid JSON but did not conform to the expected Pydantic schema. Also used for schema text validation during output schema evolution.
| ATTRIBUTE | DESCRIPTION |
|---|---|
raw_output | The output that failed validation. TYPE: |
validation_error | Description of validation failure. TYPE: |
line_number | Line number where error occurred (for syntax errors). TYPE: |
validation_stage | Stage where validation failed ("syntax", "structure", or "execution"). TYPE: |
Examples:
Handling schema validation errors:
from gepa_adk.domain.exceptions import SchemaValidationError
try:
score, metadata = scorer.score(input_text, output)
except SchemaValidationError as e:
print(f"Schema mismatch: {e.validation_error}")
if e.line_number:
print(f"Error at line {e.line_number}")
Note
Arises when output is valid JSON but doesn't match the schema. Typically occurs when field types are wrong or required fields have invalid values. For schema evolution, also raised when proposed schema text is syntactically invalid or structurally incorrect (e.g., missing BaseModel inheritance).
Source code in src/gepa_adk/domain/exceptions.py
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | |
__init__ ¶
__init__(
message: str,
*,
raw_output: str,
validation_error: str,
cause: Exception | None = None,
line_number: int | None = None,
validation_stage: str | None = None,
) -> None
Initialize SchemaValidationError with context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
raw_output | The output string that failed validation. TYPE: |
validation_error | Description of the validation failure. TYPE: |
cause | Original exception that caused this error. TYPE: |
line_number | Line number where error occurred (for syntax errors). TYPE: |
validation_stage | Stage where validation failed. One of: - "syntax": Python syntax error - "structure": Missing BaseModel, has imports/functions - "execution": Error during exec() TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string with validation error details.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted message including validation error details. |
Note
Outputs formatted error message with validation error and raw output preview (truncated to 100 chars), preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
MissingScoreFieldError ¶
Bases: ScoringError
flowchart TD
gepa_adk.domain.exceptions.MissingScoreFieldError[MissingScoreFieldError]
gepa_adk.domain.exceptions.ScoringError[ScoringError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.ScoringError --> gepa_adk.domain.exceptions.MissingScoreFieldError
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
click gepa_adk.domain.exceptions.MissingScoreFieldError href "" "gepa_adk.domain.exceptions.MissingScoreFieldError"
click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when score field is missing or null in parsed output.
This exception indicates that the output was successfully parsed and validated, but the required score field is missing or null.
| ATTRIBUTE | DESCRIPTION |
|---|---|
parsed_output | The parsed output without valid score. TYPE: |
available_fields | Fields that were present. TYPE: |
Examples:
Handling missing score field:
from gepa_adk.domain.exceptions import MissingScoreFieldError
try:
score, metadata = await scorer.async_score(...)
except MissingScoreFieldError as e:
print(f"Missing score. Available fields: {e.available_fields}")
Note
Applies when parsed output lacks a valid score value. The parsed_output may contain other valid fields that will be preserved in metadata if score is found.
Source code in src/gepa_adk/domain/exceptions.py
__init__ ¶
Initialize MissingScoreFieldError with parsed output.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
parsed_output | The parsed dict without valid score field. TYPE: |
cause | Original exception that caused this error. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string with available fields.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted message including list of available fields. |
Note
Outputs formatted error message with list of available fields from parsed output, preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
VideoValidationError ¶
Bases: ConfigurationError
flowchart TD
gepa_adk.domain.exceptions.VideoValidationError[VideoValidationError]
gepa_adk.domain.exceptions.ConfigurationError[ConfigurationError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.ConfigurationError --> gepa_adk.domain.exceptions.VideoValidationError
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ConfigurationError
click gepa_adk.domain.exceptions.VideoValidationError href "" "gepa_adk.domain.exceptions.VideoValidationError"
click gepa_adk.domain.exceptions.ConfigurationError href "" "gepa_adk.domain.exceptions.ConfigurationError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when video file validation fails.
This exception is raised during video file processing when a video file does not exist, exceeds size limits, or has an invalid MIME type.
| ATTRIBUTE | DESCRIPTION |
|---|---|
video_path | The path to the video file that failed validation. TYPE: |
field | The configuration field name (default "video"). TYPE: |
constraint | Description of the validation constraint that was violated. TYPE: |
Examples:
Raising a video validation error:
from gepa_adk.domain.exceptions import VideoValidationError
raise VideoValidationError(
"Video file not found",
video_path="/path/to/missing.mp4",
constraint="file must exist",
)
Handling video validation errors:
from gepa_adk.domain.exceptions import VideoValidationError
try:
await video_service.prepare_video_parts(["/bad/path.mp4"])
except VideoValidationError as e:
print(f"Invalid video: {e.video_path}")
print(f"Constraint violated: {e.constraint}")
Note
Arises from video file validation failures during multimodal input processing. File existence, size limits (2GB), and MIME type (video/*) are validated before loading video content.
Source code in src/gepa_adk/domain/exceptions.py
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 | |
__init__ ¶
Initialize VideoValidationError with video file context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
video_path | The path to the video file that failed validation. TYPE: |
field | Name of the configuration field (default "video"). TYPE: |
constraint | Description of the validation constraint violated. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string representation with video path context.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted error message including video_path and constraint. |
Note
Outputs formatted error message with video_path for easy identification of the problematic file in error logs.
Source code in src/gepa_adk/domain/exceptions.py
MultiAgentValidationError ¶
Bases: EvolutionError
flowchart TD
gepa_adk.domain.exceptions.MultiAgentValidationError[MultiAgentValidationError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.MultiAgentValidationError
click gepa_adk.domain.exceptions.MultiAgentValidationError href "" "gepa_adk.domain.exceptions.MultiAgentValidationError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when multi-agent configuration validation fails.
This exception is raised during MultiAgentAdapter initialization when a parameter violates its validation constraints.
| ATTRIBUTE | DESCRIPTION |
|---|---|
field | The name of the configuration field that failed validation. TYPE: |
value | The invalid value that was provided. TYPE: |
constraint | Description of the validation constraint that was violated. TYPE: |
Examples:
Creating a multi-agent validation error:
from gepa_adk.domain.exceptions import MultiAgentValidationError
error = MultiAgentValidationError(
"agents list cannot be empty",
field="agents",
value=[],
constraint="len >= 1",
)
print(error.field, error.value) # agents []
Note
Arises from user-provided invalid multi-agent settings, not programming errors. Should be caught and reported with clear guidance on valid values.
Source code in src/gepa_adk/domain/exceptions.py
__init__ ¶
Initialize MultiAgentValidationError with context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
field | Name of the invalid configuration field. TYPE: |
value | The invalid value provided. TYPE: |
constraint | Description of the validation constraint. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string representation with context.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted error message including field and value context. |
Note
Outputs formatted error message with field, value, and constraint context when available, preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
WorkflowEvolutionError ¶
Bases: EvolutionError
flowchart TD
gepa_adk.domain.exceptions.WorkflowEvolutionError[WorkflowEvolutionError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.WorkflowEvolutionError
click gepa_adk.domain.exceptions.WorkflowEvolutionError href "" "gepa_adk.domain.exceptions.WorkflowEvolutionError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when workflow evolution fails.
This exception is raised during workflow evolution when the workflow structure is invalid or no evolvable agents are found.
| ATTRIBUTE | DESCRIPTION |
|---|---|
workflow_name | Name of the workflow that failed. TYPE: |
cause | Original exception that caused this error. TYPE: |
Examples:
Handling workflow evolution errors:
from gepa_adk.domain.exceptions import WorkflowEvolutionError
try:
result = await evolve_workflow(workflow=empty_workflow, trainset=trainset)
except WorkflowEvolutionError as e:
print(f"Workflow '{e.workflow_name}' failed: {e}")
Note
Arises when workflow contains no LlmAgents or evolution fails during execution. Follows ADR-009 exception hierarchy.
Source code in src/gepa_adk/domain/exceptions.py
__init__ ¶
__init__(
message: str,
*,
workflow_name: str | None = None,
cause: Exception | None = None,
) -> None
Initialize WorkflowEvolutionError with context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
workflow_name | Name of the workflow that failed. TYPE: |
cause | Original exception that caused this error. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string with cause chain if present.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted message with workflow name and cause information. |
Note
Outputs formatted error message including workflow context when available. Preserves cause chain for debugging nested exceptions.
Source code in src/gepa_adk/domain/exceptions.py
ConfigValidationError ¶
Bases: EvolutionError
flowchart TD
gepa_adk.domain.exceptions.ConfigValidationError[ConfigValidationError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ConfigValidationError
click gepa_adk.domain.exceptions.ConfigValidationError href "" "gepa_adk.domain.exceptions.ConfigValidationError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when config validation fails.
This exception is raised during generate_content_config evolution when a proposed config contains invalid parameter values or malformed YAML.
| ATTRIBUTE | DESCRIPTION |
|---|---|
message | Human-readable error message. TYPE: |
errors | List of individual validation errors. TYPE: |
Examples:
Creating a config validation error:
from gepa_adk.domain.exceptions import ConfigValidationError
error = ConfigValidationError(
"Config validation failed",
errors=["temperature must be 0.0-2.0, got 3.0"],
)
print(error.errors) # ["temperature must be 0.0-2.0, got 3.0"]
Note
Arises when proposed config values violate parameter constraints or when YAML parsing fails. Should be caught and logged as a warning, with the original config preserved.
Source code in src/gepa_adk/domain/exceptions.py
__init__ ¶
Initialize ConfigValidationError with context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
errors | List of individual validation errors. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string representation with errors.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted error message including list of validation errors. |
Note
Outputs formatted error message with validation errors list when available, preserving base message structure.
Source code in src/gepa_adk/domain/exceptions.py
InvalidScoreListError ¶
Bases: ScoringError
flowchart TD
gepa_adk.domain.exceptions.InvalidScoreListError[InvalidScoreListError]
gepa_adk.domain.exceptions.ScoringError[ScoringError]
gepa_adk.domain.exceptions.EvolutionError[EvolutionError]
gepa_adk.domain.exceptions.ScoringError --> gepa_adk.domain.exceptions.InvalidScoreListError
gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
click gepa_adk.domain.exceptions.InvalidScoreListError href "" "gepa_adk.domain.exceptions.InvalidScoreListError"
click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
Raised when score list is empty or contains non-finite values.
This exception is raised during acceptance score aggregation when the evaluation batch scores are empty or contain NaN/inf values that would invalidate acceptance decisions.
| ATTRIBUTE | DESCRIPTION |
|---|---|
scores | The invalid score list that caused the error. TYPE: |
reason | Description of why the scores are invalid ("empty" or "non-finite"). TYPE: |
Examples:
Handling invalid score lists:
from gepa_adk.domain.exceptions import InvalidScoreListError
try:
acceptance_score = aggregate_scores(scores)
except InvalidScoreListError as e:
print(f"Invalid scores: {e.reason}, scores: {e.scores}")
Note
Arises when evaluation batch scores cannot be aggregated for acceptance. Empty batches or non-finite values would corrupt evolution decisions.
Source code in src/gepa_adk/domain/exceptions.py
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 | |
__init__ ¶
__init__(
message: str,
*,
scores: list[float],
reason: str,
cause: Exception | None = None,
) -> None
Initialize InvalidScoreListError with context.
| PARAMETER | DESCRIPTION |
|---|---|
message | Human-readable error description. TYPE: |
scores | The invalid score list. TYPE: |
reason | Why the scores are invalid ("empty" or "non-finite"). TYPE: |
cause | Original exception that caused this error. TYPE: |
Note
Context fields use keyword-only syntax to ensure explicit labeling.
Source code in src/gepa_adk/domain/exceptions.py
__str__ ¶
Return string with score list and reason.
| RETURNS | DESCRIPTION |
|---|---|
str | Formatted message including reason and score list preview. |
Note
Outputs formatted error message with reason and score list preview (first 5 scores), preserving base message structure.