From e03fd2956d33deee4bf43d3a1826821a30e6fb5a Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman Date: Thu, 2 Apr 2026 23:31:25 +0000 Subject: [PATCH] test(actors): fix actor examples missing provider fields and incorrect name Add missing provider: field to all actor examples in examples/actors/. Fix llm_with_tools.yaml actor name from assistants/file_analyzer to local/assistants-file_analyzer (custom actors must use local/ namespace and cannot contain two slashes). Add validate-all command to helper_actor_examples.py that uses ActorLoader to validate all examples via business logic checks. Add integration test Validate All Actor Examples Import Without Errors to actor_examples.robot that confirms every example in examples/actors/ can be imported without errors. ISSUES CLOSED: #1504 --- examples/actors/code_review.yaml | 1 + examples/actors/estimator.yaml | 1 + examples/actors/graph_workflow.yaml | 1 + examples/actors/hierarchical_workflow.yaml | 1 + examples/actors/llm_with_tools.yaml | 3 +- examples/actors/simple_graph.yaml | 1 + examples/actors/simple_llm.yaml | 1 + examples/actors/strategy_with_subplan.yaml | 1 + robot/actor_examples.robot | 20 ++++++++++++++ robot/helper_actor_examples.py | 32 +++++++++++++++++++++- 10 files changed, 60 insertions(+), 2 deletions(-) diff --git a/examples/actors/code_review.yaml b/examples/actors/code_review.yaml index be6724935..4b81ddf09 100644 --- a/examples/actors/code_review.yaml +++ b/examples/actors/code_review.yaml @@ -7,6 +7,7 @@ description: Runs a code review and merges to make the best possible. version: "0.0" # LLM model form is Claude Opus 4 +provider: anthropic model: claude-opus-4-20250514 system_prompt: | diff --git a/examples/actors/estimator.yaml b/examples/actors/estimator.yaml index ec9558306..385418f21 100644 --- a/examples/actors/estimator.yaml +++ b/examples/actors/estimator.yaml @@ -6,6 +6,7 @@ type: llm description: Generates pre-execution effort, duration, and risk estimates for implementation planning version: "1.0" +provider: openai model: gpt-4 role_hint: estimation context_view: strategist diff --git a/examples/actors/graph_workflow.yaml b/examples/actors/graph_workflow.yaml index 0c7633bc7..c561658c4 100644 --- a/examples/actors/graph_workflow.yaml +++ b/examples/actors/graph_workflow.yaml @@ -7,6 +7,7 @@ description: Test-driven development workflow with automated testing and feedbac version: "1.0" # LLM model for agent nodes +provider: openai model: gpt-4 # Graph topology diff --git a/examples/actors/hierarchical_workflow.yaml b/examples/actors/hierarchical_workflow.yaml index 4879bd78f..6657f9d44 100644 --- a/examples/actors/hierarchical_workflow.yaml +++ b/examples/actors/hierarchical_workflow.yaml @@ -8,6 +8,7 @@ description: >- Multi-agent development workflow with a strategist, implementer, and reviewer. Each node has fine-grained LSP and tool-source control. version: "1.0" +provider: openai model: gpt-4 # Actor-level skill references diff --git a/examples/actors/llm_with_tools.yaml b/examples/actors/llm_with_tools.yaml index 6d7338227..ec5b1a9f1 100644 --- a/examples/actors/llm_with_tools.yaml +++ b/examples/actors/llm_with_tools.yaml @@ -1,12 +1,13 @@ # LLM Actor with Tools # Demonstrates an LLM actor with access to multiple tools -name: assistants/file_analyzer +name: local/assistants-file_analyzer type: llm description: Analyzes files and generates reports using file system tools version: "1.0" # LLM configuration +provider: openai model: gpt-4-turbo system_prompt: | You are a file analysis assistant. Use the available tools to: diff --git a/examples/actors/simple_graph.yaml b/examples/actors/simple_graph.yaml index a50162dc2..3c3dea038 100644 --- a/examples/actors/simple_graph.yaml +++ b/examples/actors/simple_graph.yaml @@ -7,6 +7,7 @@ description: Simple document processing workflow (extract → analyze → summar version: "1.0" # LLM model +provider: openai model: gpt-3.5-turbo # Graph topology diff --git a/examples/actors/simple_llm.yaml b/examples/actors/simple_llm.yaml index 05d31bb6d..caf8314be 100644 --- a/examples/actors/simple_llm.yaml +++ b/examples/actors/simple_llm.yaml @@ -7,6 +7,7 @@ description: Reviews Python code for best practices, style, and potential bugs version: "1.0" # LLM configuration +provider: openai model: gpt-4 system_prompt: | You are an expert Python code reviewer. Review code for: diff --git a/examples/actors/strategy_with_subplan.yaml b/examples/actors/strategy_with_subplan.yaml index 03bb684c1..f646d25d0 100644 --- a/examples/actors/strategy_with_subplan.yaml +++ b/examples/actors/strategy_with_subplan.yaml @@ -18,6 +18,7 @@ description: > using the builtin/plan-subplan tool. version: "1.0" +provider: openai model: gpt-4-turbo context_view: strategist diff --git a/robot/actor_examples.robot b/robot/actor_examples.robot index ac721f53e..7ded8ce8d 100644 --- a/robot/actor_examples.robot +++ b/robot/actor_examples.robot @@ -38,6 +38,7 @@ Validate LLM With Tools Example Should Be Equal As Integers ${result.rc} 0 Should Contain ${result.stdout} actor-ok Should Contain ${result.stdout} type:llm + Should Contain ${result.stdout} name:local/assistants-file_analyzer Should Contain ${result.stdout} has-tools Validate Estimator Example @@ -176,3 +177,22 @@ Reject GRAPH Actor Without Route Should Be Equal As Integers ${result.rc} 0 Should Contain ${result.stdout} expected-fail Should Contain ${result.stdout} route + +Validate All Actor Examples Import Without Errors + [Documentation] Validate that all actor examples in examples/actors/ can be + ... imported without errors using ActorLoader business logic checks. + ... This is the integration test required by issue #1504 Definition of Done. + [Tags] slow + ${result}= Run Process ${PYTHON} ${HELPER} validate-all ${EXAMPLES_DIR} cwd=${WORKSPACE} + Log ${result.stdout} + Log ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} all-examples-ok: + Should Contain ${result.stdout} actor-imported:local/assistants-file_analyzer + Should Contain ${result.stdout} actor-imported:local/strategy_with_subplan + Should Contain ${result.stdout} actor-imported:local/estimator + Should Contain ${result.stdout} actor-imported:local/code-review + Should Contain ${result.stdout} actor-imported:utilities/file_operations + Should Contain ${result.stdout} actor-imported:workflows/document_processor + Should Contain ${result.stdout} actor-imported:workflows/test_driven_dev + Should Contain ${result.stdout} actor-imported:workflows/dev-workflow diff --git a/robot/helper_actor_examples.py b/robot/helper_actor_examples.py index 2241ee331..065fcdc4d 100644 --- a/robot/helper_actor_examples.py +++ b/robot/helper_actor_examples.py @@ -10,6 +10,7 @@ Usage: python robot/helper_actor_examples.py check-pattern python robot/helper_actor_examples.py check-docs python robot/helper_actor_examples.py check-doc-patterns + python robot/helper_actor_examples.py validate-all """ from __future__ import annotations @@ -22,6 +23,7 @@ _SRC = str(Path(__file__).resolve().parents[1] / "src") if _SRC not in sys.path: sys.path.insert(0, _SRC) +from cleveragents.actor.loader import ActorLoader # noqa: E402 from cleveragents.actor.schema import ActorConfigSchema, ActorType # noqa: E402 @@ -189,6 +191,27 @@ def check_doc_patterns(doc_file: str) -> int: return 1 +def validate_all_examples(directory: str) -> int: + """Validate all actor examples in a directory via ActorLoader business logic. + + Uses ActorLoader (which applies ActorConfigSchema validation) to discover + and validate every YAML file in the given directory. Prints one + ``actor-imported:`` line per successfully loaded actor and a final + ``all-examples-ok:`` summary line. Returns 1 on any failure. + """ + try: + examples_dir = Path(directory) + loader = ActorLoader(search_roots=[examples_dir]) + actors = loader.discover() + for actor in actors: + print(f"actor-imported:{actor.name}") + print(f"all-examples-ok:{len(actors)}") + return 0 + except Exception as exc: + print(f"validate-all-fail: {exc}") + return 1 + + def main() -> int: """Entry point called by Robot Framework ``Run Process``.""" if len(sys.argv) < 2: @@ -200,7 +223,8 @@ def main() -> int: " count-examples \n" " check-pattern \n" " check-docs \n" - " check-doc-patterns " + " check-doc-patterns \n" + " validate-all " ) return 1 @@ -242,6 +266,12 @@ def main() -> int: return 1 return check_doc_patterns(sys.argv[2]) + if command == "validate-all": + if len(sys.argv) < 3: + print("Usage: validate-all ") + return 1 + return validate_all_examples(sys.argv[2]) + print(f"Unknown command: {command}") return 1 -- 2.52.0