evoloop-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. evoloop_cli/__init__.py +3 -0
  2. evoloop_cli/__main__.py +10 -0
  3. evoloop_cli/_skills/evoloop-constitution/SKILL.md +59 -0
  4. evoloop_cli/_skills/evoloop-constitution/references/writing-guide.md +89 -0
  5. evoloop_cli/_skills/evoloop-constitution/templates/config.yaml +52 -0
  6. evoloop_cli/_skills/evoloop-constitution/templates/constitution.md +39 -0
  7. evoloop_cli/_skills/evoloop-evaluate/SKILL.md +85 -0
  8. evoloop_cli/_skills/evoloop-evaluate/schemas/parsed_report.schema.json +170 -0
  9. evoloop_cli/_skills/evoloop-evaluate/scripts/parse_junit_report.py +311 -0
  10. evoloop_cli/_skills/evoloop-evaluate/scripts/parse_pytest_report.py +276 -0
  11. evoloop_cli/_skills/evoloop-evaluate/scripts/parse_report.py +101 -0
  12. evoloop_cli/_skills/evoloop-evaluate/scripts/update_eval_index.py +111 -0
  13. evoloop_cli/_skills/evoloop-evaluate/scripts/validate_parsed_report.py +178 -0
  14. evoloop_cli/_skills/evoloop-evaluate/templates/analysis.md +51 -0
  15. evoloop_cli/_skills/evoloop-evaluate/templates/progress.md +42 -0
  16. evoloop_cli/_skills/evoloop-evaluate/templates/tasks.md +34 -0
  17. evoloop_cli/_skills/evoloop-evolve/SKILL.md +76 -0
  18. evoloop_cli/_skills/evoloop-evolve/scripts/evolve_state.py +333 -0
  19. evoloop_cli/_skills/evoloop-implement/SKILL.md +57 -0
  20. evoloop_cli/_skills/evoloop-implement/scripts/check_scope.py +154 -0
  21. evoloop_cli/_skills/evoloop-implement/scripts/commit_section.py +78 -0
  22. evoloop_cli/_skills/evoloop-init/SKILL.md +95 -0
  23. evoloop_cli/_skills/evoloop-init/scripts/scaffold_evals.py +546 -0
  24. evoloop_cli/_skills/evoloop-init/templates/common/evals/datasets/domain_flows.yaml +33 -0
  25. evoloop_cli/_skills/evoloop-init/templates/common/evaluations/README.md +9 -0
  26. evoloop_cli/_skills/evoloop-init/templates/java/src/test/java/__PACKAGE_PATH__/evals/AgentAdapter.java +13 -0
  27. evoloop_cli/_skills/evoloop-init/templates/java/src/test/java/__PACKAGE_PATH__/evals/AgenticFlowEvalTest.java +71 -0
  28. evoloop_cli/_skills/evoloop-init/templates/java/src/test/java/__PACKAGE_PATH__/evals/DeterministicEvaluators.java +174 -0
  29. evoloop_cli/_skills/evoloop-init/templates/java/src/test/java/__PACKAGE_PATH__/evals/EvalFrameworkTest.java +45 -0
  30. evoloop_cli/_skills/evoloop-init/templates/java/src/test/java/__PACKAGE_PATH__/evals/FlowRunResult.java +25 -0
  31. evoloop_cli/_skills/evoloop-init/templates/python/evals/__init__.py +1 -0
  32. evoloop_cli/_skills/evoloop-init/templates/python/evals/adapter.py +63 -0
  33. evoloop_cli/_skills/evoloop-init/templates/python/evals/deepagents_adapter.py +223 -0
  34. evoloop_cli/_skills/evoloop-init/templates/python/evals/evaluators/__init__.py +1 -0
  35. evoloop_cli/_skills/evoloop-init/templates/python/evals/evaluators/deterministic.py +234 -0
  36. evoloop_cli/_skills/evoloop-init/templates/python/evals/evaluators/llm_judge.py +189 -0
  37. evoloop_cli/_skills/evoloop-init/templates/python/evals/fakes.py +26 -0
  38. evoloop_cli/_skills/evoloop-init/templates/python/evals/harness.py +100 -0
  39. evoloop_cli/_skills/evoloop-init/templates/python/tests/conftest.py +38 -0
  40. evoloop_cli/_skills/evoloop-init/templates/python/tests/test_agentic_flows.py +36 -0
  41. evoloop_cli/_skills/evoloop-init/templates/python/tests/test_eval_framework.py +175 -0
  42. evoloop_cli/_skills/evoloop-new/SKILL.md +125 -0
  43. evoloop_cli/_skills/evoloop-new/scripts/scaffold_agent.py +911 -0
  44. evoloop_cli/_skills/evoloop-new/templates/common/.evoloop/constitution.md +34 -0
  45. evoloop_cli/_skills/evoloop-new/templates/common/.gitignore +22 -0
  46. evoloop_cli/_skills/evoloop-new/templates/common/AGENTS.md +17 -0
  47. evoloop_cli/_skills/evoloop-new/templates/common/README.md +83 -0
  48. evoloop_cli/_skills/evoloop-new/templates/common/skills/__DOMAIN__/SKILL.md +21 -0
  49. evoloop_cli/_skills/evoloop-new/templates/java/eval_wiring/src/test/java/__PACKAGE_PATH__/evals/AgenticFlowEvalTest.java +113 -0
  50. evoloop_cli/_skills/evoloop-new/templates/java/eval_wiring/src/test/java/__PACKAGE_PATH__/evals/EvalFrameworkTest.java +85 -0
  51. evoloop_cli/_skills/evoloop-new/templates/java/eval_wiring/src/test/java/__PACKAGE_PATH__/evals/Fake__DOMAIN_PASCAL__Client.java +37 -0
  52. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/custom/src/main/java/__PACKAGE_PATH__/Application.java +46 -0
  53. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/custom/src/main/java/__PACKAGE_PATH__/OpenAiCompatibleRunner.java +433 -0
  54. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/custom/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Agent.java +125 -0
  55. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/langchain4j/src/main/java/__PACKAGE_PATH__/Application.java +46 -0
  56. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/langchain4j/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Agent.java +163 -0
  57. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/langchain4j/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Tools.java +18 -0
  58. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/java/__PACKAGE_PATH__/Application.java +15 -0
  59. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Agent.java +167 -0
  60. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Controller.java +41 -0
  61. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Factory.java +32 -0
  62. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Tools.java +20 -0
  63. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/micronaut/src/main/resources/application.yml +17 -0
  64. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/java/__PACKAGE_PATH__/Application.java +17 -0
  65. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Agent.java +159 -0
  66. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Config.java +32 -0
  67. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Controller.java +40 -0
  68. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Tools.java +25 -0
  69. evoloop_cli/_skills/evoloop-new/templates/java/frameworks/spring-ai/src/main/resources/application.yml +19 -0
  70. evoloop_cli/_skills/evoloop-new/templates/java/gradle/build_custom.gradle +33 -0
  71. evoloop_cli/_skills/evoloop-new/templates/java/gradle/build_langchain4j.gradle +40 -0
  72. evoloop_cli/_skills/evoloop-new/templates/java/gradle/build_micronaut.gradle +52 -0
  73. evoloop_cli/_skills/evoloop-new/templates/java/gradle/build_spring-ai.gradle +45 -0
  74. evoloop_cli/_skills/evoloop-new/templates/java/gradle/settings.gradle +1 -0
  75. evoloop_cli/_skills/evoloop-new/templates/java/maven/pom_custom.xml +57 -0
  76. evoloop_cli/_skills/evoloop-new/templates/java/maven/pom_langchain4j.xml +87 -0
  77. evoloop_cli/_skills/evoloop-new/templates/java/maven/pom_micronaut.xml +101 -0
  78. evoloop_cli/_skills/evoloop-new/templates/java/maven/pom_spring-ai.xml +61 -0
  79. evoloop_cli/_skills/evoloop-new/templates/java/src/main/java/__PACKAGE_PATH__/ConversationMemory.java +36 -0
  80. evoloop_cli/_skills/evoloop-new/templates/java/src/main/java/__PACKAGE_PATH__/Default__DOMAIN_PASCAL__Client.java +9 -0
  81. evoloop_cli/_skills/evoloop-new/templates/java/src/main/java/__PACKAGE_PATH__/DomainRecord.java +10 -0
  82. evoloop_cli/_skills/evoloop-new/templates/java/src/main/java/__PACKAGE_PATH__/TurnOutcome.java +15 -0
  83. evoloop_cli/_skills/evoloop-new/templates/java/src/main/java/__PACKAGE_PATH__/__DOMAIN_PASCAL__Client.java +8 -0
  84. evoloop_cli/_skills/evoloop-new/templates/python/eval_wiring/evals/fakes.py +22 -0
  85. evoloop_cli/_skills/evoloop-new/templates/python/eval_wiring/evals/harness_custom.py +186 -0
  86. evoloop_cli/_skills/evoloop-new/templates/python/eval_wiring/evals/harness_deepagents.py +100 -0
  87. evoloop_cli/_skills/evoloop-new/templates/python/eval_wiring/tests/test_eval_framework.py +196 -0
  88. evoloop_cli/_skills/evoloop-new/templates/python/pyproject.toml +18 -0
  89. evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/__init__.py +13 -0
  90. evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/__main__.py +6 -0
  91. evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/agent_custom.py +209 -0
  92. evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/agent_deepagents.py +61 -0
  93. evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/cli.py +71 -0
  94. evoloop_cli/_skills/evoloop-new/templates/python/src/__PACKAGE__/client.py +31 -0
  95. evoloop_cli/_skills/evoloop-scenarios/SKILL.md +49 -0
  96. evoloop_cli/_skills/evoloop-scenarios/scripts/validate_scenarios.py +261 -0
  97. evoloop_cli/_skills/evoloop-scenarios/templates/scenario_schema.md +49 -0
  98. evoloop_cli/cli.py +331 -0
  99. evoloop_cli-0.1.0.dist-info/METADATA +214 -0
  100. evoloop_cli-0.1.0.dist-info/RECORD +103 -0
  101. evoloop_cli-0.1.0.dist-info/WHEEL +4 -0
  102. evoloop_cli-0.1.0.dist-info/entry_points.txt +2 -0
  103. evoloop_cli-0.1.0.dist-info/licenses/LICENSE +202 -0
