From bcd456087a1eaaf12e516098f3ef3fb6a27dcd1c Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Mon, 29 Dec 2025 16:21:26 +0000 Subject: [PATCH 1/2] adding validation protection --- .../build-and-push-tutorial-agent.yml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/.github/workflows/build-and-push-tutorial-agent.yml b/.github/workflows/build-and-push-tutorial-agent.yml index 0ed78058..e9c1b709 100644 --- a/.github/workflows/build-and-push-tutorial-agent.yml +++ b/.github/workflows/build-and-push-tutorial-agent.yml @@ -195,7 +195,83 @@ jobs: if [ "$SHOULD_PUSH" = "true" ]; then agentex agents build $BUILD_ARGS --push echo "โœ… Successfully built and pushed: ${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}" + # Set full image name for validation step + echo "FULL_IMAGE=${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}" >> $GITHUB_ENV else agentex agents build $BUILD_ARGS echo "โœ… Build validation successful for: ${{ matrix.agent_path }}" + # Set full image name for validation step (local build) + echo "FULL_IMAGE=${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}" >> $GITHUB_ENV fi + + - name: Validate agent image + run: | + set -e + + FULL_IMAGE="${{ env.FULL_IMAGE }}" + AGENT_PATH="${{ matrix.agent_path }}" + AGENT_NAME="${{ env.AGENT_NAME }}" + + echo "๐Ÿ” Validating agent image: $FULL_IMAGE" + + # Determine ACP type from path + if [[ "$AGENT_PATH" == *"10_async"* ]]; then + ACP_TYPE="async" + else + ACP_TYPE="sync" + fi + + # Common environment variables for validation + ENV_VARS="-e ENVIRONMENT=development \ + -e AGENT_NAME=${AGENT_NAME} \ + -e ACP_URL=http://localhost:8000 \ + -e ACP_PORT=8000 \ + -e ACP_TYPE=${ACP_TYPE}" + + # 1. Validate ACP entry point exists and is importable + echo "๐Ÿ“ฆ Checking ACP entry point..." + docker run --rm $ENV_VARS "$FULL_IMAGE" python -c "from project.acp import acp; print('โœ… ACP entry point validated')" + + # 2. Check if tests/test_agent.py exists (required for integration tests) + # Tests are located at /app//tests/test_agent.py + echo "๐Ÿงช Checking for tests/test_agent.py..." + TEST_FILE=$(docker run --rm "$FULL_IMAGE" find /app -name "test_agent.py" -path "*/tests/*" 2>/dev/null | head -1) + + if [ -n "$TEST_FILE" ]; then + echo "โœ… Found test file at: $TEST_FILE" + else + echo "โŒ No tests/test_agent.py found in image - this is required for all tutorial agents" + echo " Please add a tests/test_agent.py file to your agent" + exit 1 + fi + + # 3. Validate container can start (may fail due to missing services, but should initialize) + echo "๐Ÿฅ Validating container starts..." + CONTAINER_NAME="validate-agent-$$" + + # Start container in background with required env vars + docker run -d --name "$CONTAINER_NAME" \ + $ENV_VARS \ + -p 8000:8000 \ + "$FULL_IMAGE" + + # Give it a few seconds to attempt startup + sleep 5 + + # Check if container is still running (it may exit due to missing services, that's ok) + # We just want to see that it attempted to start properly + echo "๐Ÿ“‹ Container logs:" + docker logs "$CONTAINER_NAME" 2>&1 || true + + # Check for successful ACP initialization in logs + if docker logs "$CONTAINER_NAME" 2>&1 | grep -q "ACP.*instance"; then + echo "โœ… Container initialized ACP successfully" + else + echo "โš ๏ธ Could not verify ACP initialization from logs" + fi + + # Cleanup container + docker stop "$CONTAINER_NAME" > /dev/null 2>&1 || true + docker rm "$CONTAINER_NAME" > /dev/null 2>&1 || true + + echo "โœ… All validations passed for: $FULL_IMAGE" From 7234a54d724e5e1f46fbbcb2bb352b57df8beb46 Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Mon, 29 Dec 2025 17:18:50 +0000 Subject: [PATCH 2/2] adding the validation tutorial --- .github/workflows/build-and-push-tutorial-agent.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-push-tutorial-agent.yml b/.github/workflows/build-and-push-tutorial-agent.yml index e9c1b709..b977e449 100644 --- a/.github/workflows/build-and-push-tutorial-agent.yml +++ b/.github/workflows/build-and-push-tutorial-agent.yml @@ -264,7 +264,7 @@ jobs: docker logs "$CONTAINER_NAME" 2>&1 || true # Check for successful ACP initialization in logs - if docker logs "$CONTAINER_NAME" 2>&1 | grep -q "ACP.*instance"; then + if docker logs "$CONTAINER_NAME" 2>&1 | grep -q "instance created "; then echo "โœ… Container initialized ACP successfully" else echo "โš ๏ธ Could not verify ACP initialization from logs"