跳转至

Config

Auto-generated from source docstrings (mkdocstrings). The complete public contract is agentmaker.__all__ plus each subpackage __all__.

agentmaker.config

Config aggregation plus serialization primitives.

AgentmakerConfig: the "set defaults in one place / tune in one file" entry point that bundles the per-subsystem frozen sub-configs together.

It is a pure holder: frozen, with no module-level instance, and components do not depend on it (each component depends on its own narrow sub-config, which the from_config classmethods (Memory/RagRetriever/IngestionPipeline) slice out and hand down). to_dict/from_dict use a hand-written recursion (not dataclasses.asdict, whose internal deepcopy raises TypeError on MappingProxyType).

Where config lives (a two-layer rule): - Subsystem knobs (top_k / chunk / weights / halflife / keep_recent / rrf_k / mq / summary_top_k ...) go into the sub-configs here. - Single-instance settings (CLITool(timeout=) / OpenAIEmbedder(dimensions=) / Tracer(max_value_len=) ...) go into that component's own constructor argument, not here.

AgentmakerConfig dataclass

AgentmakerConfig(chunking: ChunkingConfig = ChunkingConfig(), retrieval: RetrievalConfig = RetrievalConfig(), rag: RagConfig = RagConfig(), memory: MemoryConfig = MemoryConfig(), reducer: ReducerConfig = ReducerConfig(), compaction: CompactionConfig = CompactionConfig(), context: ContextConfig = ContextConfig(), window_budget: WindowBudgetConfig = WindowBudgetConfig(), tool_retrieval: ToolRetrievalConfig = ToolRetrievalConfig())

The developer's "set defaults in one place / tune in one file" aggregation entry: a pure holder of the narrow sub-configs.

No logic, no module-level instance, and components do not depend on it (each component depends on its own narrow sub-config, sliced out and handed down by that class's from_config). Usage: an app/script instantiates one at the assembly root and passes it explicitly to each component (or wires it in one line via each class's from_config); to persist to a file, use to_dict / from_dict.

to_dict

to_dict() -> dict

Export to a plain dict (json.dumps-able / persistable to a file).

from_dict classmethod

from_dict(d: Mapping) -> AgentmakerConfig

Restore from a dict (read from JSON / YAML / env-assembled): fail loud on unknown top-level keys, fall back to defaults on missing keys.

for_window

for_window(context_window, *, use_ratio: float = 0.5, fallback_window=None) -> AgentmakerConfig

Derive a new instance with context.max_tokens set from the model's window (solving the AgentmakerConfig() out-of-the-box problem).

Keeps the other context fields (mmr_lambda / source_ratios ...) and only sets max_tokens.

validate

validate() -> None

Independent range validation of each sub-config (pure read-only assertions, no business logic: this is the god-object boundary).

Note: cross-subsystem checks that need _PREFIX_TOKENS (such as "per-source context quota vs chunk-render accounting") stay in ContextBuilder (only there is the render accounting available); AgentmakerConfig does not duplicate them, to avoid accounting drift.