*** Settings ***
Documentation    Smoke tests for tool-calling actor runtime
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER_SCRIPT}    robot/helper_actor_runtime.py

*** Test Cases ***
Actor Runtime Single Tool Call
    [Documentation]    Run a tool-call loop with a single tool call
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    single_tool    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    single-tool-ok

Actor Runtime Max Iterations
    [Documentation]    Verify max-iteration safety termination
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    max_iterations    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    max-iterations-ok

Actor Runtime Error Handling
    [Documentation]    Verify tool error handling in the loop
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    error_handling    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    error-handling-ok

Actor Runtime Context Properties
    [Documentation]    Verify ToolActorContext properties
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    context_props    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-props-ok

Actor Runtime Sandbox Threading
    [Documentation]    Verify sandbox root threading into tool inputs
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    sandbox_thread    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    sandbox-thread-ok

Actor Runtime Empty Registry
    [Documentation]    Verify behavior with no tools registered
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    empty_registry    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    empty-registry-ok
