Skip to content

Building AI agents, atomically

Fix optional config typing and prepare v2.13.1 (#320)

Kenny Vaneetvelde29c7e8126d93
diff --git a/.claude/.codebase-info/.map-state.json b/.claude/.codebase-info/.map-state.json
index 7f48e90..8cd7700 100644
--- a/.claude/.codebase-info/.map-state.json
+++ b/.claude/.codebase-info/.map-state.json
@@ -3,7 +3,7 @@
"tool": "codebase-mapper",
"version": "2.15.10",
"mappedAt": "2026-10-19",
- "gitCommit": "ad832783b1e44cd7bc6a9f6e5082f17973d3b52a",
+ "gitCommit": "3fe4b3bd5b52a4291ff90b99a0275efd27eb5439",
"documents": [
"architecture.md",
"coding-style.md",
@@ -17,7 +17,7 @@
"tech-landscape.md"
],
"hashes": {
- "INDEX.md": "0f0d07b6cf36163041d1d66ef094d566b2c3eb2f52abe7fd5151e4b261ec5266",
+ "INDEX.md": "d9cca4a80c1f3e7be5b90aed54191ec5a6ec3b95106e132603cbd0e78a911b57",
"architecture.md": "59d1265c89d3b42671b7c47165408625018537c016a72df421113cae3f80bb70",
"coding-style.md": "b63e8dff06d16a2d882f02624c62f490291317aec8b3032f6d79b3ee035e8567",
"communication.md": "70fbeedf239b130cfd3d7a92f27d56e96b207d85117b2f83cc9eef8ec6d6c6b3",
@@ -26,7 +26,7 @@
"entry-points.md": "3c94fd8a821fc76789794b6d3f4d89cc88a7903055755d97437f9f3ca6193cb6",
"modules.md": "cd4f81f8ce74dfc4a7bab15ba91dc569245bc342ddf494845d658b51a0a1dc51",
"onboarding.md": "3d28c671dc095a2aadb297bd7ab200c677779a99c7534e03e55a3d64c935f07e",
- "patterns.md": "f1e2294ca48a04e9d3ce8f1e37c39e286b1b2298169004f48ceaa32cf680bb87",
- "tech-landscape.md": "f7101adf177e947d5e765984326247bbbd898a46cb66bd10f49300093c391ecc"
+ "patterns.md": "09d04b9b8d079ac4ce9e1f5ddafabb6f3faf53b5ef48dca1c2d62d0875e149b0",
+ "tech-landscape.md": "ecb344a05ea1577b1ed24d98e8cb0606053f9dd0bec10af1d211863d251ca6de"
}
}
diff --git a/.claude/.codebase-info/INDEX.md b/.claude/.codebase-info/INDEX.md
index 5c9599c..f4c21a0 100644
--- a/.claude/.codebase-info/INDEX.md
+++ b/.claude/.codebase-info/INDEX.md
@@ -1,6 +1,6 @@
# Codebase Map — Atomic Agents
-*Last Updated: 2026-10-19*
+*Last Updated: 2026-10-20*
Atomic Agents is a lightweight, modular Python framework for building agentic AI applications as
composable, schema-driven building blocks (built on Instructor + Pydantic). This repository is a
@@ -8,7 +8,7 @@ composable, schema-driven building blocks (built on Instructor + Pydantic). This
**Stack:** Python ≥3.12 · Instructor · Pydantic v2 · LiteLLM · MCP · Textual · uv + Hatchling · Pyright · `VideoURL` multimodal content · optional OpenInference tracing (Phoenix)
**Shape:** Monorepo — `atomic-agents/` (core lib) · `atomic-assembler/` (CLI) · `atomic-forge/` (tools) · `atomic-examples/` (examples)
-**Package:** `atomic-agents` v2.13.0 · core import package is `atomic_agents`
+**Package:** `atomic-agents` v2.13.1 · core import package is `atomic_agents`
## Documents
diff --git a/.claude/.codebase-info/patterns.md b/.claude/.codebase-info/patterns.md
index 1caa64a..3bbbd01 100644
--- a/.claude/.codebase-info/patterns.md
+++ b/.claude/.codebase-info/patterns.md
@@ -1,6 +1,6 @@
# Patterns & Conventions
-*Last Updated: 2026-10-19*
+*Last Updated: 2026-10-20*
## Atomicity
Build with small, single-purpose, composable parts ("LEGO blocks"): each agent, tool, and context
@@ -55,6 +55,7 @@ the next's input. See `atomic-examples/deep-research` and `orchestration-agent`.
- MCP tests use real SDK result models with mocked transport/session boundaries. Synthetic execution against production filenames is not used to increase coverage.
## Configuration
+- Use explicit `Field(default=...)` for public config defaults so static type checkers infer optional constructor arguments. The AgentConfig constructor regression covers direct calls and typed settings unpacking.
- Omitted `BaseTool`, `BaseResource`, and `BasePrompt` configurations are created per instance.
Explicitly supplied configuration objects retain their identity.
- Runtime config is explicit via `AgentConfig` (client, model, history, roles, mode,
diff --git a/.claude/.codebase-info/tech-landscape.md b/.claude/.codebase-info/tech-landscape.md
index c2b29cf..7212db5 100644
--- a/.claude/.codebase-info/tech-landscape.md
+++ b/.claude/.codebase-info/tech-landscape.md
@@ -1,6 +1,6 @@
# Technology Landscape
-*Last Updated: 2026-10-19*
+*Last Updated: 2026-10-20*
## Source-of-Truth Files
@@ -38,7 +38,7 @@
- **CI (GitHub Actions):**
- `code-quality.yml` — on push/PR to `main`/`v2.0`, three jobs: `quality` (`uv sync`,
- `black --check` and `flake8` across all four project directories, then
+ `black --check` and `flake8` across all four project directories, a focused Pyright 1.1.414 constructor check, then
`pytest --cov=atomic_agents` for the core); `fresh-install` (build the wheel, install
it with the observability extra into a clean venv without the lockfile, import every module under
`atomic_agents`, which is what a new user's `pip install` sees); `lowest-versions` (resolve runtime
diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml
index ee3958b..3945d5c 100644
--- a/.github/workflows/code-quality.yml
+++ b/.github/workflows/code-quality.yml
@@ -54,6 +54,9 @@ jobs:
run: uv run flake8 --extend-exclude=.venv atomic-agents atomic-assembler atomic-examples atomic-forge
if: success()
+ - name: Check AgentConfig constructor typing
+ run: uvx --from pyright==1.1.414 pyright atomic-agents/tests/agents/test_config_defaults_typing.py
+
- name: Run Tests
run: uv run pytest --cov=atomic_agents atomic-agents
if: success()
diff --git a/.release/2.13.1.md b/.release/2.13.1.md
new file mode 100644
index 0000000..2b51036
--- /dev/null
+++ b/.release/2.13.1.md
@@ -0,0 +1,6 @@
+## Fixes
+
+- Make `AgentConfig.model_api_parameters` and `AgentConfig.max_context_tokens` optional to Pyright and Pylance by declaring their defaults explicitly as `Field(default=None, ...)`.
+- Cover direct construction and `TypedDict` unpacking with a focused Pyright check and runtime regression test.
+
+Runtime defaults remain `None`. Dependency requirements are unchanged. OpenTelemetry auto-discovery is separate work and is not included in this release.
diff --git a/atomic-agents/atomic_agents/agents/atomic_agent.py b/atomic-agents/atomic_agents/agents/atomic_agent.py
index 95bac03..bf31405 100644
--- a/atomic-agents/atomic_agents/agents/atomic_agent.py
+++ b/atomic-agents/atomic_agents/agents/atomic_agent.py
@@ -94,9 +94,9 @@ class AgentConfig(BaseModel):
)
model_config = {"arbitrary_types_allowed": True}
mode: Mode = Field(default=Mode.TOOLS, description="The Instructor mode used for structured outputs (TOOLS, JSON, etc.).")
- model_api_parameters: Optional[dict] = Field(None, description="Additional parameters passed to the API provider.")
+ model_api_parameters: Optional[dict] = Field(default=None, description="Additional parameters passed to the API provider.")
max_context_tokens: Optional[int] = Field(
- None,
+ default=None,
description=(
"Maximum tokens for the full context (system prompt + history + tools). "
"When exceeded, oldest conversation turns are automatically trimmed to stay within limit. "
diff --git a/atomic-agents/tests/agents/test_config_defaults_typing.py b/atomic-agents/tests/agents/test_config_defaults_typing.py
new file mode 100644
index 0000000..37eb322
--- /dev/null
+++ b/atomic-agents/tests/agents/test_config_defaults_typing.py
@@ -0,0 +1,21 @@
+from typing import TypedDict
+
+import instructor
+from openai import OpenAI
+
+from atomic_agents import AgentConfig
+
+
+class ModelSettings(TypedDict):
+ model: str
+
+
+def test_optional_agent_settings_have_defaults() -> None:
+ settings: ModelSettings = {"model": "test-model"}
+ with OpenAI(api_key="synthetic-test-key") as provider_client:
+ client = instructor.from_openai(provider_client)
+ direct_configuration = AgentConfig(client=client, model="test-model")
+ unpacked_configuration = AgentConfig(client=client, **settings)
+
+ assert (direct_configuration.model_api_parameters, direct_configuration.max_context_tokens) == (None, None)
+ assert (unpacked_configuration.model_api_parameters, unpacked_configuration.max_context_tokens) == (None, None)
diff --git a/pyproject.toml b/pyproject.toml
index 9c606cf..239056e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "atomic-agents"
-version = "2.13.0"
+version = "2.13.1"
description = "A versatile framework for creating and managing intelligent agents."
readme = "README.md"
license = "MIT"
diff --git a/uv.lock b/uv.lock
index b062de4..3d34942 100644
--- a/uv.lock
+++ b/uv.lock
@@ -267,7 +267,7 @@ wheels = [
[[package]]
name = "atomic-agents"
-version = "2.13.0"
+version = "2.13.1"
source = { editable = "." }
dependencies = [
{ name = "gitpython" },