task
agentic_ml.core.task
¶
The :class:Task strategy: the single extension point for new ML problems.
A task encapsulates everything problem-specific: the agent prompt sections, the metrics and
their direction, how data partitions are built, and the (otherwise fixed) evaluation scheme.
Adding a new kind of problem means subclassing :class:Task; nothing else in core or
research needs to change.
Task
¶
Bases: ABC
Base class describing one machine-learning problem type.
role_description
abstractmethod
¶
role_description() -> str
One or two sentences describing the agent's role for this task.
Source code in src/agentic_ml/core/task.py
31 32 33 | |
guidance
abstractmethod
¶
guidance() -> str
Task-specific tips that steer the experimentation loop.
Source code in src/agentic_ml/core/task.py
35 36 37 | |
model_contract_doc
¶
model_contract_doc() -> str
The interface the generated model.py must implement (usually the default).
Source code in src/agentic_ml/core/task.py
39 40 41 | |
default_metrics
abstractmethod
¶
default_metrics() -> list[str]
Metrics tracked by default when the user does not specify any.
Source code in src/agentic_ml/core/task.py
44 45 46 | |
primary_metric
abstractmethod
¶
primary_metric() -> str
The metric used to select the best trial.
Source code in src/agentic_ml/core/task.py
48 49 50 | |
maximize
¶
maximize() -> bool
Whether the primary metric is better when larger.
Source code in src/agentic_ml/core/task.py
52 53 54 | |
build_partitions
¶
build_partitions(
x_data: DataFrame,
y_data: Series,
user_partitions: list[Partition] | None,
n_splits: int,
seed: int,
) -> list[Partition]
Return the train/validation index splits used to score a trial.
Defaults to shuffled K-Fold. Override for task-specific schemes (e.g. stratified folds for classification, or time-ordered splits for forecasting).
Source code in src/agentic_ml/core/task.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
evaluate_trial
¶
evaluate_trial(
trial_id: str, ctx: ResearchContext
) -> EvaluationResult
Score a trial with the fixed, task-owned evaluation scheme.
Source code in src/agentic_ml/core/task.py
77 78 79 80 81 82 83 84 85 86 87 88 89 | |
extra_tools
¶
extra_tools(ctx: ResearchContext) -> list
Optional task-specific Strands tools, composed with the base tools.
Source code in src/agentic_ml/core/task.py
92 93 94 | |