Skip to content

Commit a3becbc

Browse files
committed
added check for the output from the quickstart agent
1 parent 6340a30 commit a3becbc

7 files changed

Lines changed: 88 additions & 25 deletions

File tree

.github/workflows/integration_tests.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ jobs:
1717
matrix:
1818
include:
1919
- build-dir: quickstart-agent
20-
context: ./testcases/quickstart-agent
21-
agent-input: '{"topic": "cats"}'
2220

2321
steps:
2422
- name: Checkout code
@@ -29,12 +27,9 @@ jobs:
2927

3028
- name: Build Docker image (${{ matrix.build-dir }})
3129
run: |
32-
docker build -f Dockerfile \
30+
docker build -f testcases/${{ matrix.build-dir }}/Dockerfile \
3331
-t ${{ matrix.build-dir }}:test \
3432
--build-arg CLIENT_ID="${{ secrets.ALPHA_TEST_CLIENT_ID }}" \
3533
--build-arg CLIENT_SECRET="${{ secrets.ALPHA_TEST_CLIENT_SECRET }}" \
3634
--build-arg BASE_URL="${{ secrets.ALPHA_BASE_URL }}" \
37-
--build-arg SKIP_HUMAN_APPROVAL=true \
38-
--build-arg USE_REGULAR_INTERRUPT=true \
39-
--build-arg AGENT_INPUT='${{ matrix.agent-input }}' \
40-
${{ matrix.context }}
35+
.

Dockerfile renamed to testcases/quickstart-agent/Dockerfile

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,32 @@ WORKDIR /app
44

55
COPY . .
66

7+
WORKDIR /app/testcases/quickstart-agent
8+
79
RUN uv sync
810

911
ARG CLIENT_ID
1012
ARG CLIENT_SECRET
1113
ARG BASE_URL
12-
ARG AGENT_INPUT
13-
ARG SKIP_HUMAN_APPROVAL=false
14-
ARG USE_REGULAR_INTERRUPT=false
1514

16-
# Validate required environment variables
1715
RUN if [ -z "$CLIENT_ID" ]; then echo "CLIENT_ID build arg is required" && exit 1; fi
1816
RUN if [ -z "$CLIENT_SECRET" ]; then echo "CLIENT_SECRET build arg is required" && exit 1; fi
1917
RUN if [ -z "$BASE_URL" ]; then echo "BASE_URL build arg is required" && exit 1; fi
20-
RUN if [ -z "$AGENT_INPUT" ]; then echo "AGENT_INPUT build arg is required" && exit 1; fi
2118

2219
# Set environment variables for runtime
2320
ENV CLIENT_ID=$CLIENT_ID
2421
ENV CLIENT_SECRET=$CLIENT_SECRET
2522
ENV BASE_URL=$BASE_URL
2623
ENV TAVILY_API_KEY=${TAVILY_API_KEY:-""}
2724
ENV UIPATH_TENANT_ID=${UIPATH_TENANT_ID:-""}
28-
29-
# for the ticket_classification
30-
ENV SKIP_HUMAN_APPROVAL=$SKIP_HUMAN_APPROVAL
31-
ENV USE_REGULAR_INTERRUPT=$USE_REGULAR_INTERRUPT
25+
ENV UIPATH_JOB_KEY=8c6a342e-036e-492c-a3d2-99e66f6554ce
3226

3327
# Authenticate with UiPath during build
3428
RUN uv run uipath auth --client-id="$CLIENT_ID" --client-secret="$CLIENT_SECRET" --base-url="$BASE_URL"
3529

30+
RUN uv run uipath pack
3631

37-
RUN uv run uipath run agent "$AGENT_INPUT"
32+
RUN AGENT_INPUT=$(cat input.json) && uv run uipath run agent "$AGENT_INPUT"
3833

39-
RUN if [ "$USE_REGULAR_INTERRUPT" = "true" ] && echo "$AGENT_INPUT" | grep -q '"ticket_id"'; then \
40-
echo "Running resume for ticket classification with regular interrupt..."; \
41-
uv run uipath run agent '{"Answer": true}' --resume; \
42-
else \
43-
echo "Skipping resume - either not ticket classification or USE_REGULAR_INTERRUPT=false"; \
44-
fi
34+
# Run the Python assert script to validate output
35+
RUN python src/assert.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"topic": "cats"}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"dependencies": ["."],
33
"workflows": {
4-
"agent": "main.py:agent"
4+
"agent": "./src/main.py:agent"
55
},
66
"env": ".env"
77
}

testcases/quickstart-agent/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ authors = [{ name = "John Doe", email = "john.doe@myemail.com" }]
66
readme = { file = "README.md", content-type = "text/markdown" }
77
requires-python = ">=3.10"
88
dependencies = [
9-
"uipath-llamaindex>=0.0.29",
9+
"uipath-llamaindex",
1010
"llama-index-llms-openai>=0.2.2",
1111
"uipath>=2.0.82",
1212
]
13+
14+
[tool.uv.sources]
15+
uipath-llamaindex = { path = "../../", editable = true }
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import os
2+
import sys
3+
import json
4+
5+
print("Checking company research agent output...")
6+
7+
# Check NuGet package
8+
uipath_dir = ".uipath"
9+
if not os.path.exists(uipath_dir):
10+
print("NuGet package directory (.uipath) not found")
11+
sys.exit(1)
12+
13+
nupkg_files = [f for f in os.listdir(uipath_dir) if f.endswith('.nupkg')]
14+
if not nupkg_files:
15+
print("NuGet package file (.nupkg) not found in .uipath directory")
16+
sys.exit(1)
17+
18+
print(f"NuGet package found: {nupkg_files[0]}")
19+
20+
# Check agent output file
21+
output_file = "__uipath/output.json"
22+
if not os.path.isfile(output_file):
23+
print("Agent output file not found")
24+
sys.exit(1)
25+
26+
print("Agent output file found")
27+
28+
# Check status and required fields
29+
try:
30+
with open(output_file, 'r', encoding='utf-8') as f:
31+
output_data = json.load(f)
32+
33+
# Check status
34+
status = output_data.get("status")
35+
if status != "successful":
36+
print(f"Agent execution failed with status: {status}")
37+
sys.exit(1)
38+
39+
print("Agent execution status: successful")
40+
41+
# Check required fields for company research agent
42+
if "output" not in output_data:
43+
print("Missing 'output' field in agent response")
44+
sys.exit(1)
45+
46+
output_content = output_data["output"]
47+
if "joke" not in output_content:
48+
print("Missing 'joke' field in output")
49+
sys.exit(1)
50+
51+
joke = output_content["joke"]
52+
if not joke or joke.strip() == "":
53+
print("Joke field is empty")
54+
sys.exit(1)
55+
56+
if "critique" not in output_content:
57+
print("Missing 'critique' field in output")
58+
sys.exit(1)
59+
60+
critique = output_content["critique"]
61+
if not critique or critique.strip() == "":
62+
print("Critique field is empty")
63+
sys.exit(1)
64+
65+
print(f"Joke: {joke}")
66+
print(f"Critique: {critique}")
67+
68+
print("Required fields validation passed")
69+
print("Company research agent working correctly.")
70+
71+
except Exception as e:
72+
print(f"Error checking output: {e}")
73+
sys.exit(1)

0 commit comments

Comments
 (0)