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,34 @@
1
+ # Evoloop Project Constitution: __PROJECT_NAME__
2
+
3
+ > Binding governance for evaluation-driven development and self-evolving loops.
4
+ > Every task in `evaluations/<timestamp>/tasks.md` must cite each invariant that it upholds and confirm zero violations.
5
+
6
+ ---
7
+
8
+ ## 1. Domain Invariants (__DOMAIN_TITLE__)
9
+
10
+ __INVARIANTS_MD__
11
+
12
+ ---
13
+
14
+ ## 2. Prompt and Memory Hygiene Rules
15
+
16
+ 1. **Word Budget for the System Prompt:** Keep `SYSTEM_PROMPT` compact (`<= __MAX_SYSTEM_PROMPT_WORDS__` words, target 60 to 100 words). Reserve `SYSTEM_PROMPT` for high-attention invariants. Put full specifications in `AGENTS.md` and `skills/__DOMAIN__/SKILL.md`.
17
+ 2. **Consolidate Instead of Append:** When you fix a failure, consolidate existing rules. Do not append duplicate `NEVER` or `DO NOT` patches.
18
+ 3. **Progressive Disclosure Verification:** Never assume the model read `SKILL.md`. Check the `skill_loaded` diagnostic before you rely on skill-only edits.
19
+ 4. **Pair Inclusion Rules with Anti-Hallucination:** Pair every *"always include X"* rule with *"never invent X without a tool call"*.
20
+ 5. **Documentation and Code Comment Style:** Follow `.agents/skills/evoloop-constitution/references/writing-guide.md` for all human-targeted documents, YAML comments, docstrings, Javadocs, and code comments.
21
+
22
+ ---
23
+
24
+ ## 3. Evaluation Integrity and Anti-Reward-Hacking Rules
25
+
26
+ 1. **Scenarios Stay Immutable During Automated Evolution:** Never edit files in `protected_paths` (for example, `evals/datasets/**`) without explicit human approval. Present raw `report` evidence and the exact proposed YAML diff first.
27
+ 2. **Evaluator Changes Require Proof and Approval:** Modify `evaluator_paths` (for example, `evals/evaluators/**`) only to fix a proven defect. Never weaken assertions. Add a regression offline unit test and obtain human approval when `require_approval_for_evaluators: true`.
28
+ 3. **Deterministic and Semantic Evaluation Split:**
29
+ - Deterministic evaluators check objective facts, tool policy, efficiency budgets, and forbidden tokens (`grounded_any_of` and `forbidden_substrings`). Never use fragile synonym lists for open-ended prose.
30
+ - Large Language Model (LLM) judges grade tone, clarity, and open-ended phrasing with full multi-turn context.
31
+ 4. **Mandatory Offline Test Gate:** Run `__OFFLINE_TEST_CMD__` and confirm 100% pass before any commit or live evaluation run.
32
+ 5. **Traceable Atomic Commits:** Commit each task section (`Code Fixes`, `Skill and Agent Memory Updates`, and `Scenario Updates`) separately with the Git trailer:
33
+ `Eval: evaluations/<timestamp>/analysis.md`
34
+ 6. **Judge Model Independence (Recommended):** When you evaluate a small or local model, set a stronger `EVAL_JUDGE_MODEL` to reduce judge noise.
@@ -0,0 +1,22 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ .venv/
5
+ .pytest_cache/
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+
10
+ # Java
11
+ target/
12
+ .gradle/
13
+ *.class
14
+
15
+ # Evoloop transient state
16
+ .evoloop/.evolve-lock
17
+ .evoloop/.evolve-state.json
18
+
19
+ # OS / Editor
20
+ .DS_Store
21
+ .idea/
22
+ .vscode/
@@ -0,0 +1,17 @@
1
+ # __DOMAIN_TITLE__ Agent Rules
2
+
3
+ > Eagerly loaded rules for **__PROJECT_NAME__** (`__DOMAIN__` domain).
4
+ > Keep instructions crisp, deterministic, and aligned with `.evoloop/constitution.md`.
5
+
6
+ ## Available Domain Tools
7
+
8
+ __TOOLS_LIST_MD__
9
+
10
+ ## Mandatory Operating Rules
11
+
12
+ 1. **Tool-Grounded Facts Only:** Never fabricate, guess, or recall domain data without calling the corresponding tool.
13
+ 2. **Validate Inputs First:** If the request is missing required identifiers or is vague, call zero domain tools. Ask one clear clarifying question instead.
14
+ 3. **One Deterministic Action per Edge Case:** Never use open-ended "either do X or do Y" behavior. Follow explicit rules consistently across turns.
15
+ 4. **Honest Error Recovery:** If a tool returns an error or times out, reply briefly and honestly explaining the failure without inventing fallback data.
16
+ 5. **Scope Boundaries:** Politely decline requests outside the `__DOMAIN__` domain without fabricating results.
17
+ 6. **Concise Formatting:** Present tool outputs in clear, human-friendly language rather than dumping raw internal payloads.
@@ -0,0 +1,83 @@
1
+ # __PROJECT_NAME__
2
+
3
+ Evaluation-ready **__DOMAIN_TITLE__** agent application created with `evoloop-new`.
4
+
5
+ - **Stack:** `__STACK__` (`__BUILD_TOOL__`)
6
+ - **Framework:** `__FRAMEWORK__`
7
+ - **Domain:** `__DOMAIN__`
8
+ - **Domain Tools:** __TOOLS_INLINE__
9
+
10
+ ---
11
+
12
+ ## Generated Artifacts
13
+
14
+ __PROJECT_LAYOUT_MD__
15
+
16
+ ### Built-In Testability Invariants
17
+
18
+ 1. **External client interface:** Production clients and deterministic fakes share one interface (`Protocol` or Java interface). Evaluations never depend on live external APIs.
19
+ 2. **Default checkpointer and conversation memory:** The agent enables multi-turn `thread_id` state by default.
20
+ 3. **Compact `SYSTEM_PROMPT` (`<= __MAX_SYSTEM_PROMPT_WORDS__` words):** The offline unit test suite verifies the word count automatically.
21
+ 4. **Eager and progressive memory:** `AGENTS.md` stores eager rules and `skills/__DOMAIN__/SKILL.md` stores progressive workflows.
22
+
23
+ ---
24
+
25
+ ## Prerequisites and Setup
26
+
27
+ 1. Install project dependencies:
28
+ ```bash
29
+ __SETUP_CMD__
30
+ ```
31
+ 2. Configure an OpenAI-compatible Large Language Model (LLM) endpoint (for example, local `llama-server --port 8080 --jinja`, Ollama, or a remote API):
32
+ ```bash
33
+ export LLM_BASE_URL="http://localhost:8080/v1"
34
+ export LLM_MODEL="local-model"
35
+ export LLM_API_KEY="not-needed"
36
+
37
+ # Optional: separate stronger model for LLM-as-a-Judge evaluations
38
+ # export EVAL_JUDGE_BASE_URL="https://..."
39
+ # export EVAL_JUDGE_MODEL="..."
40
+ # export EVAL_JUDGE_API_KEY="..."
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Run the Application
46
+
47
+ __RUN_APP_SECTION_MD__
48
+
49
+ ---
50
+
51
+ ## Run Tests and Evaluations
52
+
53
+ ### 1. Run the Offline Test Gate (No LLM Required)
54
+
55
+ ```bash
56
+ __OFFLINE_TEST_CMD__
57
+ ```
58
+
59
+ ### 2. Validate the Scenario Dataset
60
+
61
+ ```bash
62
+ __VALIDATE_SCENARIOS_CMD__
63
+ ```
64
+
65
+ ### 3. Run Live Agentic Flow Evaluations
66
+
67
+ ```bash
68
+ # Deterministic evaluators only:
69
+ __LIVE_EVAL_CMD__
70
+
71
+ # Deterministic evaluators and LLM-as-a-Judge:
72
+ __LIVE_EVAL_JUDGE_CMD__
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Next Steps with Evoloop
78
+
79
+ 1. **Refine the constitution (`evoloop-constitution`):** Review `.evoloop/constitution.md` and `.evoloop/config.yaml`. Add concrete domain invariants, prompt word budgets, and approval gates.
80
+ 2. **Implement production calls:** Replace the stub logic in `__CLIENT_FILE__` with real backend calls. Add realistic deterministic fixtures in `__FAKES_FILE__`.
81
+ 3. **Expand scenarios (`evoloop-scenarios`):** Map your constitution to `evals/datasets/__DOMAIN___flows.yaml`. Cover happy path, input validation, multi-turn flows, error recovery, edge cases, and scope adherence.
82
+ 4. **Run the baseline evaluation (`evoloop-evaluate`):** Save raw output to `evaluations/<ts>/report`. Generate schema-validated `parsed.json`, `analysis.md`, and `tasks.md`.
83
+ 5. **Iterate safely (`evoloop-implement` or `evoloop-evolve`):** Fix failures with traceable commits (`Eval:` trailers) and circuit breakers.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: __DOMAIN__
3
+ description: Workflow guidelines, tool usage patterns, and response formatting examples for the __DOMAIN_TITLE__ agent.
4
+ ---
5
+
6
+ # __DOMAIN_TITLE__ Skill
7
+
8
+ ## Workflow
9
+
10
+ 1. **Inspect User Request:** Verify the user provided concrete inputs needed for a `__DOMAIN__` lookup.
11
+ - If the request is vague or missing an identifier, ask **one** concise clarifying question and make zero tool calls.
12
+ 2. **Call Required Domain Tools:**
13
+ __TOOLS_LIST_MD__
14
+ 3. **Ground Every Claim:** Only report values returned by the tool(s) in the current conversation.
15
+ 4. **Handle Tool Errors Cleanly:** If a tool returns `Error: ...`, apologize briefly, state that the lookup could not be completed, and do not guess missing values.
16
+
17
+ ## Response Examples
18
+
19
+ - **Happy path:** Call `__PRIMARY_TOOL__` with the requested identifier and summarize the returned status clearly.
20
+ - **Vague request:** *"Could you specify which identifier you would like me to look up?"*
21
+ - **Tool error / outage:** *"I'm sorry, I couldn't complete that lookup because the service is currently unavailable. Please try again shortly."*
@@ -0,0 +1,113 @@
1
+ package __JAVA_PACKAGE__.evals;
2
+
3
+ import static org.junit.jupiter.api.Assertions.assertTrue;
4
+
5
+ import __JAVA_PACKAGE__.TurnOutcome;
6
+ import __JAVA_PACKAGE__.__DOMAIN_PASCAL__Agent;
7
+ import __JAVA_PACKAGE__.evals.FlowRunResult.DomainToolCall;
8
+ import __JAVA_PACKAGE__.evals.FlowRunResult.EvalOutcome;
9
+ import __JAVA_PACKAGE__.evals.FlowRunResult.TurnResult;
10
+ import java.io.InputStream;
11
+ import java.nio.file.Files;
12
+ import java.nio.file.Path;
13
+ import java.util.ArrayList;
14
+ import java.util.List;
15
+ import java.util.Map;
16
+ import java.util.Set;
17
+ import java.util.UUID;
18
+ import java.util.stream.Stream;
19
+ import org.junit.jupiter.api.Named;
20
+ import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
21
+ import org.junit.jupiter.params.ParameterizedTest;
22
+ import org.junit.jupiter.params.provider.Arguments;
23
+ import org.junit.jupiter.params.provider.MethodSource;
24
+ import org.yaml.snakeyaml.Yaml;
25
+
26
+ /**
27
+ * End-to-end JUnit 5 agentic flow evaluation suite for __DOMAIN_TITLE__.
28
+ *
29
+ * Run live evaluations:
30
+ * Maven: mvn test -Dtest=AgenticFlowEvalTest -DrunLiveAgent=true
31
+ * Gradle: ./gradlew test --tests '*AgenticFlowEvalTest' -DrunLiveAgent=true
32
+ */
33
+ @EnabledIfSystemProperty(named = "runLiveAgent", matches = "true")
34
+ class AgenticFlowEvalTest {
35
+
36
+ static final Set<String> DOMAIN_TOOLS = __DOMAIN_PASCAL__Agent.DOMAIN_TOOLS;
37
+ static final Path DATASET_PATH = Path.of("evals/datasets/__DOMAIN___flows.yaml");
38
+
39
+ @SuppressWarnings("unchecked")
40
+ static Fake__DOMAIN_PASCAL__Client buildFakeClient(Map<String, Object> flowCase) {
41
+ Map<String, Object> cfg = (Map<String, Object>) flowCase.get("fake_client");
42
+ String failMode = cfg != null && cfg.get("fail_mode") != null ? String.valueOf(cfg.get("fail_mode")) : null;
43
+ return new Fake__DOMAIN_PASCAL__Client(failMode);
44
+ }
45
+
46
+ @SuppressWarnings("unchecked")
47
+ static AgentAdapter createAdapter() {
48
+ return (flowCase, domainTools) -> {
49
+ Fake__DOMAIN_PASCAL__Client fakeClient = buildFakeClient(flowCase);
50
+ __DOMAIN_PASCAL__Agent agent = __DOMAIN_PASCAL__Agent.create(fakeClient);
51
+ String caseId = String.valueOf(flowCase.getOrDefault("id", "unknown"));
52
+ String threadId = "eval-" + caseId + "-" + UUID.randomUUID().toString().substring(0, 8);
53
+
54
+ List<String> turnInputs = (List<String>) flowCase.getOrDefault("turns", List.of());
55
+ List<TurnResult> turns = new ArrayList<>();
56
+ List<DomainToolCall> allCalls = new ArrayList<>();
57
+ double totalLatency = 0.0;
58
+ boolean skillLoaded = false;
59
+
60
+ for (int i = 0; i < turnInputs.size(); i++) {
61
+ String userInput = turnInputs.get(i);
62
+ long t0 = System.nanoTime();
63
+ TurnOutcome outcome = agent.runTurn(threadId, userInput);
64
+ double latencySec = (System.nanoTime() - t0) / 1_000_000_000.0;
65
+ totalLatency += latencySec;
66
+ skillLoaded = skillLoaded || outcome.skillLoaded();
67
+
68
+ int turnIndex = i;
69
+ List<DomainToolCall> turnCalls = outcome.toolCalls().stream()
70
+ .filter(tc -> domainTools.contains(tc.name()))
71
+ .map(tc -> new DomainToolCall(tc.name(), tc.args(), turnIndex))
72
+ .toList();
73
+ allCalls.addAll(turnCalls);
74
+ turns.add(new TurnResult(turnIndex, userInput, turnCalls, outcome.finalResponse(), latencySec));
75
+ }
76
+
77
+ String finalResp = turns.isEmpty() ? "" : turns.get(turns.size() - 1).finalResponse();
78
+ return new FlowRunResult(caseId, turns, allCalls, finalResp, totalLatency, skillLoaded);
79
+ };
80
+ }
81
+
82
+ @SuppressWarnings("unchecked")
83
+ static Stream<Arguments> flowCases() throws Exception {
84
+ Yaml yaml = new Yaml();
85
+ try (InputStream in = Files.newInputStream(DATASET_PATH)) {
86
+ Map<String, Object> root = yaml.load(in);
87
+ List<Map<String, Object>> cases = (List<Map<String, Object>>) root.get("cases");
88
+ return cases.stream()
89
+ .map(c -> Arguments.of(Named.of(String.valueOf(c.get("id")), c)));
90
+ }
91
+ }
92
+
93
+ @ParameterizedTest(name = "{0}")
94
+ @MethodSource("flowCases")
95
+ void testAgenticFlow(Map<String, Object> flowCase) {
96
+ FlowRunResult run = createAdapter().runCase(flowCase, DOMAIN_TOOLS);
97
+ List<EvalOutcome> outcomes = DeterministicEvaluators.runAll(run, flowCase);
98
+
99
+ // Standardized assertion format parsed by parse_junit_report.py into parsed.json (v1.0)
100
+ List<String> failures = outcomes.stream()
101
+ .filter(o -> !o.passed())
102
+ .map(o -> " - [" + o.name() + "] " + o.reason())
103
+ .toList();
104
+
105
+ assertTrue(
106
+ failures.isEmpty(),
107
+ () -> "Flow '" + flowCase.get("id") + "' failed " + failures.size() + " check(s):\n"
108
+ + String.join("\n", failures)
109
+ + "\nFinal response: " + run.finalResponse()
110
+ + "\nDomain tool calls: " + run.domainToolCalls()
111
+ + "\nSkill loaded (SKILL.md): " + run.skillLoaded());
112
+ }
113
+ }
@@ -0,0 +1,85 @@
1
+ package __JAVA_PACKAGE__.evals;
2
+
3
+ import static org.junit.jupiter.api.Assertions.assertEquals;
4
+ import static org.junit.jupiter.api.Assertions.assertFalse;
5
+ import static org.junit.jupiter.api.Assertions.assertNotNull;
6
+ import static org.junit.jupiter.api.Assertions.assertThrows;
7
+ import static org.junit.jupiter.api.Assertions.assertTrue;
8
+
9
+ import __JAVA_PACKAGE__.DomainRecord;
10
+ import __JAVA_PACKAGE__.__DOMAIN_PASCAL__Agent;
11
+ import __JAVA_PACKAGE__.evals.FlowRunResult.DomainToolCall;
12
+ import __JAVA_PACKAGE__.evals.FlowRunResult.EvalOutcome;
13
+ import __JAVA_PACKAGE__.evals.FlowRunResult.TurnResult;
14
+ import java.util.List;
15
+ import java.util.Map;
16
+ import org.junit.jupiter.api.Test;
17
+
18
+ /**
19
+ * Fast offline JUnit 5 unit tests for the __DOMAIN_TITLE__ agent invariants, fakes, and evaluators.
20
+ */
21
+ class EvalFrameworkTest {
22
+
23
+ @Test
24
+ void systemPromptRespectsWordBudget() {
25
+ int wordCount = __DOMAIN_PASCAL__Agent.SYSTEM_PROMPT.trim().split("\\s+").length;
26
+ assertTrue(
27
+ wordCount >= 10 && wordCount <= __MAX_SYSTEM_PROMPT_WORDS__,
28
+ "SYSTEM_PROMPT has " + wordCount + " words (budget <= __MAX_SYSTEM_PROMPT_WORDS__)");
29
+ }
30
+
31
+ @Test
32
+ void agentConfiguresCheckpointerAndPersistsMultiTurnState() {
33
+ Fake__DOMAIN_PASCAL__Client fake = new Fake__DOMAIN_PASCAL__Client();
34
+ __DOMAIN_PASCAL__Agent agent = __DOMAIN_PASCAL__Agent.create(fake);
35
+ assertNotNull(agent.memory(), "Default ConversationMemory checkpointer must be configured");
36
+
37
+ agent.recordTurn("thread-1", "Turn 1 user", "Turn 1 assistant");
38
+ agent.recordTurn("thread-1", "Turn 2 user", "Turn 2 assistant");
39
+ assertEquals(4, agent.memory().getMessages("thread-1").size());
40
+ assertTrue(agent.invokeTool("__PRIMARY_TOOL__", "item-1").contains("item-1"));
41
+ }
42
+
43
+ @Test
44
+ void fakeClientSupportsHappyPathAndServiceOutage() {
45
+ Fake__DOMAIN_PASCAL__Client okClient = new Fake__DOMAIN_PASCAL__Client();
46
+ DomainRecord record = okClient.__PRIMARY_TOOL_CAMEL__("item-1");
47
+ assertEquals("item-1", record.query());
48
+ assertEquals("ok", record.status());
49
+
50
+ assertThrows(IllegalArgumentException.class, () -> okClient.__PRIMARY_TOOL_CAMEL__(" "));
51
+
52
+ Fake__DOMAIN_PASCAL__Client outageClient = new Fake__DOMAIN_PASCAL__Client("service_outage");
53
+ assertThrows(IllegalStateException.class, () -> outageClient.__PRIMARY_TOOL_CAMEL__("item-1"));
54
+ }
55
+
56
+ @Test
57
+ void happyPathDeterministicEvaluatorsPass() {
58
+ Map<String, Object> flowCase = Map.of(
59
+ "id", "happy_path_example",
60
+ "expected_tool_calls", List.of(Map.of("name", "__PRIMARY_TOOL__", "args", Map.of("query", "item-1"))),
61
+ "trajectory_match_mode", "unordered",
62
+ "max_tool_calls", 2,
63
+ "grounded_any_of", List.of(List.of("item-1")));
64
+
65
+ DomainToolCall call = new DomainToolCall("__PRIMARY_TOOL__", Map.of("query", "item-1"), 0);
66
+ FlowRunResult run = new FlowRunResult(
67
+ "happy_path_example",
68
+ List.of(new TurnResult(0, "Lookup item-1", List.of(call), "Status for item-1 is ok.", 0.1)),
69
+ List.of(call),
70
+ "Status for item-1 is ok.",
71
+ 0.1,
72
+ false);
73
+
74
+ List<EvalOutcome> outcomes = DeterministicEvaluators.runAll(run, flowCase);
75
+ assertTrue(outcomes.stream().allMatch(EvalOutcome::passed), "Expected all checks to pass: " + outcomes);
76
+ }
77
+
78
+ @Test
79
+ void emptyResponseFailsGroundedness() {
80
+ FlowRunResult emptyRun = new FlowRunResult("empty", List.of(), List.of(), " ", 0.1, false);
81
+ EvalOutcome outcome = DeterministicEvaluators.evaluateGroundedness(
82
+ emptyRun, Map.of("grounded_any_of", List.of(List.of("ok"))));
83
+ assertFalse(outcome.passed());
84
+ }
85
+ }
@@ -0,0 +1,37 @@
1
+ package __JAVA_PACKAGE__.evals;
2
+
3
+ import __JAVA_PACKAGE__.DomainRecord;
4
+ import __JAVA_PACKAGE__.__DOMAIN_PASCAL__Client;
5
+ import java.util.ArrayList;
6
+ import java.util.Collections;
7
+ import java.util.List;
8
+ import java.util.Map;
9
+
10
+ /**
11
+ * Deterministic fake implementing {@link __DOMAIN_PASCAL__Client} with fault injection.
12
+ */
13
+ public class Fake__DOMAIN_PASCAL__Client implements __DOMAIN_PASCAL__Client {
14
+
15
+ private final String failMode;
16
+ private final List<Map<String, Object>> callLog = new ArrayList<>();
17
+
18
+ public Fake__DOMAIN_PASCAL__Client() {
19
+ this(null);
20
+ }
21
+
22
+ public Fake__DOMAIN_PASCAL__Client(String failMode) {
23
+ this.failMode = failMode;
24
+ }
25
+
26
+ public List<Map<String, Object>> callLog() {
27
+ return Collections.unmodifiableList(callLog);
28
+ }
29
+
30
+ private void checkFaults() {
31
+ if ("service_outage".equals(failMode)) {
32
+ throw new IllegalStateException("Simulated service outage.");
33
+ }
34
+ }
35
+
36
+ __JAVA_FAKE_METHODS__
37
+ }
@@ -0,0 +1,46 @@
1
+ package __JAVA_PACKAGE__;
2
+
3
+ import java.util.Scanner;
4
+
5
+ /**
6
+ * Minimal runnable CLI application for __PROJECT_NAME__ (pure JDK 17).
7
+ *
8
+ * Run single prompt: mvn exec:java -Dexec.args="--prompt 'Lookup item-1'"
9
+ * Run interactive: mvn exec:java (or ./gradlew run)
10
+ */
11
+ public class Application {
12
+
13
+ public static void main(String[] args) {
14
+ String prompt = null;
15
+ String threadId = "interactive";
16
+ for (int i = 0; i < args.length; i++) {
17
+ if ("--prompt".equals(args[i]) && i + 1 < args.length) {
18
+ prompt = args[++i];
19
+ } else if ("--thread-id".equals(args[i]) && i + 1 < args.length) {
20
+ threadId = args[++i];
21
+ }
22
+ }
23
+
24
+ __DOMAIN_PASCAL__Agent agent = __DOMAIN_PASCAL__Agent.create(new Default__DOMAIN_PASCAL__Client());
25
+
26
+ if (prompt != null) {
27
+ System.out.println(agent.chat(threadId, prompt));
28
+ return;
29
+ }
30
+
31
+ System.out.println("__DOMAIN_TITLE__ agent ready. Type 'exit' to quit.");
32
+ try (Scanner scanner = new Scanner(System.in)) {
33
+ while (true) {
34
+ System.out.print("you> ");
35
+ if (!scanner.hasNextLine()) {
36
+ break;
37
+ }
38
+ String line = scanner.nextLine().trim();
39
+ if (line.isEmpty() || "exit".equalsIgnoreCase(line) || "quit".equalsIgnoreCase(line)) {
40
+ break;
41
+ }
42
+ System.out.println("agent> " + agent.chat(threadId, line));
43
+ }
44
+ }
45
+ }
46
+ }