Skip to content

Commit 8e5157e

Browse files
andreisavuclaude
andauthored
Upgrade to weakincentives v0.27.0 and apply breaking changes (#13)
Move task_completion_checker from ClaudeAgentSDKClientConfig to PromptTemplate, matching the new prompt-scoped declaration model. Update imports to use weakincentives.prompt for TaskCompletionContext and TaskCompletionResult. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent dc1be4c commit 8e5157e

4 files changed

Lines changed: 22 additions & 26 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ include = ["src"]
4141
typeCheckingMode = "strict"
4242

4343
[tool.uv.sources]
44-
weakincentives = { git = "https://github.com/weakincentives/weakincentives.git", tag = "v0.26.0" }
44+
weakincentives = { git = "https://github.com/weakincentives/weakincentives.git", tag = "v0.27.0" }
4545

4646
[dependency-groups]
4747
dev = [
@@ -51,6 +51,6 @@ dev = [
5151
"pytest-timeout",
5252
"pyright",
5353
"ruff",
54-
"weakincentives[wink] @ git+https://github.com/weakincentives/weakincentives.git@v0.26.0",
54+
"weakincentives[wink] @ git+https://github.com/weakincentives/weakincentives.git@v0.27.0",
5555
"pytest-rerunfailures>=16.1",
5656
]

src/trivia_agent/adapters.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
handles task completion, and manages execution isolation.
66
77
Key components:
8-
- ``SimpleTaskCompletionChecker``: Pass-through completion checker
8+
- ``SimpleTaskCompletionChecker``: Pass-through completion checker (used by prompt)
99
- ``create_adapter``: Factory function to build configured adapters
1010
1111
The default model is Claude Sonnet, accessed via the "sonnet" alias.
@@ -20,12 +20,9 @@
2020

2121
from typing import TYPE_CHECKING
2222

23-
from weakincentives.adapters.claude_agent_sdk import (
24-
ClaudeAgentSDKAdapter,
25-
TaskCompletionContext,
26-
TaskCompletionResult,
27-
)
23+
from weakincentives.adapters.claude_agent_sdk import ClaudeAgentSDKAdapter
2824
from weakincentives.adapters.claude_agent_sdk.config import ClaudeAgentSDKClientConfig
25+
from weakincentives.prompt import TaskCompletionContext, TaskCompletionResult
2926

3027
from trivia_agent.models import TriviaResponse
3128

@@ -87,15 +84,17 @@ def create_adapter(
8784
"""Create and configure a Claude Agent SDK adapter for the trivia agent.
8885
8986
Factory function that assembles all components needed to run the trivia
90-
agent: model selection, task completion checking, isolation configuration,
91-
and working directory setup. The returned adapter is ready to be passed
92-
to a WINK AgentLoop or EvalLoop.
87+
agent: model selection, isolation configuration, and working directory
88+
setup. The returned adapter is ready to be passed to a WINK AgentLoop
89+
or EvalLoop.
9390
9491
The adapter is configured with:
9592
- Model: Claude Sonnet (via the "sonnet" alias)
96-
- Completion checker: SimpleTaskCompletionChecker (always succeeds)
9793
- Response type: TriviaResponse (structured output schema)
9894
95+
Note: Task completion checking is declared on the PromptTemplate (see
96+
agent_loop.py), not on the adapter config.
97+
9998
Args:
10099
isolation: Optional isolation configuration that controls the agent's
101100
execution environment. When provided, specifies:
@@ -119,9 +118,7 @@ def create_adapter(
119118
>>> # Use adapter with AgentLoop
120119
>>> loop = AgentLoop.create(adapter=adapter, sections=[...])
121120
"""
122-
checker = SimpleTaskCompletionChecker()
123121
client_config = ClaudeAgentSDKClientConfig(
124-
task_completion_checker=checker,
125122
isolation=isolation,
126123
cwd=cwd,
127124
)

src/trivia_agent/agent_loop.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from weakincentives.runtime.mailbox import Mailbox
3838
from weakincentives.skills import SkillMount
3939

40-
from trivia_agent.adapters import create_adapter
40+
from trivia_agent.adapters import SimpleTaskCompletionChecker, create_adapter
4141
from trivia_agent.config import load_redis_settings
4242
from trivia_agent.feedback import build_feedback_providers
4343
from trivia_agent.isolation import API_KEY_ENV, has_auth, resolve_isolation_config, resolve_skills
@@ -193,6 +193,7 @@ def build_prompt_template(
193193
build_task_examples_section(), # Multi-step workflow examples
194194
],
195195
feedback_providers=build_feedback_providers(),
196+
task_completion_checker=SimpleTaskCompletionChecker(),
196197
)
197198

198199

@@ -337,6 +338,7 @@ def prepare(
337338
workspace_section, # Session-bound workspace access
338339
],
339340
feedback_providers=build_feedback_providers(),
341+
task_completion_checker=SimpleTaskCompletionChecker(),
340342
)
341343

342344
# Determine overrides tag from experiment

tests/trivia_agent/test_adapters.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
from unittest.mock import MagicMock
44

5-
from weakincentives.adapters.claude_agent_sdk import (
6-
ClaudeAgentSDKAdapter,
7-
TaskCompletionResult,
8-
)
5+
from weakincentives.adapters.claude_agent_sdk import ClaudeAgentSDKAdapter
6+
from weakincentives.prompt import TaskCompletionResult
97

108
from trivia_agent.adapters import SimpleTaskCompletionChecker, create_adapter
119

@@ -44,14 +42,13 @@ def test_adapter_uses_default_model(self) -> None:
4442
assert adapter is not None
4543

4644
def test_adapter_has_client_config(self) -> None:
47-
"""Test that adapter is configured with task completion checker."""
45+
"""Test that adapter is configured with client config."""
4846
adapter = create_adapter()
49-
# Verify adapter was created with client config
47+
# Verify adapter was created with client config (no task_completion_checker —
48+
# that's now on the PromptTemplate)
5049
assert adapter._client_config is not None
51-
assert adapter._client_config.task_completion_checker is not None
5250

53-
def test_adapter_task_completion_checker_is_simple_checker(self) -> None:
54-
"""Test that the task completion checker is SimpleTaskCompletionChecker."""
51+
def test_adapter_no_task_completion_on_client_config(self) -> None:
52+
"""Test that task completion checker is not on client config (moved to prompt)."""
5553
adapter = create_adapter()
56-
checker = adapter._client_config.task_completion_checker
57-
assert isinstance(checker, SimpleTaskCompletionChecker)
54+
assert not hasattr(adapter._client_config, "task_completion_checker")

0 commit comments

Comments
 (0)