Skip to content

prompts

agentic_ml.research.prompts

System and kickoff prompts for the research agent.

These are plain strings with no LLM dependency, so they can be unit-tested directly.

build_system_prompt

build_system_prompt(
    task: Task, schema_text: str, config: ResearchConfig
) -> str

Compose the full system prompt from the base template and task-specific sections.

Source code in src/agentic_ml/research/prompts.py
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
def build_system_prompt(task: Task, schema_text: str, config: ResearchConfig) -> str:
    """Compose the full system prompt from the base template and task-specific sections."""
    sections = [
        _BASE_INSTRUCTIONS.format(primary_metric=config.primary_metric),
        f"## Task\n{task.role_description()}",
        f"## Guidance\n{task.guidance()}",
        f"## Model contract\n{task.model_contract_doc()}",
        f"## Dataset schema\n{schema_text}",
        (
            "## Objective\n"
            f"Primary metric: {config.primary_metric} "
            f"({'maximize' if config.maximize else 'minimize'}). "
            f"Also tracked: {', '.join(config.metrics)}."
        ),
    ]
    return "\n\n".join(sections)

build_kickoff_prompt

build_kickoff_prompt(config: ResearchConfig) -> str

Build the first user message that starts the loop.

Source code in src/agentic_ml/research/prompts.py
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
def build_kickoff_prompt(config: ResearchConfig) -> str:
    """Build the first user message that starts the loop."""
    lines = [
        f"Run up to {config.iterations} experiment iterations to optimize {config.primary_metric}.",
        (
            "This is a fresh iteration budget starting now, independent of any previous run: "
            "if an earlier tool result in this conversation said the budget was spent and to "
            "call finish_research, that no longer applies — you now have "
            f"{config.iterations} new iterations available."
        ),
    ]
    if config.ideas:
        lines.append(f"The user specifically wants you to explore these ideas:\n{config.ideas}")
    lines.append(
        "Start by proposing your first trial. If you have already tried something, "
        "continue from where you left off."
    )
    return "\n\n".join(lines)