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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ include = ["src"]
typeCheckingMode = "strict"

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

[dependency-groups]
dev = [
Expand All @@ -51,6 +51,6 @@ dev = [
"pytest-timeout",
"pyright",
"ruff",
"weakincentives[wink] @ git+https://github.com/weakincentives/weakincentives.git@v0.26.0",
"weakincentives[wink] @ git+https://github.com/weakincentives/weakincentives.git@v0.27.0",
"pytest-rerunfailures>=16.1",
]
21 changes: 9 additions & 12 deletions src/trivia_agent/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
handles task completion, and manages execution isolation.

Key components:
- ``SimpleTaskCompletionChecker``: Pass-through completion checker
- ``SimpleTaskCompletionChecker``: Pass-through completion checker (used by prompt)
- ``create_adapter``: Factory function to build configured adapters

The default model is Claude Sonnet, accessed via the "sonnet" alias.
Expand All @@ -20,12 +20,9 @@

from typing import TYPE_CHECKING

from weakincentives.adapters.claude_agent_sdk import (
ClaudeAgentSDKAdapter,
TaskCompletionContext,
TaskCompletionResult,
)
from weakincentives.adapters.claude_agent_sdk import ClaudeAgentSDKAdapter
from weakincentives.adapters.claude_agent_sdk.config import ClaudeAgentSDKClientConfig
from weakincentives.prompt import TaskCompletionContext, TaskCompletionResult

from trivia_agent.models import TriviaResponse

Expand Down Expand Up @@ -87,15 +84,17 @@ def create_adapter(
"""Create and configure a Claude Agent SDK adapter for the trivia agent.

Factory function that assembles all components needed to run the trivia
agent: model selection, task completion checking, isolation configuration,
and working directory setup. The returned adapter is ready to be passed
to a WINK AgentLoop or EvalLoop.
agent: model selection, isolation configuration, and working directory
setup. The returned adapter is ready to be passed to a WINK AgentLoop
or EvalLoop.

The adapter is configured with:
- Model: Claude Sonnet (via the "sonnet" alias)
- Completion checker: SimpleTaskCompletionChecker (always succeeds)
- Response type: TriviaResponse (structured output schema)

Note: Task completion checking is declared on the PromptTemplate (see
agent_loop.py), not on the adapter config.

Args:
isolation: Optional isolation configuration that controls the agent's
execution environment. When provided, specifies:
Expand All @@ -119,9 +118,7 @@ def create_adapter(
>>> # Use adapter with AgentLoop
>>> loop = AgentLoop.create(adapter=adapter, sections=[...])
"""
checker = SimpleTaskCompletionChecker()
client_config = ClaudeAgentSDKClientConfig(
task_completion_checker=checker,
isolation=isolation,
cwd=cwd,
)
Expand Down
4 changes: 3 additions & 1 deletion src/trivia_agent/agent_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from weakincentives.runtime.mailbox import Mailbox
from weakincentives.skills import SkillMount

from trivia_agent.adapters import create_adapter
from trivia_agent.adapters import SimpleTaskCompletionChecker, create_adapter
from trivia_agent.config import load_redis_settings
from trivia_agent.feedback import build_feedback_providers
from trivia_agent.isolation import API_KEY_ENV, has_auth, resolve_isolation_config, resolve_skills
Expand Down Expand Up @@ -193,6 +193,7 @@ def build_prompt_template(
build_task_examples_section(), # Multi-step workflow examples
],
feedback_providers=build_feedback_providers(),
task_completion_checker=SimpleTaskCompletionChecker(),
)


Expand Down Expand Up @@ -337,6 +338,7 @@ def prepare(
workspace_section, # Session-bound workspace access
],
feedback_providers=build_feedback_providers(),
task_completion_checker=SimpleTaskCompletionChecker(),
)

# Determine overrides tag from experiment
Expand Down
19 changes: 8 additions & 11 deletions tests/trivia_agent/test_adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

from unittest.mock import MagicMock

from weakincentives.adapters.claude_agent_sdk import (
ClaudeAgentSDKAdapter,
TaskCompletionResult,
)
from weakincentives.adapters.claude_agent_sdk import ClaudeAgentSDKAdapter
from weakincentives.prompt import TaskCompletionResult

from trivia_agent.adapters import SimpleTaskCompletionChecker, create_adapter

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

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

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