11#! /bin/bash
22#
3- # Run all agentic tutorial tests
3+ # Run a single agent tutorial test
44#
5- # This script runs the test runner for all agentic tutorials in sequence .
6- # It stops at the first failure unless --continue-on-error is specified .
5+ # This script runs the test for a single agent tutorial .
6+ # It starts the agent, runs tests against it, then stops the agent .
77#
88# Usage:
9- # ./run_all_agentic_tests.sh # Run all tutorials
10- # ./run_all_agentic_tests.sh --continue-on-error # Run all, continue on error
11- # ./run_all_agentic_tests.sh <tutorial_path> # Run single tutorial
12- # ./run_all_agentic_tests.sh --view-logs # View most recent agent logs
13- # ./run_all_agentic_tests.sh --view-logs <tutorial_path> # View logs for specific tutorial
9+ # ./run_agent_test.sh <tutorial_path> # Run single tutorial test
10+ # ./run_agent_test.sh --view-logs <tutorial_path> # View logs for specific tutorial
11+ # ./run_agent_test.sh --view-logs # View most recent agent logs
1412#
1513
1614set -e # Exit on error
@@ -28,44 +26,17 @@ AGENT_PORT=8000
2826AGENTEX_SERVER_PORT=5003
2927
3028# Parse arguments
31- CONTINUE_ON_ERROR=false
32- SINGLE_TUTORIAL=" "
29+ TUTORIAL_PATH=" "
3330VIEW_LOGS=false
3431
3532for arg in " $@ " ; do
36- if [[ " $arg " == " --continue-on-error" ]]; then
37- CONTINUE_ON_ERROR=true
38- elif [[ " $arg " == " --view-logs" ]]; then
33+ if [[ " $arg " == " --view-logs" ]]; then
3934 VIEW_LOGS=true
4035 else
41- SINGLE_TUTORIAL =" $arg "
36+ TUTORIAL_PATH =" $arg "
4237 fi
4338done
4439
45- # Find all agentic tutorial directories
46- ALL_TUTORIALS=(
47- # sync tutorials
48- " 00_sync/000_hello_acp"
49- " 00_sync/010_multiturn"
50- " 00_sync/020_streaming"
51- # base tutorials
52- " 10_agentic/00_base/000_hello_acp"
53- " 10_agentic/00_base/010_multiturn"
54- " 10_agentic/00_base/020_streaming"
55- " 10_agentic/00_base/030_tracing"
56- " 10_agentic/00_base/040_other_sdks"
57- " 10_agentic/00_base/080_batch_events"
58- # "10_agentic/00_base/090_multi_agent_non_temporal" This will require its own version of this
59- # temporal tutorials
60- " 10_agentic/10_temporal/000_hello_acp"
61- " 10_agentic/10_temporal/010_agent_chat"
62- " 10_agentic/10_temporal/020_state_machine"
63- )
64-
65- PASSED=0
66- FAILED=0
67- FAILED_TESTS=()
68-
6940# Function to check prerequisites for running this test suite
7041check_prerequisites () {
7142 # Check that we are in the examples/tutorials directory
@@ -280,21 +251,16 @@ execute_tutorial_test() {
280251 # Start the agent
281252 if ! start_agent " $tutorial " ; then
282253 echo -e " ${RED} ❌ FAILED to start agent: $tutorial ${NC} "
283- (( FAILED++ ))
284- FAILED_TESTS+=(" $tutorial " )
285254 return 1
286255 fi
287256
288257 # Run the tests
289258 local test_passed=false
290259 if run_test " $tutorial " ; then
291260 echo -e " ${GREEN} ✅ PASSED: $tutorial ${NC} "
292- (( PASSED++ ))
293261 test_passed=true
294262 else
295263 echo -e " ${RED} ❌ FAILED: $tutorial ${NC} "
296- (( FAILED++ ))
297- FAILED_TESTS+=(" $tutorial " )
298264 fi
299265
300266 # Stop the agent
@@ -313,23 +279,30 @@ execute_tutorial_test() {
313279main () {
314280 # Handle --view-logs flag
315281 if [ " $VIEW_LOGS " = true ]; then
316- if [[ -n " $SINGLE_TUTORIAL " ]]; then
317- view_agent_logs " $SINGLE_TUTORIAL "
282+ if [[ -n " $TUTORIAL_PATH " ]]; then
283+ view_agent_logs " $TUTORIAL_PATH "
318284 else
319285 view_agent_logs
320286 fi
321287 exit 0
322288 fi
323289
324- echo " ================================================================================"
325- if [[ -n " $SINGLE_TUTORIAL " ]]; then
326- echo " Running Single Tutorial Test: $SINGLE_TUTORIAL "
327- else
328- echo " Running All Agentic Tutorial Tests"
329- if [ " $CONTINUE_ON_ERROR " = true ]; then
330- echo -e " ${YELLOW} ⚠️ Running in continue-on-error mode${NC} "
331- fi
290+ # Require tutorial path
291+ if [[ -z " $TUTORIAL_PATH " ]]; then
292+ echo -e " ${RED} ❌ Error: Tutorial path is required${NC} "
293+ echo " "
294+ echo " Usage:"
295+ echo " ./run_agent_test.sh <tutorial_path> # Run single tutorial test"
296+ echo " ./run_agent_test.sh --view-logs <tutorial_path> # View logs for specific tutorial"
297+ echo " ./run_agent_test.sh --view-logs # View most recent agent logs"
298+ echo " "
299+ echo " Example:"
300+ echo " ./run_agent_test.sh 00_sync/000_hello_acp"
301+ exit 1
332302 fi
303+
304+ echo " ================================================================================"
305+ echo " Running Tutorial Test: $TUTORIAL_PATH "
333306 echo " ================================================================================"
334307 echo " "
335308
@@ -338,46 +311,19 @@ main() {
338311
339312 echo " "
340313
341- # Determine which tutorials to run
342- if [[ -n " $SINGLE_TUTORIAL " ]]; then
343- TUTORIALS=(" $SINGLE_TUTORIAL " )
344- else
345- TUTORIALS=(" ${ALL_TUTORIALS[@]} " )
346- fi
347-
348- # Iterate over tutorials
349- for tutorial in " ${TUTORIALS[@]} " ; do
350- execute_tutorial_test " $tutorial "
351-
352- # Exit early if in fail-fast mode
353- if [ " $CONTINUE_ON_ERROR " = false ] && [ $FAILED -gt 0 ]; then
354- echo " "
355- echo -e " ${RED} Stopping due to test failure. Use --continue-on-error to continue.${NC} "
356- exit 1
357- fi
358- done
359-
360- # Print summary
361- echo " "
362- echo " ================================================================================"
363- echo " Test Summary"
364- echo " ================================================================================"
365- echo -e " Total: $(( PASSED + FAILED)) "
366- echo -e " ${GREEN} Passed: $PASSED ${NC} "
367- echo -e " ${RED} Failed: $FAILED ${NC} "
368- echo " "
369-
370- if [ $FAILED -gt 0 ]; then
371- echo " Failed tests:"
372- for test in " ${FAILED_TESTS[@]} " ; do
373- echo -e " ${RED} ✗${NC} $test "
374- done
314+ # Execute the single tutorial test
315+ if execute_tutorial_test " $TUTORIAL_PATH " ; then
375316 echo " "
376- exit 1
317+ echo " ================================================================================"
318+ echo -e " ${GREEN} 🎉 Test passed for: $TUTORIAL_PATH ${NC} "
319+ echo " ================================================================================"
320+ exit 0
377321 else
378- echo -e " ${GREEN} 🎉 All tests passed!${NC} "
379322 echo " "
380- exit 0
323+ echo " ================================================================================"
324+ echo -e " ${RED} ❌ Test failed for: $TUTORIAL_PATH ${NC} "
325+ echo " ================================================================================"
326+ exit 1
381327 fi
382328}
383329
0 commit comments