@@ -0,0 +1,15 @@
1
+ package __JAVA_PACKAGE__;
2
+
3
+ import java.util.List;
4
+ import java.util.Map;
5
+
6
+ /**
7
+ * Standardized per-turn execution result shared by runtime entrypoints and evaluation adapters.
8
+ */
9
+ public record TurnOutcome(
10
+ String finalResponse,
11
+ List<ToolInvocation> toolCalls,
12
+ boolean skillLoaded) {
13
+
14
+ public record ToolInvocation(String name, Map<String, Object> args) {}
15
+ }
@@ -0,0 +1,8 @@
1
+ package __JAVA_PACKAGE__;
2
+
3
+ /**
4
+ * External service interface hiding real APIs so evaluations can inject deterministic fakes.
5
+ */
6
+ public interface __DOMAIN_PASCAL__Client {
7
+ __JAVA_INTERFACE_METHODS__
8
+ }
@@ -0,0 +1,22 @@
1
+ """Deterministic fake client with fault injection for __DOMAIN_TITLE__ evaluations."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass, field
6
+ from typing import Any
7
+
8
+ from __PACKAGE__.client import DomainRecord
9
+
10
+
11
+ @dataclass
12
+ class Fake__DOMAIN_PASCAL__Client:
13
+ """Deterministic test double implementing __DOMAIN_PASCAL__Client with fault injection."""
14
+
15
+ fail_mode: str | None = None
16
+ call_log: list[dict[str, Any]] = field(default_factory=list)
17
+
18
+ def _check_faults(self) -> None:
19
+ if self.fail_mode == "service_outage":
20
+ raise RuntimeError("Simulated service outage.")
21
+
22
+ __PYTHON_FAKE_METHODS__
@@ -0,0 +1,186 @@
1
+ """Execution harness for single-turn and multi-turn __DOMAIN_TITLE__ flow evaluations."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import time
7
+ import uuid
8
+ from pathlib import Path
9
+ from typing import Any
10
+
11
+ import yaml
12
+
13
+ from __PACKAGE__.agent import create___DOMAIN___agent
14
+ from .adapter import AgentAdapter, DomainToolCall, FlowRunResult, TurnResult
15
+ from .fakes import Fake__DOMAIN_PASCAL__Client
16
+
17
+ DOMAIN_TOOLS: frozenset[str] = __PYTHON_DOMAIN_TOOLS_SET__
18
+ DEFAULT_DATASET_PATH = Path(__file__).parent / "datasets" / "__DOMAIN___flows.yaml"
19
+
20
+
21
+ def load_flow_cases(path: Path | str = DEFAULT_DATASET_PATH) -> list[dict[str, Any]]:
22
+ """Load evaluation flow cases from a YAML dataset file."""
23
+ dataset_path = Path(path)
24
+ with dataset_path.open("r", encoding="utf-8") as fh:
25
+ data = yaml.safe_load(fh)
26
+ return list((data or {}).get("cases", []))
27
+
28
+
29
+ def build_fake_client(case: dict[str, Any]) -> Fake__DOMAIN_PASCAL__Client:
30
+ """Instantiate a deterministic fake client configured for a specific flow case."""
31
+ cfg = case.get("fake_client") or {}
32
+ return Fake__DOMAIN_PASCAL__Client(fail_mode=cfg.get("fail_mode"))
33
+
34
+
35
+ def create_agent_for_eval(
36
+ *,
37
+ client: Any,
38
+ base_url: str | None = None,
39
+ model: str | None = None,
40
+ api_key: str | None = None,
41
+ ) -> Any:
42
+ """Create the __DOMAIN_TITLE__ agent wired to the injected deterministic fake client."""
43
+ return create___DOMAIN___agent(
44
+ client=client,
45
+ base_url=base_url,
46
+ model=model,
47
+ api_key=api_key,
48
+ )
49
+
50
+
51
+ class CustomAgentAdapter:
52
+ """Framework-agnostic AgentAdapter bridging __DOMAIN_PASCAL__Agent.arun_turn() to FlowRunResult."""
53
+
54
+ def __init__(self, agent_factory=create_agent_for_eval):
55
+ self._agent_factory = agent_factory
56
+
57
+ async def run_case(
58
+ self,
59
+ case: dict[str, Any],
60
+ *,
61
+ fake_client: Any,
62
+ domain_tools: frozenset[str],
63
+ base_url: str | None = None,
64
+ model: str | None = None,
65
+ api_key: str | None = None,
66
+ thread_id: str | None = None,
67
+ ) -> FlowRunResult:
68
+ agent = self._agent_factory(
69
+ client=fake_client,
70
+ base_url=base_url,
71
+ model=model,
72
+ api_key=api_key,
73
+ )
74
+ tid = thread_id or f"eval-{case.get('id', 'case')}-{uuid.uuid4().hex[:8]}"
75
+ turns: list[TurnResult] = []
76
+ all_domain_calls: list[DomainToolCall] = []
77
+ openai_trajectory: list[dict[str, Any]] = []
78
+ total_latency = 0.0
79
+ skill_loaded = False
80
+
81
+ for turn_index, user_input in enumerate(case.get("turns") or []):
82
+ t0 = time.perf_counter()
83
+ raw = await agent.arun_turn(user_input, thread_id=tid)
84
+ elapsed = time.perf_counter() - t0
85
+ total_latency += elapsed
86
+
87
+ reply = str(raw.get("final_response", ""))
88
+ skill_loaded = skill_loaded or bool(raw.get("skill_loaded", False))
89
+ turn_calls = [
90
+ DomainToolCall(
91
+ name=str(tc["name"]),
92
+ args=dict(tc.get("args") or {}),
93
+ turn_index=turn_index,
94
+ )
95
+ for tc in (raw.get("tool_calls") or [])
96
+ if str(tc.get("name")) in domain_tools
97
+ ]
98
+ turn_msgs: list[dict[str, Any]] = [{"role": "user", "content": user_input}]
99
+ if turn_calls:
100
+ turn_msgs.append(
101
+ {
102
+ "role": "assistant",
103
+ "content": "",
104
+ "tool_calls": [
105
+ {
106
+ "function": {
107
+ "name": tc.name,
108
+ "arguments": json.dumps(tc.args, sort_keys=True),
109
+ }
110
+ }
111
+ for tc in turn_calls
112
+ ],
113
+ }
114
+ )
115
+ if reply:
116
+ turn_msgs.append({"role": "assistant", "content": reply})
117
+
118
+ all_domain_calls.extend(turn_calls)
119
+ openai_trajectory.extend(turn_msgs)
120
+ turns.append(
121
+ TurnResult(
122
+ turn_index=turn_index,
123
+ user_input=user_input,
124
+ new_messages=list(raw.get("messages") or []),
125
+ domain_tool_calls=turn_calls,
126
+ final_response=reply,
127
+ latency_seconds=elapsed,
128
+ openai_turn_messages=turn_msgs,
129
+ )
130
+ )
131
+
132
+ return FlowRunResult(
133
+ case_id=str(case.get("id", "unknown")),
134
+ turns=turns,
135
+ all_messages=agent.checkpointer.get_messages(tid),
136
+ domain_tool_calls=all_domain_calls,
137
+ openai_trajectory=openai_trajectory,
138
+ final_response=turns[-1].final_response if turns else "",
139
+ total_latency_seconds=total_latency,
140
+ fake_client_log=list(getattr(fake_client, "call_log", [])),
141
+ skill_loaded=skill_loaded,
142
+ )
143
+
144
+
145
+ def build_adapter() -> AgentAdapter:
146
+ """Return the configured AgentAdapter."""
147
+ return CustomAgentAdapter(create_agent_for_eval)
148
+
149
+
150
+ async def run_flow_case(
151
+ case: dict[str, Any],
152
+ *,
153
+ adapter: AgentAdapter | None = None,
154
+ base_url: str | None = None,
155
+ model: str | None = None,
156
+ api_key: str | None = None,
157
+ thread_id: str | None = None,
158
+ ) -> FlowRunResult:
159
+ """Run a single-turn or multi-turn evaluation case via the configured AgentAdapter."""
160
+ resolved_adapter = adapter or build_adapter()
161
+ fake_client = build_fake_client(case)
162
+ return await resolved_adapter.run_case(
163
+ case,
164
+ fake_client=fake_client,
165
+ domain_tools=DOMAIN_TOOLS,
166
+ base_url=base_url,
167
+ model=model,
168
+ api_key=api_key,
169
+ thread_id=thread_id,
170
+ )
171
+
172
+
173
+ __all__ = [
174
+ "DEFAULT_DATASET_PATH",
175
+ "DOMAIN_TOOLS",
176
+ "AgentAdapter",
177
+ "CustomAgentAdapter",
178
+ "DomainToolCall",
179
+ "FlowRunResult",
180
+ "TurnResult",
181
+ "build_adapter",
182
+ "build_fake_client",
183
+ "create_agent_for_eval",
184
+ "load_flow_cases",
185
+ "run_flow_case",
186
+ ]
@@ -0,0 +1,100 @@
1
+ """Execution harness for single-turn and multi-turn __DOMAIN_TITLE__ flow evaluations."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from typing import Any
7
+
8
+ import yaml
9
+
10
+ from __PACKAGE__.agent import create___DOMAIN___agent
11
+ from .adapter import AgentAdapter, DomainToolCall, FlowRunResult, TurnResult
12
+ from .deepagents_adapter import (
13
+ DeepAgentsAdapter,
14
+ detect_skill_loaded,
15
+ extract_domain_tool_calls,
16
+ extract_text_content,
17
+ to_openai_domain_trajectory,
18
+ )
19
+ from .fakes import Fake__DOMAIN_PASCAL__Client
20
+
21
+ DOMAIN_TOOLS: frozenset[str] = __PYTHON_DOMAIN_TOOLS_SET__
22
+ DEFAULT_DATASET_PATH = Path(__file__).parent / "datasets" / "__DOMAIN___flows.yaml"
23
+
24
+
25
+ def load_flow_cases(path: Path | str = DEFAULT_DATASET_PATH) -> list[dict[str, Any]]:
26
+ """Load evaluation flow cases from a YAML dataset file."""
27
+ dataset_path = Path(path)
28
+ with dataset_path.open("r", encoding="utf-8") as fh:
29
+ data = yaml.safe_load(fh)
30
+ return list((data or {}).get("cases", []))
31
+
32
+
33
+ def build_fake_client(case: dict[str, Any]) -> Fake__DOMAIN_PASCAL__Client:
34
+ """Instantiate a deterministic fake client configured for a specific flow case."""
35
+ cfg = case.get("fake_client") or {}
36
+ return Fake__DOMAIN_PASCAL__Client(fail_mode=cfg.get("fail_mode"))
37
+
38
+
39
+ def create_agent_for_eval(
40
+ *,
41
+ client: Any,
42
+ base_url: str | None = None,
43
+ model: str | None = None,
44
+ api_key: str | None = None,
45
+ ) -> Any:
46
+ """Create the __DOMAIN_TITLE__ agent wired to the injected deterministic fake client."""
47
+ return create___DOMAIN___agent(
48
+ client=client,
49
+ base_url=base_url,
50
+ model=model,
51
+ api_key=api_key,
52
+ )
53
+
54
+
55
+ def build_adapter() -> AgentAdapter:
56
+ """Return the configured AgentAdapter (DeepAgentsAdapter)."""
57
+ return DeepAgentsAdapter(create_agent_for_eval)
58
+
59
+
60
+ async def run_flow_case(
61
+ case: dict[str, Any],
62
+ *,
63
+ adapter: AgentAdapter | None = None,
64
+ base_url: str | None = None,
65
+ model: str | None = None,
66
+ api_key: str | None = None,
67
+ thread_id: str | None = None,
68
+ ) -> FlowRunResult:
69
+ """Run a single-turn or multi-turn evaluation case via the configured AgentAdapter."""
70
+ resolved_adapter = adapter or build_adapter()
71
+ fake_client = build_fake_client(case)
72
+ return await resolved_adapter.run_case(
73
+ case,
74
+ fake_client=fake_client,
75
+ domain_tools=DOMAIN_TOOLS,
76
+ base_url=base_url,
77
+ model=model,
78
+ api_key=api_key,
79
+ thread_id=thread_id,
80
+ )
81
+
82
+
83
+ __all__ = [
84
+ "DEFAULT_DATASET_PATH",
85
+ "DOMAIN_TOOLS",
86
+ "AgentAdapter",
87
+ "DeepAgentsAdapter",
88
+ "DomainToolCall",
89
+ "FlowRunResult",
90
+ "TurnResult",
91
+ "build_adapter",
92
+ "build_fake_client",
93
+ "create_agent_for_eval",
94
+ "detect_skill_loaded",
95
+ "extract_domain_tool_calls",
96
+ "extract_text_content",
97
+ "load_flow_cases",
98
+ "run_flow_case",
99
+ "to_openai_domain_trajectory",
100
+ ]
@@ -0,0 +1,196 @@
1
+ """Fast offline unit tests for the __DOMAIN_TITLE__ agent invariants, fakes, and evaluators."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+
7
+ import pytest
8
+
9
+ from __PACKAGE__.agent import SYSTEM_PROMPT, create___DOMAIN___agent
10
+ from __PACKAGE__.client import __DOMAIN_PASCAL__Client
11
+ from evals.adapter import DomainToolCall, FlowRunResult, TurnResult
12
+ from evals.evaluators.deterministic import (
13
+ evaluate_efficiency_budget,
14
+ evaluate_forbidden_and_turn_tools,
15
+ evaluate_groundedness,
16
+ evaluate_trajectory_match,
17
+ run_deterministic_evaluators,
18
+ )
19
+ from evals.evaluators.llm_judge import (
20
+ _format_conversation,
21
+ _format_trajectory,
22
+ evaluate_response_quality,
23
+ )
24
+ from evals.fakes import Fake__DOMAIN_PASCAL__Client
25
+ from evals.harness import DOMAIN_TOOLS, load_flow_cases
26
+
27
+
28
+ def _make_run(
29
+ case_id: str,
30
+ turns_data: list[tuple[str, list[DomainToolCall], str]],
31
+ ) -> FlowRunResult:
32
+ turns: list[TurnResult] = []
33
+ all_calls: list[DomainToolCall] = []
34
+ trajectory: list[dict] = []
35
+
36
+ for idx, (user_input, calls, final_response) in enumerate(turns_data):
37
+ turn_msgs: list[dict] = [{"role": "user", "content": user_input}]
38
+ if calls:
39
+ turn_msgs.append(
40
+ {
41
+ "role": "assistant",
42
+ "content": "",
43
+ "tool_calls": [
44
+ {
45
+ "function": {
46
+ "name": c.name,
47
+ "arguments": json.dumps(c.args, sort_keys=True),
48
+ }
49
+ }
50
+ for c in calls
51
+ ],
52
+ }
53
+ )
54
+ if final_response:
55
+ turn_msgs.append({"role": "assistant", "content": final_response})
56
+
57
+ all_calls.extend(calls)
58
+ trajectory.extend(turn_msgs)
59
+ turns.append(
60
+ TurnResult(
61
+ turn_index=idx,
62
+ user_input=user_input,
63
+ new_messages=[],
64
+ domain_tool_calls=calls,
65
+ final_response=final_response,
66
+ latency_seconds=0.1,
67
+ openai_turn_messages=turn_msgs,
68
+ )
69
+ )
70
+
71
+ return FlowRunResult(
72
+ case_id=case_id,
73
+ turns=turns,
74
+ all_messages=[],
75
+ domain_tool_calls=all_calls,
76
+ openai_trajectory=trajectory,
77
+ final_response=turns[-1].final_response if turns else "",
78
+ total_latency_seconds=0.1 * len(turns),
79
+ )
80
+
81
+
82
+ def test_dataset_loads_unique_cases():
83
+ cases = load_flow_cases()
84
+ assert len(cases) >= 1
85
+ ids = [c["id"] for c in cases]
86
+ assert len(ids) == len(set(ids)), "Case IDs must be unique"
87
+ assert "__PRIMARY_TOOL__" in DOMAIN_TOOLS
88
+
89
+
90
+ def test_system_prompt_respects_word_budget():
91
+ words = SYSTEM_PROMPT.split()
92
+ assert 10 <= len(words) <= __MAX_SYSTEM_PROMPT_WORDS__, (
93
+ f"SYSTEM_PROMPT has {len(words)} words (budget <= __MAX_SYSTEM_PROMPT_WORDS__)."
94
+ )
95
+
96
+
97
+ def test_fake_client_implements_protocol_and_fault_injection():
98
+ client = Fake__DOMAIN_PASCAL__Client()
99
+ assert isinstance(client, __DOMAIN_PASCAL__Client)
100
+ record = client.__PRIMARY_TOOL__("item-1")
101
+ assert record.query == "item-1"
102
+ assert record.status == "ok"
103
+
104
+ with pytest.raises(ValueError):
105
+ client.__PRIMARY_TOOL__(" ")
106
+
107
+ outage = Fake__DOMAIN_PASCAL__Client(fail_mode="service_outage")
108
+ with pytest.raises(RuntimeError, match="outage"):
109
+ outage.__PRIMARY_TOOL__("item-1")
110
+
111
+
112
+ def test_agent_configures_checkpointer_by_default():
113
+ agent = create___DOMAIN___agent(client=Fake__DOMAIN_PASCAL__Client())
114
+ assert getattr(agent, "checkpointer", None) is not None
115
+
116
+
117
+ def test_deterministic_evaluators_happy_path():
118
+ case = {
119
+ "id": "happy_path_example",
120
+ "expected_tool_calls": [{"name": "__PRIMARY_TOOL__", "args": {"query": "item-1"}}],
121
+ "trajectory_match_mode": "unordered",
122
+ "max_tool_calls": 2,
123
+ "grounded_any_of": [["item-1"]],
124
+ }
125
+ run = _make_run(
126
+ "happy_path_example",
127
+ [
128
+ (
129
+ "Run a lookup for item-1.",
130
+ [DomainToolCall(name="__PRIMARY_TOOL__", args={"query": "item-1"}, turn_index=0)],
131
+ "Status for item-1 is ok.",
132
+ )
133
+ ],
134
+ )
135
+ outcomes = run_deterministic_evaluators(run, case)
136
+ assert all(o.passed for o in outcomes), [(o.name, o.reason) for o in outcomes]
137
+
138
+
139
+ def test_forbidden_tools_and_duplicate_detection():
140
+ case = {
141
+ "id": "vague_input_no_tools",
142
+ "expected_tool_calls": [],
143
+ "trajectory_match_mode": "strict",
144
+ "forbidden_tools": ["__PRIMARY_TOOL__"],
145
+ "max_tool_calls": 0,
146
+ }
147
+ run = _make_run(
148
+ "vague_input_no_tools",
149
+ [
150
+ (
151
+ "Check that thing.",
152
+ [
153
+ DomainToolCall(name="__PRIMARY_TOOL__", args={"query": "x"}, turn_index=0),
154
+ DomainToolCall(name="__PRIMARY_TOOL__", args={"query": "x"}, turn_index=0),
155
+ ],
156
+ "Which item?",
157
+ )
158
+ ],
159
+ )
160
+ assert not evaluate_trajectory_match(run, case).passed
161
+ assert not evaluate_forbidden_and_turn_tools(run, case).passed
162
+ eff = evaluate_efficiency_budget(run, case)
163
+ assert not eff.passed
164
+ assert "Duplicate" in eff.reason
165
+
166
+
167
+ def test_groundedness_and_empty_response_guard():
168
+ empty_run = _make_run("empty_case", [("Hello", [], " ")])
169
+ assert not evaluate_groundedness(empty_run, {"grounded_any_of": [["ok"]]}).passed
170
+
171
+ judge_outcome = evaluate_response_quality(empty_run, {"rubric_criteria": "Must reply."})
172
+ assert not judge_outcome.passed
173
+ assert judge_outcome.score == 0.0
174
+ assert "empty" in judge_outcome.reason.lower()
175
+
176
+
177
+ def test_format_conversation_and_turn_grouped_trajectory():
178
+ run = _make_run(
179
+ "multi_turn",
180
+ [
181
+ ("First turn", [], "Please clarify."),
182
+ (
183
+ "Second turn",
184
+ [DomainToolCall(name="__PRIMARY_TOOL__", args={"query": "item-1"}, turn_index=1)],
185
+ "Item-1 is ok.",
186
+ ),
187
+ ],
188
+ )
189
+ conv = _format_conversation(run)
190
+ assert "Turn 1 User: First turn" in conv
191
+ assert "Turn 2 Assistant: Item-1 is ok." in conv
192
+
193
+ parsed = json.loads(_format_trajectory(run))
194
+ assert len(parsed) == 2
195
+ assert parsed[0]["turn"] == 1
196
+ assert parsed[1]["turn"] == 2
@@ -0,0 +1,18 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.25.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "__PROJECT_NAME__"
7
+ version = "0.1.0"
8
+ description = "Evaluation-ready __DOMAIN_TITLE__ agent application scaffolded with evoloop."
9
+ requires-python = ">=3.11"
10
+ dependencies = [
11
+ __PYTHON_DEPS__
12
+ ]
13
+
14
+ [project.scripts]
15
+ __PROJECT_NAME__ = "__PACKAGE__.cli:main"
16
+
17
+ [tool.hatch.build.targets.wheel]
18
+ packages = ["src/__PACKAGE__"]
@@ -0,0 +1,13 @@
1
+ """__DOMAIN_TITLE__ agent package."""
2
+
3
+ from .agent import SYSTEM_PROMPT, create___DOMAIN___agent, create___DOMAIN___tools
4
+ from .client import Default__DOMAIN_PASCAL__Client, DomainRecord, __DOMAIN_PASCAL__Client
5
+
6
+ __all__ = [
7
+ "SYSTEM_PROMPT",
8
+ "Default__DOMAIN_PASCAL__Client",
9
+ "DomainRecord",
10
+ "__DOMAIN_PASCAL__Client",
11
+ "create___DOMAIN___agent",
12
+ "create___DOMAIN___tools",
13
+ ]
@@ -0,0 +1,6 @@
1
+ """Allow running the agent via `python -m __PACKAGE__`."""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())