From dc2cc8f479c266b9d34788a81c77a9f122b4335c Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Thu, 6 Nov 2025 16:26:34 -0500 Subject: [PATCH 01/12] RF/fix/release-wf --- .github/workflows/build-agentex.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-agentex.yml b/.github/workflows/build-agentex.yml index 315e48d..cf07225 100644 --- a/.github/workflows/build-agentex.yml +++ b/.github/workflows/build-agentex.yml @@ -12,7 +12,6 @@ permissions: env: AGENTEX_SERVER_IMAGE_NAME: agentex - AGENTEX_AUTH_IMAGE_NAME: agentex-auth jobs: build-stable-image: @@ -28,6 +27,7 @@ jobs: fi - name: Check if user is maintainer + if: github.event_name == 'workflow_dispatch' uses: actions/github-script@v7 with: script: | From e479f2cb3e7803c777c6626c1a932e485f31356b Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Wed, 3 Dec 2025 09:49:02 -0500 Subject: [PATCH 02/12] run tests on each push --- .github/workflows/integration-tests.yml | 93 ++++++++++++++++++++++++- .vscode/settings.json | 2 +- 2 files changed, 92 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index c512a9e..77ecd60 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -3,15 +3,104 @@ name: Run Agentex Integration Tests on: pull_request: paths: - - 'agentex/**' + - "agentex/**" push: branches: - main paths: - - 'agentex/**' + - "agentex/**" workflow_dispatch: inputs: commit-sha: description: "Commit SHA to test against" required: true type: string + +jobs: + run-integration-tests: + name: "Run Integration Tests - s000-hello-acp" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit-sha || github.ref }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pull agent image + run: | + echo "๐Ÿณ Pulling agent image..." + docker pull ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest + echo "โœ… Agent image pulled successfully" + + - name: Start AgentEx services with host access + working-directory: ./agentex + run: | + echo "๐Ÿš€ Starting AgentEx services with host access override..." + docker compose -f docker-compose.yml up -d + echo "โณ Waiting for services to be ready..." + sleep 30 + docker compose ps + + - name: Run agent integration test + run: | + echo "๐Ÿงช Running integration test for agent: s000-hello-acp" + echo "๐Ÿณ Using image: ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest" + + # Start the agent container + + docker run -d --name agent-test-s000-hello-acp \ + -e AGENT_NAME=s000-hello-acp \ + -e ACP_URL=http://agent-test-s000-hello-acp:8000 \ + -e ACP_TYPE=sync \ + -e AGENTEX_BASE_URL=http://agentex:5003 \ + -e AGENTEX_API_BASE_URL=http://agentex:5003 \ + -p 8000:8000 \ + --network agentex-network \ + ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest + + echo "โณ Waiting for agent to start..." + sleep 10 + + # Check for "Application startup complete" log message + echo "๐Ÿ” Waiting for 'Application startup complete' log message..." + TIMEOUT=60 + ELAPSED=0 + + while [ $ELAPSED -lt $TIMEOUT ]; do + if docker logs agent-test-s000-hello-acp 2>&1 | grep -q "Application startup complete"; then + echo "โœ… Agent application has started successfully" + break + fi + + echo "โณ Still waiting for startup... (${ELAPSED}s/${TIMEOUT}s)" + sleep 2 + ELAPSED=$((ELAPSED + 2)) + done + + if [ $ELAPSED -ge $TIMEOUT ]; then + echo "โŒ Timeout waiting for 'Application startup complete' message" + echo "๐Ÿ“‹ Container logs:" + docker logs agent-test-s000-hello-acp + exit 1 + fi + + # Run the test inside the container + echo "๐Ÿงช Running tests inside the agent container..." + if docker exec agent-test-s000-hello-acp python tests/test_agent.py; then + echo "โœ… Tests passed successfully" + else + echo "โŒ Tests failed" + echo "๐Ÿ“‹ Container logs:" + docker logs agent-test-s000-hello-acp + exit 1 + fi + + echo "๐Ÿงน Cleaning up container..." + docker rm -f agent-test-s000-hello-acp diff --git a/.vscode/settings.json b/.vscode/settings.json index ae77de7..aed069a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,7 +12,7 @@ "ruff.fixAll": true, "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", "python.terminal.activateEnvironment": true, - "python.languageServer": "Pylance", + "python.languageServer": "None", "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { From 3d5a15bb060ceb63a586f692ec26c26c35bf29d2 Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Wed, 3 Dec 2025 09:53:29 -0500 Subject: [PATCH 03/12] fixing the name --- .github/workflows/integration-tests.yml | 75 +++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 77ecd60..2027263 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -12,9 +12,10 @@ on: workflow_dispatch: inputs: commit-sha: - description: "Commit SHA to test against" + description: "Commit SHA or branch to test against" required: true type: string + default: main jobs: run-integration-tests: @@ -46,8 +47,31 @@ jobs: docker compose -f docker-compose.yml up -d echo "โณ Waiting for services to be ready..." sleep 30 + + echo "๐Ÿ“‹ Service status:" docker compose ps + echo "๐Ÿ” Checking AgentEx service health..." + HEALTH_TIMEOUT=60 + HEALTH_ELAPSED=0 + + while [ $HEALTH_ELAPSED -lt $HEALTH_TIMEOUT ]; do + if curl -s http://localhost:5003/health > /dev/null 2>&1; then + echo "โœ… AgentEx service is healthy" + break + fi + echo "โณ Waiting for AgentEx health check... (${HEALTH_ELAPSED}s/${HEALTH_TIMEOUT}s)" + sleep 5 + HEALTH_ELAPSED=$((HEALTH_ELAPSED + 5)) + done + + if [ $HEALTH_ELAPSED -ge $HEALTH_TIMEOUT ]; then + echo "โŒ AgentEx service health check failed" + echo "๐Ÿ“‹ AgentEx service logs:" + docker compose logs agentex + exit 1 + fi + - name: Run agent integration test run: | echo "๐Ÿงช Running integration test for agent: s000-hello-acp" @@ -91,14 +115,55 @@ jobs: exit 1 fi - # Run the test inside the container + # Test connectivity before running main tests + echo "๐Ÿ” Testing connectivity to agent..." + if ! docker exec agent-test-s000-hello-acp curl -s http://localhost:8000/health > /dev/null 2>&1; then + echo "โš ๏ธ Agent health endpoint not responding, checking if agent is listening..." + docker exec agent-test-s000-hello-acp netstat -tlnp 2>/dev/null || echo "netstat not available" + fi + + echo "๐Ÿ” Testing connectivity to AgentEx from agent container..." + if ! docker exec agent-test-s000-hello-acp curl -s http://agentex:5003/health > /dev/null 2>&1; then + echo "โŒ Cannot reach AgentEx from agent container" + echo "๐Ÿ“‹ AgentEx service logs:" + cd agentex && docker compose logs --tail=50 agentex + cd .. + else + echo "โœ… Agent can reach AgentEx services" + fi + + # Show pre-test logs + echo "๐Ÿ“‹ Agent logs before testing:" + docker logs --tail=20 agent-test-s000-hello-acp + + echo "๐Ÿ“‹ AgentEx logs before testing:" + cd agentex && docker compose logs --tail=20 agentex + cd .. + + # Run the test inside the container with explicit exit code handling echo "๐Ÿงช Running tests inside the agent container..." - if docker exec agent-test-s000-hello-acp python tests/test_agent.py; then + set +e # Don't exit on error immediately + docker exec agent-test-s000-hello-acp python tests/test_agent.py + TEST_EXIT_CODE=$? + set -e # Re-enable exit on error + + # Show post-test logs regardless of outcome + echo "๐Ÿ“‹ Agent logs after testing:" + docker logs --tail=50 agent-test-s000-hello-acp + + echo "๐Ÿ“‹ AgentEx logs after testing:" + cd agentex && docker compose logs --tail=50 agentex + cd .. + + if [ $TEST_EXIT_CODE -eq 0 ]; then echo "โœ… Tests passed successfully" else - echo "โŒ Tests failed" - echo "๐Ÿ“‹ Container logs:" + echo "โŒ Tests failed with exit code $TEST_EXIT_CODE" + echo "๐Ÿ“‹ Full agent logs:" docker logs agent-test-s000-hello-acp + echo "๐Ÿ“‹ Full AgentEx logs:" + cd agentex && docker compose logs agentex + cd .. exit 1 fi From 8093f04308cea099743987e596fb763a0776342b Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Wed, 3 Dec 2025 10:11:07 -0500 Subject: [PATCH 04/12] fixing the port issues --- .github/workflows/integration-tests.yml | 64 +++++++++++++++++++++---- 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 2027263..a09818a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -43,21 +43,22 @@ jobs: - name: Start AgentEx services with host access working-directory: ./agentex run: | - echo "๐Ÿš€ Starting AgentEx services with host access override..." + echo "๐Ÿš€ Starting AgentEx services..." docker compose -f docker-compose.yml up -d - echo "โณ Waiting for services to be ready..." - sleep 30 - echo "๐Ÿ“‹ Service status:" + echo "๐Ÿ“‹ Initial service status:" docker compose ps + echo "โณ Waiting for database migrations and service initialization..." + sleep 45 # AgentEx has 30s start_period + time for migrations + echo "๐Ÿ” Checking AgentEx service health..." - HEALTH_TIMEOUT=60 + HEALTH_TIMEOUT=90 HEALTH_ELAPSED=0 while [ $HEALTH_ELAPSED -lt $HEALTH_TIMEOUT ]; do if curl -s http://localhost:5003/health > /dev/null 2>&1; then - echo "โœ… AgentEx service is healthy" + echo "โœ… AgentEx health endpoint is responding" break fi echo "โณ Waiting for AgentEx health check... (${HEALTH_ELAPSED}s/${HEALTH_TIMEOUT}s)" @@ -72,6 +73,19 @@ jobs: exit 1 fi + echo "๐Ÿ” Verifying AgentEx API endpoints..." + if curl -s http://localhost:5003/api > /dev/null 2>&1; then + echo "โœ… AgentEx API endpoints are accessible" + else + echo "โŒ AgentEx API endpoints not responding" + echo "๐Ÿ“‹ AgentEx service logs:" + docker compose logs agentex + exit 1 + fi + + echo "๐Ÿ“‹ Final service status after health checks:" + docker compose ps + - name: Run agent integration test run: | echo "๐Ÿงช Running integration test for agent: s000-hello-acp" @@ -81,7 +95,8 @@ jobs: docker run -d --name agent-test-s000-hello-acp \ -e AGENT_NAME=s000-hello-acp \ - -e ACP_URL=http://agent-test-s000-hello-acp:8000 \ + -e ACP_URL=http://agent-test-s000-hello-acp \ + -e ACP_PORT=8000 \ -e ACP_TYPE=sync \ -e AGENTEX_BASE_URL=http://agentex:5003 \ -e AGENTEX_API_BASE_URL=http://agentex:5003 \ @@ -115,6 +130,37 @@ jobs: exit 1 fi + echo "๐Ÿ” Verifying agent registration with AgentEx..." + REGISTRATION_TIMEOUT=30 + REGISTRATION_ELAPSED=0 + + while [ $REGISTRATION_ELAPSED -lt $REGISTRATION_TIMEOUT ]; do + AGENT_DATA=$(curl -s http://localhost:5003/api/agents) + if echo "$AGENT_DATA" | grep -q "s000-hello-acp"; then + echo "โœ… Agent successfully registered with AgentEx" + + # Verify the ACP URL doesn't have double port + if echo "$AGENT_DATA" | grep -q ":8000:8000"; then + echo "โŒ Double port detected in agent registration!" + echo "๐Ÿ“‹ Agent data:" + echo "$AGENT_DATA" | jq '.' || echo "$AGENT_DATA" + exit 1 + else + echo "โœ… ACP URL correctly formatted (no double port)" + fi + break + fi + echo "โณ Waiting for agent registration... (${REGISTRATION_ELAPSED}s/${REGISTRATION_TIMEOUT}s)" + sleep 5 + REGISTRATION_ELAPSED=$((REGISTRATION_ELAPSED + 5)) + done + + if [ $REGISTRATION_ELAPSED -ge $REGISTRATION_TIMEOUT ]; then + echo "โš ๏ธ Agent registration check timeout, proceeding with tests anyway" + echo "๐Ÿ“‹ Current agents registered:" + curl -s http://localhost:5003/api/agents || echo "Failed to query agents" + fi + # Test connectivity before running main tests echo "๐Ÿ” Testing connectivity to agent..." if ! docker exec agent-test-s000-hello-acp curl -s http://localhost:8000/health > /dev/null 2>&1; then @@ -143,10 +189,12 @@ jobs: # Run the test inside the container with explicit exit code handling echo "๐Ÿงช Running tests inside the agent container..." set +e # Don't exit on error immediately - docker exec agent-test-s000-hello-acp python tests/test_agent.py + docker exec agent-test-s000-hello-acp pytest tests/test_agent.py -v TEST_EXIT_CODE=$? set -e # Re-enable exit on error + echo "๐Ÿ” Test exit code: $TEST_EXIT_CODE" + # Show post-test logs regardless of outcome echo "๐Ÿ“‹ Agent logs after testing:" docker logs --tail=50 agent-test-s000-hello-acp From e71666dfb4bff1d784cb4ac77422d8b516c8957b Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Wed, 3 Dec 2025 10:29:26 -0500 Subject: [PATCH 05/12] add tests for all agent images --- .github/workflows/integration-tests.yml | 157 ++++++++++++++++++++---- 1 file changed, 136 insertions(+), 21 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index a09818a..e6dd1a9 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,5 +1,9 @@ name: Run Agentex Integration Tests +permissions: + contents: read + packages: read + on: pull_request: paths: @@ -18,9 +22,92 @@ on: default: main jobs: + discover-agent-images: + name: "Discover Tutorial Agent Images" + runs-on: ubuntu-latest + outputs: + agent-matrix: ${{ steps.discover.outputs.agent-matrix }} + steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Discover tutorial agent images + id: discover + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "๐Ÿ” Discovering tutorial agent images from GHCR using gh CLI..." + + # Debug: Test basic API access first + echo "Testing basic API access..." + gh api user --jq '.login' || echo "Basic API failed" + + # Try repository-level packages first (more likely to work) + echo "Fetching packages from scale-agentex-python repository..." + gh api repos/scaleapi/scale-agentex-python/packages \ + --field package_type=container \ + --jq '.[] | select(.name | contains("tutorial-agents")) | .name' > packages.txt 2>/dev/null || { + echo "Repository packages failed, trying organization packages..." + + # Fallback to org packages with simpler query + gh api orgs/scaleapi/packages \ + --field package_type=container \ + --jq '.[] | select(.name | startswith("scale-agentex-python/tutorial-agents/")) | .name' > packages.txt 2>/dev/null || { + echo "Organization packages also failed, using fallback list..." + + echo "๐Ÿ“‹ Found tutorial agent packages:" + cat packages.txt + + # Build agent matrix from discovered packages + echo "๐Ÿ”จ Building agent matrix from discovered packages..." + AGENT_IMAGES="[" + + while IFS= read -r package_name; do + if [[ -n "$package_name" ]]; then + echo "Processing package: $package_name" + + # Extract agent name from package (e.g., "00_sync-000_hello_acp") + agent_dir=$(basename "$package_name") + + # Convert to agent name format (e.g., "s000-hello-acp") + # Pattern: [digits]_[type]-[digits]_[rest] -> s[digits]-[rest] + agent_name=$(echo "$agent_dir" | sed -E 's/^[0-9]+_[^-]+-([0-9]+)_(.*)$/s\1-\2/' | tr '_' '-') + + echo " - Agent dir: $agent_dir" + echo " - Agent name: $agent_name" + + # Add to JSON array + if [[ "$AGENT_IMAGES" != "[" ]]; then + AGENT_IMAGES+="," + fi + + AGENT_IMAGES+='{"name":"'$agent_dir'","image":"ghcr.io/scaleapi/'$package_name':latest","agent_name":"'$agent_name'"}' + fi + done < packages.txt + + AGENT_IMAGES+="]" # Close array + + echo "๐Ÿ“‹ Generated agent matrix:" + echo "$AGENT_IMAGES" | jq '.' + + # Convert to compact JSON for matrix + echo "agent-matrix=$(echo "$AGENT_IMAGES" | jq -c '.')" >> $GITHUB_OUTPUT + + # Cleanup + rm -f packages.txt + run-integration-tests: - name: "Run Integration Tests - s000-hello-acp" + name: "Run Integration Tests - ${{ matrix.agent.name }}" runs-on: ubuntu-latest + needs: discover-agent-images + strategy: + fail-fast: false # Continue testing other agents even if one fails + matrix: + agent: ${{ fromJson(needs.discover-agent-images.outputs.agent-matrix) }} steps: - name: Checkout uses: actions/checkout@v4 @@ -36,8 +123,8 @@ jobs: - name: Pull agent image run: | - echo "๐Ÿณ Pulling agent image..." - docker pull ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest + echo "๐Ÿณ Pulling agent image: ${{ matrix.agent.image }}" + docker pull ${{ matrix.agent.image }} echo "โœ… Agent image pulled successfully" - name: Start AgentEx services with host access @@ -88,21 +175,25 @@ jobs: - name: Run agent integration test run: | - echo "๐Ÿงช Running integration test for agent: s000-hello-acp" - echo "๐Ÿณ Using image: ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest" + # Set variables for this agent + AGENT_NAME="${{ matrix.agent.agent_name }}" + AGENT_IMAGE="${{ matrix.agent.image }}" + CONTAINER_NAME="agent-test-${AGENT_NAME}" - # Start the agent container + echo "๐Ÿงช Running integration test for agent: ${AGENT_NAME}" + echo "๐Ÿณ Using image: ${AGENT_IMAGE}" - docker run -d --name agent-test-s000-hello-acp \ - -e AGENT_NAME=s000-hello-acp \ - -e ACP_URL=http://agent-test-s000-hello-acp \ + # Start the agent container + docker run -d --name "${CONTAINER_NAME}" \ + -e AGENT_NAME="${AGENT_NAME}" \ + -e ACP_URL="http://${CONTAINER_NAME}" \ -e ACP_PORT=8000 \ -e ACP_TYPE=sync \ -e AGENTEX_BASE_URL=http://agentex:5003 \ -e AGENTEX_API_BASE_URL=http://agentex:5003 \ -p 8000:8000 \ --network agentex-network \ - ghcr.io/scaleapi/scale-agentex-python/tutorial-agents/00_sync-000_hello_acp:latest + "${AGENT_IMAGE}" echo "โณ Waiting for agent to start..." sleep 10 @@ -113,7 +204,7 @@ jobs: ELAPSED=0 while [ $ELAPSED -lt $TIMEOUT ]; do - if docker logs agent-test-s000-hello-acp 2>&1 | grep -q "Application startup complete"; then + if docker logs "${CONTAINER_NAME}" 2>&1 | grep -q "Application startup complete"; then echo "โœ… Agent application has started successfully" break fi @@ -126,7 +217,7 @@ jobs: if [ $ELAPSED -ge $TIMEOUT ]; then echo "โŒ Timeout waiting for 'Application startup complete' message" echo "๐Ÿ“‹ Container logs:" - docker logs agent-test-s000-hello-acp + docker logs "${CONTAINER_NAME}" exit 1 fi @@ -136,7 +227,7 @@ jobs: while [ $REGISTRATION_ELAPSED -lt $REGISTRATION_TIMEOUT ]; do AGENT_DATA=$(curl -s http://localhost:5003/api/agents) - if echo "$AGENT_DATA" | grep -q "s000-hello-acp"; then + if echo "$AGENT_DATA" | grep -q "${AGENT_NAME}"; then echo "โœ… Agent successfully registered with AgentEx" # Verify the ACP URL doesn't have double port @@ -163,13 +254,13 @@ jobs: # Test connectivity before running main tests echo "๐Ÿ” Testing connectivity to agent..." - if ! docker exec agent-test-s000-hello-acp curl -s http://localhost:8000/health > /dev/null 2>&1; then + if ! docker exec "${CONTAINER_NAME}" curl -s http://localhost:8000/health > /dev/null 2>&1; then echo "โš ๏ธ Agent health endpoint not responding, checking if agent is listening..." - docker exec agent-test-s000-hello-acp netstat -tlnp 2>/dev/null || echo "netstat not available" + docker exec "${CONTAINER_NAME}" netstat -tlnp 2>/dev/null || echo "netstat not available" fi echo "๐Ÿ” Testing connectivity to AgentEx from agent container..." - if ! docker exec agent-test-s000-hello-acp curl -s http://agentex:5003/health > /dev/null 2>&1; then + if ! docker exec "${CONTAINER_NAME}" curl -s http://agentex:5003/health > /dev/null 2>&1; then echo "โŒ Cannot reach AgentEx from agent container" echo "๐Ÿ“‹ AgentEx service logs:" cd agentex && docker compose logs --tail=50 agentex @@ -180,7 +271,7 @@ jobs: # Show pre-test logs echo "๐Ÿ“‹ Agent logs before testing:" - docker logs --tail=20 agent-test-s000-hello-acp + docker logs --tail=20 "${CONTAINER_NAME}" echo "๐Ÿ“‹ AgentEx logs before testing:" cd agentex && docker compose logs --tail=20 agentex @@ -189,7 +280,7 @@ jobs: # Run the test inside the container with explicit exit code handling echo "๐Ÿงช Running tests inside the agent container..." set +e # Don't exit on error immediately - docker exec agent-test-s000-hello-acp pytest tests/test_agent.py -v + docker exec "${CONTAINER_NAME}" pytest tests/test_agent.py -v TEST_EXIT_CODE=$? set -e # Re-enable exit on error @@ -197,7 +288,7 @@ jobs: # Show post-test logs regardless of outcome echo "๐Ÿ“‹ Agent logs after testing:" - docker logs --tail=50 agent-test-s000-hello-acp + docker logs --tail=50 "${CONTAINER_NAME}" echo "๐Ÿ“‹ AgentEx logs after testing:" cd agentex && docker compose logs --tail=50 agentex @@ -208,7 +299,7 @@ jobs: else echo "โŒ Tests failed with exit code $TEST_EXIT_CODE" echo "๐Ÿ“‹ Full agent logs:" - docker logs agent-test-s000-hello-acp + docker logs "${CONTAINER_NAME}" echo "๐Ÿ“‹ Full AgentEx logs:" cd agentex && docker compose logs agentex cd .. @@ -216,4 +307,28 @@ jobs: fi echo "๐Ÿงน Cleaning up container..." - docker rm -f agent-test-s000-hello-acp + docker rm -f "${CONTAINER_NAME}" + + # Summary job to ensure the workflow fails if any test fails + integration-tests-summary: + name: "Integration Tests Summary" + runs-on: ubuntu-latest + needs: [discover-agent-images, run-integration-tests] + if: always() # Run even if some tests fail + steps: + - name: Check test results + run: | + echo "๐Ÿ” Checking integration test results..." + + # Check if the matrix job had any failures + if [ "${{ needs.run-integration-tests.result }}" != "success" ]; then + echo "โŒ One or more integration tests failed" + echo "Matrix job result: ${{ needs.run-integration-tests.result }}" + exit 1 + else + echo "โœ… All integration tests passed successfully" + fi + + - name: Final status + run: | + echo "๐ŸŽ‰ All tutorial agent integration tests completed successfully!" From 25fad07a3cafd6e7ba4d5f565243232559d00544 Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Wed, 3 Dec 2025 10:51:19 -0500 Subject: [PATCH 06/12] attempt 2 --- .github/workflows/integration-tests.yml | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index e6dd1a9..e3ec6a3 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -38,26 +38,26 @@ jobs: - name: Discover tutorial agent images id: discover env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.PACKAGE_TOKEN }} run: | - echo "๐Ÿ” Discovering tutorial agent images from GHCR using gh CLI..." - - # Debug: Test basic API access first - echo "Testing basic API access..." - gh api user --jq '.login' || echo "Basic API failed" + echo "๐Ÿ” Discovering tutorial agent images from GHCR..." + + # Validate token access + if ! gh api user --jq '.login' >/dev/null 2>&1; then + echo "โŒ PACKAGE_TOKEN not configured or lacks permissions" + echo "Please ensure PACKAGE_TOKEN secret is set with:" + echo " - read:packages scope" + echo " - Access to scaleapi organization packages" + exit 1 + fi - # Try repository-level packages first (more likely to work) - echo "Fetching packages from scale-agentex-python repository..." - gh api repos/scaleapi/scale-agentex-python/packages \ + # Get all packages from the organization using your working command + echo "Fetching packages from scaleapi organization..." + gh api orgs/scaleapi/packages \ + --method GET \ --field package_type=container \ - --jq '.[] | select(.name | contains("tutorial-agents")) | .name' > packages.txt 2>/dev/null || { - echo "Repository packages failed, trying organization packages..." - - # Fallback to org packages with simpler query - gh api orgs/scaleapi/packages \ - --field package_type=container \ - --jq '.[] | select(.name | startswith("scale-agentex-python/tutorial-agents/")) | .name' > packages.txt 2>/dev/null || { - echo "Organization packages also failed, using fallback list..." + --field per_page=100 \ + --jq '.[] | select(.name | startswith("scale-agentex-python/tutorial-agents/")) | .name' > packages.txt echo "๐Ÿ“‹ Found tutorial agent packages:" cat packages.txt @@ -70,7 +70,7 @@ jobs: if [[ -n "$package_name" ]]; then echo "Processing package: $package_name" - # Extract agent name from package (e.g., "00_sync-000_hello_acp") + # Extract agent directory name (e.g., "00_sync-000_hello_acp") agent_dir=$(basename "$package_name") # Convert to agent name format (e.g., "s000-hello-acp") @@ -85,7 +85,7 @@ jobs: AGENT_IMAGES+="," fi - AGENT_IMAGES+='{"name":"'$agent_dir'","image":"ghcr.io/scaleapi/'$package_name':latest","agent_name":"'$agent_name'"}' + AGENT_IMAGES+='{"name":"'$agent_dir'","image":"ghcr.io/'$package_name':latest","agent_name":"'$agent_name'"}' fi done < packages.txt From ffcfc6a243f4bee1fa383d913023f32f9b36e8bb Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Thu, 4 Dec 2025 10:39:50 -0500 Subject: [PATCH 07/12] test with hardcoded names --- .github/workflows/integration-tests.yml | 116 +++++++++++++----------- 1 file changed, 65 insertions(+), 51 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index e3ec6a3..8eb3ad3 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -35,61 +35,63 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + # - name: Generate GitHub App Token + # id: generate-token + # uses: actions/create-github-app-token@v1 + # with: + # app-id: ${{ secrets.GITHUB_APP_ID }} + # private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }} + # owner: scaleapi + - name: Discover tutorial agent images id: discover - env: - GITHUB_TOKEN: ${{ secrets.PACKAGE_TOKEN }} + # env: + # GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} run: | - echo "๐Ÿ” Discovering tutorial agent images from GHCR..." - - # Validate token access - if ! gh api user --jq '.login' >/dev/null 2>&1; then - echo "โŒ PACKAGE_TOKEN not configured or lacks permissions" - echo "Please ensure PACKAGE_TOKEN secret is set with:" - echo " - read:packages scope" - echo " - Access to scaleapi organization packages" - exit 1 - fi - - # Get all packages from the organization using your working command - echo "Fetching packages from scaleapi organization..." - gh api orgs/scaleapi/packages \ - --method GET \ - --field package_type=container \ - --field per_page=100 \ - --jq '.[] | select(.name | startswith("scale-agentex-python/tutorial-agents/")) | .name' > packages.txt - - echo "๐Ÿ“‹ Found tutorial agent packages:" - cat packages.txt - - # Build agent matrix from discovered packages - echo "๐Ÿ”จ Building agent matrix from discovered packages..." + echo "๐Ÿ” Building agent matrix from known tutorial agent images..." + + # Define the list of known tutorial agent packages + PACKAGES=( + "scale-agentex-python/tutorial-agents/00_sync-000_hello_acp" + "scale-agentex-python/tutorial-agents/00_sync-010_multiturn" + "scale-agentex-python/tutorial-agents/00_sync-020_streaming" + "scale-agentex-python/tutorial-agents/10_async-00_base-000_hello_acp" + "scale-agentex-python/tutorial-agents/10_async-00_base-010_multiturn" + "scale-agentex-python/tutorial-agents/10_async-00_base-020_streaming" + "scale-agentex-python/tutorial-agents/10_async-00_base-030_tracing" + "scale-agentex-python/tutorial-agents/10_async-00_base-040_other_sdks" + "scale-agentex-python/tutorial-agents/10_async-00_base-080_batch_events" + "scale-agentex-python/tutorial-agents/10_async-10_temporal-000_hello_acp" + "scale-agentex-python/tutorial-agents/10_async-10_temporal-010_agent_chat" + "scale-agentex-python/tutorial-agents/10_async-10_temporal-020_state_machine" + "scale-agentex-python/tutorial-agents/10_async-10_temporal-030_custom_activities" + "scale-agentex-python/tutorial-agents/10_async-10_temporal-050_agent_chat_guardrails" + "scale-agentex-python/tutorial-agents/10_async-10_temporal-060_open_ai_agents_sdk_hello_world" + "scale-agentex-python/tutorial-agents/10_async-10_temporal-070_open_ai_agents_sdk_tools" + "scale-agentex-python/tutorial-agents/10_async-10_temporal-080_open_ai_agents_sdk_human_in_the_loop" + "scale-agentex-python/tutorial-agents/10_async-10_temporal-090_claude_agents_sdk_mvp" + ) + + # Build agent matrix from the package list AGENT_IMAGES="[" - while IFS= read -r package_name; do - if [[ -n "$package_name" ]]; then - echo "Processing package: $package_name" - - # Extract agent directory name (e.g., "00_sync-000_hello_acp") - agent_dir=$(basename "$package_name") - - # Convert to agent name format (e.g., "s000-hello-acp") - # Pattern: [digits]_[type]-[digits]_[rest] -> s[digits]-[rest] - agent_name=$(echo "$agent_dir" | sed -E 's/^[0-9]+_[^-]+-([0-9]+)_(.*)$/s\1-\2/' | tr '_' '-') + for package_name in "${PACKAGES[@]}"; do + echo "Processing package: $package_name" - echo " - Agent dir: $agent_dir" - echo " - Agent name: $agent_name" + # Extract agent directory name and convert to agent name format (e.g., "s000-hello-acp") + # Pattern: [digits]_[type]-[digits]_[rest] -> s[digits]-[rest] + agent_name=$(basename "$package_name" | sed -E 's/^[0-9]+_[^-]+-([0-9]+)_(.*)$/s\1-\2/' | tr '_' '-') + echo " - Agent name: $agent_name" - # Add to JSON array - if [[ "$AGENT_IMAGES" != "[" ]]; then - AGENT_IMAGES+="," - fi - - AGENT_IMAGES+='{"name":"'$agent_dir'","image":"ghcr.io/'$package_name':latest","agent_name":"'$agent_name'"}' + # Add to JSON array + if [[ "$AGENT_IMAGES" != "[" ]]; then + AGENT_IMAGES+="," fi - done < packages.txt - AGENT_IMAGES+="]" # Close array + AGENT_IMAGES+='{"image":"ghcr.io/scaleapi/'"$package_name"':latest","agent_name":"'"$agent_name"'"}' + done + + AGENT_IMAGES+="]" echo "๐Ÿ“‹ Generated agent matrix:" echo "$AGENT_IMAGES" | jq '.' @@ -97,11 +99,8 @@ jobs: # Convert to compact JSON for matrix echo "agent-matrix=$(echo "$AGENT_IMAGES" | jq -c '.')" >> $GITHUB_OUTPUT - # Cleanup - rm -f packages.txt - run-integration-tests: - name: "Run Integration Tests - ${{ matrix.agent.name }}" + name: "Run Integration Tests - ${{ matrix.agent.agent_name }}" runs-on: ubuntu-latest needs: discover-agent-images strategy: @@ -174,6 +173,8 @@ jobs: docker compose ps - name: Run agent integration test + env: + OPENAI_API_KEY: ${{ secrets.TUTORIAL_OPENAI_API_KEY }} run: | # Set variables for this agent AGENT_NAME="${{ matrix.agent.agent_name }}" @@ -191,6 +192,7 @@ jobs: -e ACP_TYPE=sync \ -e AGENTEX_BASE_URL=http://agentex:5003 \ -e AGENTEX_API_BASE_URL=http://agentex:5003 \ + -e OPENAI_API_KEY="${OPENAI_API_KEY}" \ -p 8000:8000 \ --network agentex-network \ "${AGENT_IMAGE}" @@ -247,9 +249,21 @@ jobs: done if [ $REGISTRATION_ELAPSED -ge $REGISTRATION_TIMEOUT ]; then - echo "โš ๏ธ Agent registration check timeout, proceeding with tests anyway" + echo "โŒ Agent registration check timeout - test failed" echo "๐Ÿ“‹ Current agents registered:" curl -s http://localhost:5003/api/agents || echo "Failed to query agents" + + echo "๐Ÿ“‹ Agent container logs:" + docker logs "${CONTAINER_NAME}" + + echo "๐Ÿ“‹ AgentEx service logs:" + cd agentex && docker compose logs --tail=50 agentex + cd .. + + echo "๐Ÿงน Cleaning up container..." + docker rm -f "${CONTAINER_NAME}" + + exit 1 fi # Test connectivity before running main tests From 4d70b6bb9f22260f2f22df995ec4dc44d353d9fe Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Mon, 8 Dec 2025 10:55:33 -0500 Subject: [PATCH 08/12] fixing files --- .github/workflows/integration-tests.yml | 33 ++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 8eb3ad3..0a2ceaa 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -78,9 +78,9 @@ jobs: for package_name in "${PACKAGES[@]}"; do echo "Processing package: $package_name" - # Extract agent directory name and convert to agent name format (e.g., "s000-hello-acp") - # Pattern: [digits]_[type]-[digits]_[rest] -> s[digits]-[rest] - agent_name=$(basename "$package_name" | sed -E 's/^[0-9]+_[^-]+-([0-9]+)_(.*)$/s\1-\2/' | tr '_' '-') + # Extract agent directory name and convert to agent name format (e.g., "000-hello-acp") + # Pattern: [digits]_[type]-[digits]_[rest] -> [digits]-[rest] + agent_name=$(basename "$package_name" | sed -E 's/^[0-9]+_[^-]+-([0-9]+)_(.*)$/\1-\2/' | tr '_' '-') echo " - Agent name: $agent_name" # Add to JSON array @@ -184,14 +184,31 @@ jobs: echo "๐Ÿงช Running integration test for agent: ${AGENT_NAME}" echo "๐Ÿณ Using image: ${AGENT_IMAGE}" + # Debug: Check if OPENAI_API_KEY is available + if [ -z "$OPENAI_API_KEY" ]; then + echo "โš ๏ธ OPENAI_API_KEY is not set or empty" + else + echo "โœ… OPENAI_API_KEY is available (length: ${#OPENAI_API_KEY})" + fi + + # Determine ACP type from image name + if [[ "${AGENT_IMAGE}" == *"10_async"* ]]; then + ACP_TYPE="async" + echo "๐Ÿ”„ Detected ASYNC agent type" + else + ACP_TYPE="sync" + echo "๐Ÿ”„ Detected SYNC agent type" + fi + # Start the agent container docker run -d --name "${CONTAINER_NAME}" \ -e AGENT_NAME="${AGENT_NAME}" \ -e ACP_URL="http://${CONTAINER_NAME}" \ -e ACP_PORT=8000 \ - -e ACP_TYPE=sync \ + -e ACP_TYPE="${ACP_TYPE}" \ -e AGENTEX_BASE_URL=http://agentex:5003 \ -e AGENTEX_API_BASE_URL=http://agentex:5003 \ + -e REDIS_URL=redis://agentex-redis:6379 \ -e OPENAI_API_KEY="${OPENAI_API_KEY}" \ -p 8000:8000 \ --network agentex-network \ @@ -200,6 +217,10 @@ jobs: echo "โณ Waiting for agent to start..." sleep 10 + # Debug: Check environment variables inside the container + echo "๐Ÿ” Checking environment variables in agent container..." + docker exec "${CONTAINER_NAME}" env | grep -E "OPENAI|AGENTEX|REDIS" | head -10 || echo "No relevant env vars found" + # Check for "Application startup complete" log message echo "๐Ÿ” Waiting for 'Application startup complete' log message..." TIMEOUT=60 @@ -228,7 +249,7 @@ jobs: REGISTRATION_ELAPSED=0 while [ $REGISTRATION_ELAPSED -lt $REGISTRATION_TIMEOUT ]; do - AGENT_DATA=$(curl -s http://localhost:5003/api/agents) + AGENT_DATA=$(curl -s http://localhost:5003/agents) if echo "$AGENT_DATA" | grep -q "${AGENT_NAME}"; then echo "โœ… Agent successfully registered with AgentEx" @@ -251,7 +272,7 @@ jobs: if [ $REGISTRATION_ELAPSED -ge $REGISTRATION_TIMEOUT ]; then echo "โŒ Agent registration check timeout - test failed" echo "๐Ÿ“‹ Current agents registered:" - curl -s http://localhost:5003/api/agents || echo "Failed to query agents" + curl -s http://localhost:5003/agents || echo "Failed to query agents" echo "๐Ÿ“‹ Agent container logs:" docker logs "${CONTAINER_NAME}" From bc2f5c523dddf99e85ad97127456de3f816190a3 Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Mon, 8 Dec 2025 12:04:19 -0500 Subject: [PATCH 09/12] setting the temporal address --- .github/workflows/integration-tests.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 0a2ceaa..7776116 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -172,6 +172,20 @@ jobs: echo "๐Ÿ“‹ Final service status after health checks:" docker compose ps + - name: Install agent container dependencies + run: | + # Set variables for this agent + AGENT_NAME="${{ matrix.agent.agent_name }}" + CONTAINER_NAME="agent-test-${AGENT_NAME}" + + echo "๐Ÿ“ฆ Installing Node.js and NPM in agent container..." + docker exec "${CONTAINER_NAME}" sh -c " + apt-get update -qq && + apt-get install -y -qq nodejs npm && + echo 'โœ… Node.js version:' && node --version && + echo 'โœ… NPM version:' && npm --version + " || echo "โš ๏ธ Failed to install Node.js, tests may fail" + - name: Run agent integration test env: OPENAI_API_KEY: ${{ secrets.TUTORIAL_OPENAI_API_KEY }} @@ -209,6 +223,8 @@ jobs: -e AGENTEX_BASE_URL=http://agentex:5003 \ -e AGENTEX_API_BASE_URL=http://agentex:5003 \ -e REDIS_URL=redis://agentex-redis:6379 \ + -e TEMPORAL_ADDRESS=agentex-temporal:7233 \ + -e TEMPORAL_HOST=agentex-temporal \ -e OPENAI_API_KEY="${OPENAI_API_KEY}" \ -p 8000:8000 \ --network agentex-network \ From 63ee480f459efb7a3b8108c7153d4e4a7ee4a77a Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Mon, 8 Dec 2025 13:10:25 -0500 Subject: [PATCH 10/12] adding more env vars --- .github/workflows/integration-tests.yml | 239 +++++++++++++----------- 1 file changed, 128 insertions(+), 111 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 7776116..a27a5df 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -172,20 +172,6 @@ jobs: echo "๐Ÿ“‹ Final service status after health checks:" docker compose ps - - name: Install agent container dependencies - run: | - # Set variables for this agent - AGENT_NAME="${{ matrix.agent.agent_name }}" - CONTAINER_NAME="agent-test-${AGENT_NAME}" - - echo "๐Ÿ“ฆ Installing Node.js and NPM in agent container..." - docker exec "${CONTAINER_NAME}" sh -c " - apt-get update -qq && - apt-get install -y -qq nodejs npm && - echo 'โœ… Node.js version:' && node --version && - echo 'โœ… NPM version:' && npm --version - " || echo "โš ๏ธ Failed to install Node.js, tests may fail" - - name: Run agent integration test env: OPENAI_API_KEY: ${{ secrets.TUTORIAL_OPENAI_API_KEY }} @@ -198,45 +184,95 @@ jobs: echo "๐Ÿงช Running integration test for agent: ${AGENT_NAME}" echo "๐Ÿณ Using image: ${AGENT_IMAGE}" - # Debug: Check if OPENAI_API_KEY is available - if [ -z "$OPENAI_API_KEY" ]; then - echo "โš ๏ธ OPENAI_API_KEY is not set or empty" - else - echo "โœ… OPENAI_API_KEY is available (length: ${#OPENAI_API_KEY})" - fi - - # Determine ACP type from image name + # Determine ACP type and agent characteristics from image name if [[ "${AGENT_IMAGE}" == *"10_async"* ]]; then ACP_TYPE="async" - echo "๐Ÿ”„ Detected ASYNC agent type" else ACP_TYPE="sync" - echo "๐Ÿ”„ Detected SYNC agent type" fi - # Start the agent container - docker run -d --name "${CONTAINER_NAME}" \ - -e AGENT_NAME="${AGENT_NAME}" \ - -e ACP_URL="http://${CONTAINER_NAME}" \ - -e ACP_PORT=8000 \ - -e ACP_TYPE="${ACP_TYPE}" \ - -e AGENTEX_BASE_URL=http://agentex:5003 \ - -e AGENTEX_API_BASE_URL=http://agentex:5003 \ - -e REDIS_URL=redis://agentex-redis:6379 \ - -e TEMPORAL_ADDRESS=agentex-temporal:7233 \ - -e TEMPORAL_HOST=agentex-temporal \ - -e OPENAI_API_KEY="${OPENAI_API_KEY}" \ - -p 8000:8000 \ - --network agentex-network \ - "${AGENT_IMAGE}" + # Check if this is a Temporal agent + if [[ "${AGENT_IMAGE}" == *"temporal"* ]]; then + IS_TEMPORAL_AGENT=true + + # Extract queue name from agent name (e.g., "10-temporal-000-hello-acp" -> "000_hello_acp_queue") + QUEUE_NAME=$(echo "${AGENT_NAME}" | sed -E 's/.*temporal-([0-9]+)-(.*)$/\1_\2_queue/' | tr '-' '_') + else + IS_TEMPORAL_AGENT=false + fi + + # Start the agent container with appropriate configuration + if [ "${IS_TEMPORAL_AGENT}" = true ]; then + # Temporal agent: start both worker and ACP server + docker run -d --name "${CONTAINER_NAME}" \ + -e ENVIRONMENT=development \ + -e AGENT_NAME="${AGENT_NAME}" \ + -e ACP_URL="http://${CONTAINER_NAME}" \ + -e ACP_PORT=8000 \ + -e ACP_TYPE="${ACP_TYPE}" \ + -e AGENTEX_BASE_URL=http://agentex:5003 \ + -e AGENTEX_API_BASE_URL=http://agentex:5003 \ + -e REDIS_URL=redis://agentex-redis:6379 \ + -e TEMPORAL_ADDRESS=agentex-temporal:7233 \ + -e TEMPORAL_HOST=agentex-temporal \ + -e AGENTEX_SERVER_TASK_QUEUE=agentex-server \ + -e WORKFLOW_NAME="${AGENT_NAME}" \ + -e WORKFLOW_TASK_QUEUE="${QUEUE_NAME}" \ + -e DATABASE_URL=postgresql://postgres:postgres@agentex-postgres:5432/agentex \ + -e MONGODB_URI=mongodb://agentex-mongodb:27017 \ + -e MONGODB_DATABASE_NAME=agentex \ + -e OPENAI_API_KEY="${OPENAI_API_KEY}" \ + -p 8000:8000 \ + --network agentex-network \ + "${AGENT_IMAGE}" \ + bash -c "python project/run_worker.py & uvicorn project.acp:acp --host 0.0.0.0 --port 8000" + else + # Non-temporal agent: start ACP server only + docker run -d --name "${CONTAINER_NAME}" \ + -e ENVIRONMENT=development \ + -e AGENT_NAME="${AGENT_NAME}" \ + -e ACP_URL="http://${CONTAINER_NAME}" \ + -e ACP_PORT=8000 \ + -e ACP_TYPE="${ACP_TYPE}" \ + -e AGENTEX_BASE_URL=http://agentex:5003 \ + -e AGENTEX_API_BASE_URL=http://agentex:5003 \ + -e REDIS_URL=redis://agentex-redis:6379 \ + -e OPENAI_API_KEY="${OPENAI_API_KEY}" \ + -p 8000:8000 \ + --network agentex-network \ + "${AGENT_IMAGE}" + fi + + # there are some agents that need npx to be installed to be run + echo "๐Ÿ“ฆ Installing Node.js, NPM, and NPX in agent container..." + docker exec "${CONTAINER_NAME}" sh -c " + set -e + echo '๐Ÿ”„ Updating package list...' + apt-get update -qq + + echo '๐Ÿ”„ Installing Node.js and NPM...' + apt-get install -y -qq curl + curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - + apt-get install -y -qq nodejs + + echo 'โœ… Versions after installation:' + node --version + npm --version + + " || { + echo "โŒ Node.js installation failed, checking container state..." + docker exec "${CONTAINER_NAME}" sh -c " + echo 'Container OS info:' + cat /etc/os-release || echo 'OS info not available' + echo 'Available packages:' + apt list --installed | grep node || echo 'No node packages found' + " + exit 1 + } echo "โณ Waiting for agent to start..." sleep 10 - # Debug: Check environment variables inside the container - echo "๐Ÿ” Checking environment variables in agent container..." - docker exec "${CONTAINER_NAME}" env | grep -E "OPENAI|AGENTEX|REDIS" | head -10 || echo "No relevant env vars found" - # Check for "Application startup complete" log message echo "๐Ÿ” Waiting for 'Application startup complete' log message..." TIMEOUT=60 @@ -260,100 +296,81 @@ jobs: exit 1 fi - echo "๐Ÿ” Verifying agent registration with AgentEx..." + echo "๐Ÿ” Waiting for agent registration with AgentEx..." REGISTRATION_TIMEOUT=30 REGISTRATION_ELAPSED=0 while [ $REGISTRATION_ELAPSED -lt $REGISTRATION_TIMEOUT ]; do - AGENT_DATA=$(curl -s http://localhost:5003/agents) - if echo "$AGENT_DATA" | grep -q "${AGENT_NAME}"; then - echo "โœ… Agent successfully registered with AgentEx" - - # Verify the ACP URL doesn't have double port - if echo "$AGENT_DATA" | grep -q ":8000:8000"; then - echo "โŒ Double port detected in agent registration!" - echo "๐Ÿ“‹ Agent data:" - echo "$AGENT_DATA" | jq '.' || echo "$AGENT_DATA" - exit 1 - else - echo "โœ… ACP URL correctly formatted (no double port)" - fi + if curl -s http://localhost:5003/agents | grep -q "${AGENT_NAME}"; then + echo "โœ… Agent registered successfully" break fi - echo "โณ Waiting for agent registration... (${REGISTRATION_ELAPSED}s/${REGISTRATION_TIMEOUT}s)" + echo "โณ Waiting for registration... (${REGISTRATION_ELAPSED}s/${REGISTRATION_TIMEOUT}s)" sleep 5 REGISTRATION_ELAPSED=$((REGISTRATION_ELAPSED + 5)) done if [ $REGISTRATION_ELAPSED -ge $REGISTRATION_TIMEOUT ]; then - echo "โŒ Agent registration check timeout - test failed" - echo "๐Ÿ“‹ Current agents registered:" - curl -s http://localhost:5003/agents || echo "Failed to query agents" - - echo "๐Ÿ“‹ Agent container logs:" - docker logs "${CONTAINER_NAME}" - - echo "๐Ÿ“‹ AgentEx service logs:" - cd agentex && docker compose logs --tail=50 agentex - cd .. - - echo "๐Ÿงน Cleaning up container..." - docker rm -f "${CONTAINER_NAME}" - + echo "โŒ Agent registration timeout after ${REGISTRATION_TIMEOUT}s" exit 1 fi - # Test connectivity before running main tests - echo "๐Ÿ” Testing connectivity to agent..." - if ! docker exec "${CONTAINER_NAME}" curl -s http://localhost:8000/health > /dev/null 2>&1; then - echo "โš ๏ธ Agent health endpoint not responding, checking if agent is listening..." - docker exec "${CONTAINER_NAME}" netstat -tlnp 2>/dev/null || echo "netstat not available" - fi - echo "๐Ÿ” Testing connectivity to AgentEx from agent container..." - if ! docker exec "${CONTAINER_NAME}" curl -s http://agentex:5003/health > /dev/null 2>&1; then - echo "โŒ Cannot reach AgentEx from agent container" - echo "๐Ÿ“‹ AgentEx service logs:" - cd agentex && docker compose logs --tail=50 agentex - cd .. - else - echo "โœ… Agent can reach AgentEx services" - fi - - # Show pre-test logs - echo "๐Ÿ“‹ Agent logs before testing:" - docker logs --tail=20 "${CONTAINER_NAME}" + # Run the test inside the container with retry logic for resilience + echo "๐Ÿงช Running tests inside the agent container with retry logic..." + MAX_RETRIES=3 + RETRY_COUNT=0 + TEST_PASSED=false - echo "๐Ÿ“‹ AgentEx logs before testing:" - cd agentex && docker compose logs --tail=20 agentex - cd .. + while [ $RETRY_COUNT -lt $MAX_RETRIES ] && [ "$TEST_PASSED" = false ]; do + RETRY_COUNT=$((RETRY_COUNT + 1)) + echo "๐Ÿ”„ Test attempt $RETRY_COUNT/$MAX_RETRIES" - # Run the test inside the container with explicit exit code handling - echo "๐Ÿงช Running tests inside the agent container..." - set +e # Don't exit on error immediately - docker exec "${CONTAINER_NAME}" pytest tests/test_agent.py -v - TEST_EXIT_CODE=$? - set -e # Re-enable exit on error + set +e # Don't exit on error immediately + docker exec "${CONTAINER_NAME}" pytest tests/test_agent.py -v + TEST_EXIT_CODE=$? + set -e # Re-enable exit on error - echo "๐Ÿ” Test exit code: $TEST_EXIT_CODE" + echo "๐Ÿ” Test exit code for attempt $RETRY_COUNT: $TEST_EXIT_CODE" - # Show post-test logs regardless of outcome - echo "๐Ÿ“‹ Agent logs after testing:" - docker logs --tail=50 "${CONTAINER_NAME}" + # Show post-test logs after each attempt + echo "๐Ÿ“‹ Agent logs after test attempt $RETRY_COUNT:" + docker logs --tail=30 "${CONTAINER_NAME}" - echo "๐Ÿ“‹ AgentEx logs after testing:" - cd agentex && docker compose logs --tail=50 agentex - cd .. + echo "
๐Ÿ“‹ AgentEx logs after test attempt $RETRY_COUNT (click to expand)" + echo "" + echo '```' + cd agentex && docker compose logs --tail=30 agentex + cd .. + echo '```' + echo "
" + + if [ $TEST_EXIT_CODE -eq 0 ]; then + echo "โœ… Tests passed successfully on attempt $RETRY_COUNT" + TEST_PASSED=true + else + echo "โŒ Test attempt $RETRY_COUNT failed with exit code $TEST_EXIT_CODE" + if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then + echo "๐Ÿ”„ Will retry in 5 seconds..." + sleep 5 + fi + fi + done - if [ $TEST_EXIT_CODE -eq 0 ]; then - echo "โœ… Tests passed successfully" + # Final result handling + if [ "$TEST_PASSED" = true ]; then + echo "๐ŸŽ‰ Tests passed after $RETRY_COUNT attempts" else - echo "โŒ Tests failed with exit code $TEST_EXIT_CODE" + echo "โŒ All $MAX_RETRIES test attempts failed" echo "๐Ÿ“‹ Full agent logs:" docker logs "${CONTAINER_NAME}" - echo "๐Ÿ“‹ Full AgentEx logs:" + echo "
๐Ÿ“‹ Full AgentEx logs (click to expand)" + echo "" + echo '```' cd agentex && docker compose logs agentex cd .. + echo '```' + echo "
" exit 1 fi From e1fc485731f5b548f40e516e5e9bf4130a116538 Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Mon, 8 Dec 2025 16:26:30 -0500 Subject: [PATCH 11/12] adding the steps --- .github/workflows/integration-tests.yml | 198 +++++++++++++++++++++--- .vscode/settings.json | 4 +- 2 files changed, 175 insertions(+), 27 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index a27a5df..19382c4 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -337,13 +337,7 @@ jobs: echo "๐Ÿ“‹ Agent logs after test attempt $RETRY_COUNT:" docker logs --tail=30 "${CONTAINER_NAME}" - echo "
๐Ÿ“‹ AgentEx logs after test attempt $RETRY_COUNT (click to expand)" - echo "" - echo '```' - cd agentex && docker compose logs --tail=30 agentex - cd .. - echo '```' - echo "
" + # AgentEx logs are hidden by default - no output to console if [ $TEST_EXIT_CODE -eq 0 ]; then echo "โœ… Tests passed successfully on attempt $RETRY_COUNT" @@ -364,19 +358,63 @@ jobs: echo "โŒ All $MAX_RETRIES test attempts failed" echo "๐Ÿ“‹ Full agent logs:" docker logs "${CONTAINER_NAME}" - echo "
๐Ÿ“‹ Full AgentEx logs (click to expand)" - echo "" - echo '```' - cd agentex && docker compose logs agentex - cd .. - echo '```' - echo "
" + # AgentEx logs are hidden by default in failure case too exit 1 fi echo "๐Ÿงน Cleaning up container..." docker rm -f "${CONTAINER_NAME}" + - name: Show AgentEx logs + if: always() + working-directory: ./agentex + run: | + echo "๐Ÿ“‹ AgentEx service logs:" + echo "========================" + docker compose logs agentex + echo "========================" + echo "" + echo "๐Ÿ“‹ AgentEx worker logs:" + echo "========================" + docker compose logs agentex-temporal-worker + echo "========================" + + - name: Record test result + id: test-result + if: always() + run: | + # Create results directory + mkdir -p test-results + + # Set variables for this agent + AGENT_NAME="${{ matrix.agent.agent_name }}" + + # Determine result based on whether we passed + if [ "${{ job.status }}" == "success" ]; then + result="passed" + echo "result=passed" >> $GITHUB_OUTPUT + echo "agent=${{ matrix.agent.agent_name }}" >> $GITHUB_OUTPUT + else + result="failed" + echo "result=failed" >> $GITHUB_OUTPUT + echo "agent=${{ matrix.agent.agent_name }}" >> $GITHUB_OUTPUT + fi + + # Save result to file for artifact upload + # Create a safe filename from agent name + safe_name=$(echo "${{ matrix.agent.agent_name }}" | tr '/' '_' | tr -d ' ' | tr ':' '_') + echo "$result" > "test-results/result-${safe_name}.txt" + echo "${{ matrix.agent.agent_name }}" > "test-results/agent-${safe_name}.txt" + echo "safe_name=${safe_name}" >> $GITHUB_OUTPUT + + - name: Upload test result + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-result-${{ steps.test-result.outputs.safe_name }} + path: test-results/ + retention-days: 1 + # Summary job to ensure the workflow fails if any test fails integration-tests-summary: name: "Integration Tests Summary" @@ -384,19 +422,129 @@ jobs: needs: [discover-agent-images, run-integration-tests] if: always() # Run even if some tests fail steps: - - name: Check test results + - name: Download all test results + uses: actions/download-artifact@v4 + with: + pattern: test-result-* + path: all-results/ + merge-multiple: true + continue-on-error: true + + - name: Generate Integration Test Summary run: | - echo "๐Ÿ” Checking integration test results..." + echo "# ๐Ÿงช AgentEx Integration Tests Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Initialize counters + passed_count=0 + failed_count=0 + skipped_count=0 + total_count=0 + + # Get all agents that were supposed to run + agents='${{ needs.discover-agent-images.outputs.agent-matrix }}' + + if [ -d "all-results" ] && [ "$(ls -A all-results 2>/dev/null)" ]; then + echo "๐Ÿ“Š Processing individual test results from artifacts..." + + echo "## Test Results" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "| Agent | Status | Result |" >> $GITHUB_STEP_SUMMARY + echo "|-------|--------|--------|" >> $GITHUB_STEP_SUMMARY + + # Process each result file + for result_file in all-results/result-*.txt; do + if [ -f "$result_file" ]; then + # Extract the safe name from filename + safe_name=$(basename "$result_file" .txt | sed 's/result-//') + + # Get corresponding agent name file + agent_file="all-results/agent-${safe_name}.txt" + + if [ -f "$agent_file" ]; then + agent_name=$(cat "$agent_file") + result=$(cat "$result_file") + + total_count=$((total_count + 1)) + + if [ "$result" = "passed" ]; then + echo "| \`$agent_name\` | โœ… | Passed |" >> $GITHUB_STEP_SUMMARY + passed_count=$((passed_count + 1)) + else + echo "| \`$agent_name\` | โŒ | Failed |" >> $GITHUB_STEP_SUMMARY + failed_count=$((failed_count + 1)) + fi + fi + fi + done + + # Check for any agents that didn't have results (skipped/cancelled) + # Use process substitution to avoid subshell scoping issues + while IFS= read -r expected_agent; do + safe_expected=$(echo "$expected_agent" | tr '/' '_' | tr -d ' ' | tr ':' '_') + if [ ! -f "all-results/result-${safe_expected}.txt" ]; then + echo "| \`$expected_agent\` | โญ๏ธ | Skipped/Cancelled |" >> $GITHUB_STEP_SUMMARY + skipped_count=$((skipped_count + 1)) + total_count=$((total_count + 1)) + fi + done < <(echo "$agents" | jq -r '.[].agent_name') - # Check if the matrix job had any failures - if [ "${{ needs.run-integration-tests.result }}" != "success" ]; then - echo "โŒ One or more integration tests failed" - echo "Matrix job result: ${{ needs.run-integration-tests.result }}" - exit 1 else - echo "โœ… All integration tests passed successfully" + echo "โš ๏ธ No individual test results found. This could mean:" + echo "- Test jobs were cancelled before completion" + echo "- Artifacts failed to upload" + echo "- No agents were found to test" + echo "" + + overall_result="${{ needs.run-integration-tests.result }}" + echo "Overall job status: **$overall_result**" + + if [[ "$overall_result" == "success" ]]; then + echo "โœ… All tests appear to have passed based on job status." + elif [[ "$overall_result" == "failure" ]]; then + echo "โŒ Some tests appear to have failed based on job status." + echo "" + echo "๐Ÿ’ก **Tip:** Check individual job logs for specific failure details." + elif [[ "$overall_result" == "cancelled" ]]; then + echo "โญ๏ธ Tests were cancelled." + else + echo "โ“ Test status is unclear: $overall_result" + fi + + # Don't show detailed breakdown when we don't have individual results + agent_count=$(echo "$agents" | jq -r '. | length') + echo "" + echo "Expected agent count: $agent_count" fi - - name: Final status - run: | - echo "๐ŸŽ‰ All tutorial agent integration tests completed successfully!" + # Only show detailed statistics if we have individual results + if [ -d "all-results" ] && [ "$(ls -A all-results 2>/dev/null)" ]; then + echo "" >> $GITHUB_STEP_SUMMARY + echo "## Summary Statistics" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "- **Total Tests:** $total_count" >> $GITHUB_STEP_SUMMARY + echo "- **Passed:** $passed_count โœ…" >> $GITHUB_STEP_SUMMARY + echo "- **Failed:** $failed_count โŒ" >> $GITHUB_STEP_SUMMARY + echo "- **Skipped:** $skipped_count โญ๏ธ" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + if [ $failed_count -eq 0 ] && [ $passed_count -gt 0 ]; then + echo "๐ŸŽ‰ **All tests passed!**" >> $GITHUB_STEP_SUMMARY + elif [ $failed_count -gt 0 ]; then + echo "โš ๏ธ **Some tests failed.** Check individual job logs for details." >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "๐Ÿ’ก **Tip:** Look for agent container logs in failed jobs for debugging information." >> $GITHUB_STEP_SUMMARY + else + echo "โ„น๏ธ **Tests were cancelled or skipped.**" >> $GITHUB_STEP_SUMMARY + fi + + # Exit with error if any tests failed + if [ $failed_count -gt 0 ]; then + exit 1 + fi + else + # Fallback to overall job result when individual results aren't available + if [[ "$overall_result" == "failure" ]]; then + exit 1 + fi + fi diff --git a/.vscode/settings.json b/.vscode/settings.json index aed069a..8407e90 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,7 +12,7 @@ "ruff.fixAll": true, "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", "python.terminal.activateEnvironment": true, - "python.languageServer": "None", + "python.languageServer": "Pylance", "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { @@ -92,4 +92,4 @@ "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode" } -} \ No newline at end of file +} From 9795b66d47fab81faf1f13b593d9bbf6428721b7 Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Mon, 29 Dec 2025 14:25:37 +0000 Subject: [PATCH 12/12] integrating the real polling wf --- .github/workflows/integration-tests.yml | 126 +++++++++++++++--------- 1 file changed, 78 insertions(+), 48 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 19382c4..dc42444 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -35,52 +35,58 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - # - name: Generate GitHub App Token - # id: generate-token - # uses: actions/create-github-app-token@v1 - # with: - # app-id: ${{ secrets.GITHUB_APP_ID }} - # private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }} - # owner: scaleapi - - name: Discover tutorial agent images id: discover - # env: - # GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + env: + GITHUB_TOKEN: ${{ secrets.PACKAGE_TOKEN }} + run: | - echo "๐Ÿ” Building agent matrix from known tutorial agent images..." - - # Define the list of known tutorial agent packages - PACKAGES=( - "scale-agentex-python/tutorial-agents/00_sync-000_hello_acp" - "scale-agentex-python/tutorial-agents/00_sync-010_multiturn" - "scale-agentex-python/tutorial-agents/00_sync-020_streaming" - "scale-agentex-python/tutorial-agents/10_async-00_base-000_hello_acp" - "scale-agentex-python/tutorial-agents/10_async-00_base-010_multiturn" - "scale-agentex-python/tutorial-agents/10_async-00_base-020_streaming" - "scale-agentex-python/tutorial-agents/10_async-00_base-030_tracing" - "scale-agentex-python/tutorial-agents/10_async-00_base-040_other_sdks" - "scale-agentex-python/tutorial-agents/10_async-00_base-080_batch_events" - "scale-agentex-python/tutorial-agents/10_async-10_temporal-000_hello_acp" - "scale-agentex-python/tutorial-agents/10_async-10_temporal-010_agent_chat" - "scale-agentex-python/tutorial-agents/10_async-10_temporal-020_state_machine" - "scale-agentex-python/tutorial-agents/10_async-10_temporal-030_custom_activities" - "scale-agentex-python/tutorial-agents/10_async-10_temporal-050_agent_chat_guardrails" - "scale-agentex-python/tutorial-agents/10_async-10_temporal-060_open_ai_agents_sdk_hello_world" - "scale-agentex-python/tutorial-agents/10_async-10_temporal-070_open_ai_agents_sdk_tools" - "scale-agentex-python/tutorial-agents/10_async-10_temporal-080_open_ai_agents_sdk_human_in_the_loop" - "scale-agentex-python/tutorial-agents/10_async-10_temporal-090_claude_agents_sdk_mvp" - ) - - # Build agent matrix from the package list + echo "๐Ÿ” Discovering tutorial agent images from GitHub Packages API..." + + # Query GitHub API for container packages in the scaleapi org + API_RESPONSE=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github+json" \ + "https://api.github.com/orgs/scaleapi/packages?package_type=container&per_page=100") + + # Check if response is an error + if echo "$API_RESPONSE" | jq -e '.message' > /dev/null 2>&1; then + echo "โŒ GitHub API error:" + echo "$API_RESPONSE" | jq '.' + exit 1 + fi + + # Check if response is an array + if ! echo "$API_RESPONSE" | jq -e 'type == "array"' > /dev/null 2>&1; then + echo "โŒ Unexpected API response format:" + echo "$API_RESPONSE" | head -c 500 + exit 1 + fi + + # Filter for: public packages, from scale-agentex-python repo, with tutorial-agents in the name, excluding deprecated agentic agents + # TODO: Remove the "agentic" exclusion filter once we have delete:packages permissions to clean up deprecated packages + PACKAGES=$(echo "$API_RESPONSE" | \ + jq -r '[.[] | select(.visibility == "public" and .repository.name == "scale-agentex-python" and (.name | contains("tutorial-agents")) and (.name | contains("agentic") | not))] | .[].name') + + if [ -z "$PACKAGES" ]; then + echo "โŒ No tutorial agent packages found" + echo "๐Ÿ“‹ Available packages in response:" + echo "$API_RESPONSE" | jq -r '.[].name' | head -20 + exit 1 + fi + + echo "๐Ÿ“ฆ Found packages:" + echo "$PACKAGES" + + # Build agent matrix from discovered packages AGENT_IMAGES="[" - for package_name in "${PACKAGES[@]}"; do + while IFS= read -r package_name; do + [ -z "$package_name" ] && continue echo "Processing package: $package_name" - # Extract agent directory name and convert to agent name format (e.g., "000-hello-acp") - # Pattern: [digits]_[type]-[digits]_[rest] -> [digits]-[rest] - agent_name=$(basename "$package_name" | sed -E 's/^[0-9]+_[^-]+-([0-9]+)_(.*)$/\1-\2/' | tr '_' '-') + # Extract everything after "tutorial-agents/" and convert underscores to dashes + # e.g., "scale-agentex-python/tutorial-agents/10_async-00_base-000_hello_acp" -> "10-async-00-base-000-hello-acp" + agent_name=$(echo "$package_name" | sed 's|.*/tutorial-agents/||' | tr '_' '-') echo " - Agent name: $agent_name" # Add to JSON array @@ -89,7 +95,7 @@ jobs: fi AGENT_IMAGES+='{"image":"ghcr.io/scaleapi/'"$package_name"':latest","agent_name":"'"$agent_name"'"}' - done + done <<< "$PACKAGES" AGENT_IMAGES+="]" @@ -179,7 +185,8 @@ jobs: # Set variables for this agent AGENT_NAME="${{ matrix.agent.agent_name }}" AGENT_IMAGE="${{ matrix.agent.image }}" - CONTAINER_NAME="agent-test-${AGENT_NAME}" + # Truncate container name to max 63 chars for DNS compatibility + CONTAINER_NAME="$(echo "${AGENT_NAME}" | cut -c1-63)" echo "๐Ÿงช Running integration test for agent: ${AGENT_NAME}" echo "๐Ÿณ Using image: ${AGENT_IMAGE}" @@ -296,25 +303,48 @@ jobs: exit 1 fi - echo "๐Ÿ” Waiting for agent registration with AgentEx..." - REGISTRATION_TIMEOUT=30 + echo "๐Ÿ” Waiting for agent to successfully register (checking container logs)..." + REGISTRATION_TIMEOUT=60 REGISTRATION_ELAPSED=0 while [ $REGISTRATION_ELAPSED -lt $REGISTRATION_TIMEOUT ]; do - if curl -s http://localhost:5003/agents | grep -q "${AGENT_NAME}"; then - echo "โœ… Agent registered successfully" + # Check for successful registration message in agent logs + if docker logs "${CONTAINER_NAME}" 2>&1 | grep -q "Successfully registered agent"; then + echo "โœ… Agent successfully registered (confirmed from container logs)" break fi - echo "โณ Waiting for registration... (${REGISTRATION_ELAPSED}s/${REGISTRATION_TIMEOUT}s)" - sleep 5 - REGISTRATION_ELAPSED=$((REGISTRATION_ELAPSED + 5)) + echo "โณ Waiting for successful registration... (${REGISTRATION_ELAPSED}s/${REGISTRATION_TIMEOUT}s)" + sleep 2 + REGISTRATION_ELAPSED=$((REGISTRATION_ELAPSED + 2)) done if [ $REGISTRATION_ELAPSED -ge $REGISTRATION_TIMEOUT ]; then echo "โŒ Agent registration timeout after ${REGISTRATION_TIMEOUT}s" + echo "๐Ÿ“‹ Container logs:" + docker logs "${CONTAINER_NAME}" exit 1 fi + # Verify agent is visible in AgentEx API + echo "๐Ÿ” Verifying agent is listed in AgentEx..." + if ! curl -s http://localhost:5003/agents | grep -q "${AGENT_NAME}"; then + echo "โš ๏ธ Agent not found in AgentEx API yet, continuing anyway..." + fi + + # Wait for Temporal worker to be fully ready + echo "โณ Waiting for Temporal worker to start processing..." + WORKER_TIMEOUT=30 + WORKER_ELAPSED=0 + + while [ $WORKER_ELAPSED -lt $WORKER_TIMEOUT ]; do + if docker logs "${CONTAINER_NAME}" 2>&1 | grep -q "Running workers for task queue"; then + echo "โœ… Temporal worker is running" + break + fi + echo "โณ Waiting for worker... (${WORKER_ELAPSED}s/${WORKER_TIMEOUT}s)" + sleep 2 + WORKER_ELAPSED=$((WORKER_ELAPSED + 2)) + done # Run the test inside the container with retry logic for resilience echo "๐Ÿงช Running tests inside the agent container with retry logic..."