Skip to main content
Back to Prompt Library
implementation

Build Pydantic AI Variant Triage Agent

Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.

Linked challenge: Pydantic AI Missense Variant Triage with Claude 4 Opus

Format
Code-aware
Lines
15
Sections
4
Linked challenge
Pydantic AI Missense Variant Triage with Claude 4 Opus

Prompt source

Original prompt text with formatting preserved for inspection.

15 lines
4 sections
No variables
0 checklist items
from pydantic import BaseModel, Field
from pydantic_ai import Agent
from typing import List, Literal

class VariantClassification(BaseModel):
    variant_id: str
    classification: Literal['Pathogenic', 'Likely Pathogenic', 'VUS', 'Likely Benign', 'Benign']
    acmg_criteria: List[str]
    confidence: float = Field(ge=0.0, le=1.0)
    rationale: str

agent = Agent(
    'anthropic:claude-3-5-sonnet-20241022',
    result_type=VariantClassification,
    system_prompt='You are an expert clinical geneticist classifying missense variants based on ACMG rules.'
)

# Write the runner function to process input variant annotations

Adaptation plan

Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.

Keep stable

Hold the task contract and output shape stable so generated implementations remain comparable.

Tune next

Update libraries, interfaces, and environment assumptions to match the stack you actually run.

Verify after

Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.