Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agentdescent/agent_society.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import ast
import statistics
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple, Union

from .evolution import EvolutionResult, Task, evolve
from .meta import MetaOutcome, slot_reflector
Expand Down
6 changes: 5 additions & 1 deletion agentdescent/async_evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import time
import warnings
from concurrent.futures import ThreadPoolExecutor
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TYPE_CHECKING

from .advantage import GroupAdvantage
from .agents import Usage
Expand All @@ -59,6 +59,10 @@
from .pipeline import EarlyStop, FirstError, StallGuard, WorkerHealth, describe
from .staleness import StaleAction, StalenessPolicy, get_policy

if TYPE_CHECKING: # annotations only: no runtime import, no cycle risk
from .evolve_settings import BudgetSettings, ObservabilitySettings, RuntimeSettings
from .evolution import EvolvingArtifact


def _async_allocator_context(diff, advantage, blast_radius: float = 0.2) -> Any:
"""Build an :class:`~agentdescent.allocator.AllocatorContext` at an async
Expand Down
5 changes: 4 additions & 1 deletion agentdescent/audit/wiring.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

import warnings
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, Iterable, Optional, Sequence, Union
from typing import Any, Callable, Dict, Iterable, Optional, Sequence, TYPE_CHECKING, Union

from .calibrator import Calibrator, Rectification
from .gate import RectifiedAcceptance, VerifierWatch
Expand All @@ -46,6 +46,9 @@
from .store import AuditStore
from .tap import AuditedReward, RenderTap

if TYPE_CHECKING: # annotations only: no runtime import, no cycle risk
from .boost import VerifierBoost

__all__ = ["Audit", "attach"]


Expand Down
5 changes: 4 additions & 1 deletion agentdescent/budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
import math
import threading
from dataclasses import dataclass, field
from typing import Any, Callable, Optional
from typing import Any, Callable, Optional, TYPE_CHECKING

if TYPE_CHECKING: # annotations only: no runtime import, no cycle risk
from .agents import Completion


#: Where the fusion tournament stops being built: 75% of the budget spent.
Expand Down
2 changes: 1 addition & 1 deletion agentdescent/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import math
import random
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, List, Mapping, Sequence, Tuple
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple

__all__ = ["EvaluationReport", "EvaluationRow", "evaluate"]

Expand Down
11 changes: 9 additions & 2 deletions agentdescent/evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
import warnings
from dataclasses import asdict, dataclass, field, replace as _replace
from typing import (
Any, Callable, Dict, List, Mapping, Optional, Protocol, Sequence, Tuple,
runtime_checkable,
TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional, Protocol,
Sequence, Tuple, runtime_checkable,
)

from .agents import Completion, Usage, claude
Expand All @@ -62,6 +62,13 @@
from .staleness import StalenessPolicy
from .budget import BudgetGovernor, BudgetStop, CallBudget

if TYPE_CHECKING: # annotations only: no runtime import, no cycle risk
from .budget import CallLimit
from .evolve_settings import BudgetSettings, ObservabilitySettings, RuntimeSettings
from .evolvable import VersionVector
from .parallel import ParallelStrategy
from .trajectory import TrajectoryStore


# ---------------------------------------------------------------------------
# Task + actor
Expand Down
2 changes: 1 addition & 1 deletion agentdescent/evolve_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

if TYPE_CHECKING:
from .agents import Usage
from .budget import CallBudget
from .budget import CallBudget, CallLimit
from .evolution import RoundInfo
from .trajectory import TrajectoryStore

Expand Down
5 changes: 4 additions & 1 deletion agentdescent/evolvespec.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import os
import shlex
from dataclasses import dataclass, field, asdict, replace
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple, Union
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple, TYPE_CHECKING, Union

from . import algorithms as _algorithms
from .agents import Completion, Usage, WorkspaceAgent
Expand All @@ -71,6 +71,9 @@
from .treestrategy import FileTree, tree_reflector
from .workspec import DEFAULT_ALLOWED_PREFIXES, Ref, RefError

if TYPE_CHECKING: # annotations only: no runtime import, no cycle risk
from .budget import CallLimit

__all__ = [
"KINDS",
"KIND_ROWS",
Expand Down
5 changes: 4 additions & 1 deletion agentdescent/proofs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
import math
import time
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TYPE_CHECKING

if TYPE_CHECKING: # annotations only: no runtime import, no cycle risk
from .invariants import Invariant

__all__ = [
"ProofInvariant",
Expand Down
2 changes: 1 addition & 1 deletion agentdescent/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import threading
from collections import defaultdict
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Tuple
from typing import Any, Dict, List, Optional, Sequence, Tuple

from .stats import difficulty_weight, ucb_score

Expand Down
1 change: 1 addition & 0 deletions agentdescent/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from __future__ import annotations

import math
import random
from dataclasses import dataclass, field
from typing import (
Dict, List, Mapping, Optional, Protocol, Sequence, Set, Tuple,
Expand Down
5 changes: 4 additions & 1 deletion agentdescent/selfplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@

import random
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TYPE_CHECKING

from .evolution import (
EvolutionResult, Propose, Reward, Run, Strategy, Task, evolve,
)
from .sampling import TaskSampler

if TYPE_CHECKING: # annotations only: no runtime import, no cycle risk
from .evolution import RoundInfo

__all__ = ["Challenger", "ChallengerConfig", "FrontierSampler", "curriculum_evolve"]


Expand Down
11 changes: 11 additions & 0 deletions changelog.d/1203-annotation-names.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Fixed
Sixteen annotation names `agentdescent` uses in annotations that nothing bound at
module scope now resolve there: `Union`, `Optional` and `Sequence` join existing
`typing` imports, `selection.py` gets a plain `import random`, and twelve
cycle-prone cross-module names sit behind `if TYPE_CHECKING:` blocks (seven new,
one extended). Static readers -- a type checker, a schema generator, the new
`tests/test_annotation_names.py` sweep -- now resolve all 24 sites. Runtime
`typing.get_type_hints()` is unchanged for the twelve names kept behind
`if TYPE_CHECKING:` (that block does not execute), which is why the issue scopes
this as AST-level; no annotation text, signature or generated API text changes
(#1203).
Loading
Loading