Skip to content

Commit 378fdc6

Browse files
committed
Add example pipeline workflow
1 parent b375630 commit 378fdc6

3 files changed

Lines changed: 192 additions & 0 deletions

File tree

.github/workflows/example.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Example Pipeline Tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
suite:
7+
description: "Example suite to run"
8+
required: true
9+
default: "core"
10+
type: choice
11+
options:
12+
- core
13+
- graph
14+
- multi_agent
15+
- team_agent
16+
- all
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.suite }}
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
example-smoke:
27+
runs-on: [self-hosted, trpc-agent-python-ci]
28+
timeout-minutes: 45
29+
env:
30+
DISABLE_TRPC_AGENT_REPORT: true
31+
TRPC_AGENT_API_KEY: ${{ secrets.TRPC_AGENT_API_KEY }}
32+
TRPC_AGENT_BASE_URL: http://03-llm.woa.com/glm5/v1
33+
TRPC_AGENT_MODEL_NAME: glm-5.0-w4afp8
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Validate model secrets
39+
run: |
40+
missing=0
41+
for name in TRPC_AGENT_API_KEY TRPC_AGENT_BASE_URL TRPC_AGENT_MODEL_NAME; do
42+
if [ -z "${!name:-}" ]; then
43+
echo "::error::Missing required secret or env: ${name}"
44+
missing=1
45+
fi
46+
done
47+
exit "$missing"
48+
49+
- name: Install package and example dependencies
50+
run: |
51+
python3 -m pip install --upgrade pip
52+
pip3 install -e .
53+
pip3 install -r requirements-test.txt
54+
pip3 install -r pipeline_test/requirements.txt
55+
56+
- name: Run example smoke suite
57+
run: |
58+
bash pipeline_test/run_agent_examples.sh "${{ inputs.suite }}"

pipeline_test/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Dependencies used only by example pipeline smoke tests.
2+
python-dotenv
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
export DISABLE_TRPC_AGENT_REPORT="${DISABLE_TRPC_AGENT_REPORT:-true}"
6+
7+
CORE_AGENT_EXAMPLES=(
8+
"examples/quickstart/"
9+
"examples/llmagent/"
10+
"examples/llmagent_with_schema/"
11+
)
12+
13+
GRAPH_EXAMPLES=(
14+
"examples/graph/"
15+
)
16+
17+
MULTI_AGENT_EXAMPLES=(
18+
"examples/multi_agent_chain/"
19+
"examples/multi_agent_parallel/"
20+
)
21+
22+
TEAM_AGENT_EXAMPLES=(
23+
"examples/team/"
24+
"examples/team_as_sub_agent/"
25+
)
26+
27+
run_example() {
28+
local example="$1"
29+
30+
echo ""
31+
echo "=== Running ${example} ==="
32+
33+
if [[ "$example" == *.py ]]; then
34+
if [[ ! -f "$example" ]]; then
35+
echo "Example file not found: $example" >&2
36+
exit 1
37+
fi
38+
python3 "$example"
39+
return
40+
fi
41+
42+
if [[ ! -d "$example" ]]; then
43+
echo "Example directory not found: $example" >&2
44+
exit 1
45+
fi
46+
47+
if [[ ! -f "${example%/}/run_agent.py" ]]; then
48+
echo "Example run_agent.py not found: ${example%/}/run_agent.py" >&2
49+
exit 1
50+
fi
51+
52+
(
53+
cd "$example"
54+
python3 run_agent.py
55+
)
56+
}
57+
58+
run_examples() {
59+
local examples=("$@")
60+
61+
for example in "${examples[@]}"; do
62+
run_example "$example"
63+
done
64+
}
65+
66+
run_core_agent() {
67+
echo "=== Running core agent examples ==="
68+
run_examples "${CORE_AGENT_EXAMPLES[@]}"
69+
}
70+
71+
run_graph_agent() {
72+
echo "=== Running graph examples ==="
73+
run_examples "${GRAPH_EXAMPLES[@]}"
74+
}
75+
76+
run_multi_agent() {
77+
echo "=== Running multi-agent examples ==="
78+
run_examples "${MULTI_AGENT_EXAMPLES[@]}"
79+
}
80+
81+
run_team_agent() {
82+
echo "=== Running team-agent examples ==="
83+
run_examples "${TEAM_AGENT_EXAMPLES[@]}"
84+
}
85+
86+
run_all() {
87+
run_core_agent
88+
run_graph_agent
89+
run_multi_agent
90+
run_team_agent
91+
}
92+
93+
show_usage() {
94+
echo "Usage: $0 [core|graph|multi_agent|team_agent|all]"
95+
echo ""
96+
echo "Suites:"
97+
echo " core Run quickstart and basic LlmAgent examples."
98+
echo " graph Run the minimal GraphAgent example."
99+
echo " multi_agent Run basic multi-agent orchestration examples."
100+
echo " team_agent Run basic TeamAgent examples."
101+
echo " all Run every suite above."
102+
echo ""
103+
echo "If no suite is provided, core examples will be run."
104+
}
105+
106+
suite="${1:-core}"
107+
108+
case "$suite" in
109+
core)
110+
run_core_agent
111+
;;
112+
graph)
113+
run_graph_agent
114+
;;
115+
multi_agent)
116+
run_multi_agent
117+
;;
118+
team_agent)
119+
run_team_agent
120+
;;
121+
all)
122+
run_all
123+
;;
124+
-h|--help)
125+
show_usage
126+
;;
127+
*)
128+
echo "Error: unknown suite '$suite'" >&2
129+
show_usage
130+
exit 1
131+
;;
132+
esac

0 commit comments

Comments
 (0)