Skip to content

Commit 89aa011

Browse files
committed
Merge branch 'main' into add-tests-to-image
2 parents 73a7365 + 8f28c26 commit 89aa011

File tree

14 files changed

+371
-98
lines changed

14 files changed

+371
-98
lines changed

.github/workflows/build-and-push-tutorial-agent.yml

Lines changed: 189 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,192 @@ name: Build and Push Tutorial Agent
33
on:
44
workflow_dispatch:
55
inputs:
6-
agent_path:
7-
description: "Path to the agent directory (e.g., examples/tutorials/10_agentic/00_base/000_hello_acp)"
8-
required: true
9-
type: string
10-
version_tag:
11-
description: "Version tag for the agent build (e.g., v1.0.0, latest)"
12-
required: true
13-
type: string
14-
default: "latest"
15-
16-
workflow_call:
17-
inputs:
18-
agent_path:
19-
description: "Path to the agent directory"
20-
required: true
21-
type: string
22-
version_tag:
23-
description: "Version tag for the agent build"
24-
required: true
25-
type: string
26-
default: "latest"
6+
rebuild_all:
7+
description: "Rebuild all tutorial agents regardless of changes, this is reserved for maintainers only."
8+
required: false
9+
type: boolean
10+
default: false
11+
12+
pull_request:
13+
paths:
14+
- "examples/tutorials/**"
15+
16+
push:
17+
branches:
18+
- main
19+
paths:
20+
- "examples/tutorials/**"
21+
22+
permissions:
23+
contents: read
24+
packages: write
25+
26+
jobs:
27+
check-permissions:
28+
if: ${{ github.event_name == 'workflow_dispatch' }}
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Check if user is maintainer
32+
uses: actions/github-script@v7
33+
with:
34+
script: |
35+
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
username: context.actor
39+
});
40+
41+
const allowedRoles = ['admin', 'maintain'];
42+
if (!allowedRoles.includes(permission.permission)) {
43+
throw new Error(`❌ User ${context.actor} does not have sufficient permissions. Required: ${allowedRoles.join(', ')}. Current: ${permission.permission}`);
44+
}
45+
46+
find-agents:
47+
runs-on: ubuntu-latest
48+
needs: [check-permissions]
49+
if: ${{ !cancelled() && !failure() }}
50+
outputs:
51+
agents: ${{ steps.get-agents.outputs.agents }}
52+
has_agents: ${{ steps.get-agents.outputs.has_agents }}
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0 # Fetch full history for git diff
58+
59+
- name: Find tutorial agents to build
60+
id: get-agents
61+
env:
62+
REBUILD_ALL: ${{ inputs.rebuild_all }}
63+
run: |
64+
# Find all tutorial directories with manifest.yaml
65+
all_agents=$(find examples/tutorials -name "manifest.yaml" -exec dirname {} \; | sort)
66+
agents_to_build=()
67+
68+
if [ "$REBUILD_ALL" = "true" ]; then
69+
echo "Rebuild all agents requested"
70+
agents_to_build=($(echo "$all_agents"))
71+
72+
echo "### 🔄 Rebuilding All Tutorial Agents" >> $GITHUB_STEP_SUMMARY
73+
else
74+
# Determine the base branch for comparison
75+
if [ "${{ github.event_name }}" = "pull_request" ]; then
76+
BASE_BRANCH="origin/${{ github.base_ref }}"
77+
echo "Comparing against PR base branch: $BASE_BRANCH"
78+
else
79+
BASE_BRANCH="HEAD~1"
80+
echo "Comparing against previous commit: $BASE_BRANCH"
81+
fi
82+
83+
# Check each agent directory for changes
84+
for agent_dir in $all_agents; do
85+
echo "Checking $agent_dir for changes..."
86+
87+
# Check if any files in this agent directory have changed
88+
if git diff --name-only $BASE_BRANCH HEAD | grep -q "^$agent_dir/"; then
89+
echo " ✅ Changes detected in $agent_dir"
90+
agents_to_build+=("$agent_dir")
91+
else
92+
echo " ⏭️ No changes in $agent_dir - skipping build"
93+
fi
94+
done
95+
96+
echo "### 🔄 Changed Tutorial Agents" >> $GITHUB_STEP_SUMMARY
97+
fi
98+
99+
# Convert array to JSON format and output summary
100+
if [ ${#agents_to_build[@]} -eq 0 ]; then
101+
echo "No agents to build"
102+
echo "agents=[]" >> $GITHUB_OUTPUT
103+
echo "has_agents=false" >> $GITHUB_OUTPUT
104+
else
105+
echo "Agents to build: ${#agents_to_build[@]}"
106+
agents_json=$(printf '%s\n' "${agents_to_build[@]}" | jq -R -s -c 'split("\n") | map(select(length > 0))')
107+
echo "agents=$agents_json" >> $GITHUB_OUTPUT
108+
echo "has_agents=true" >> $GITHUB_OUTPUT
109+
110+
echo "" >> $GITHUB_STEP_SUMMARY
111+
for agent in "${agents_to_build[@]}"; do
112+
echo "- \`$agent\`" >> $GITHUB_STEP_SUMMARY
113+
done
114+
echo "" >> $GITHUB_STEP_SUMMARY
115+
fi
116+
117+
build-agents:
118+
needs: find-agents
119+
if: ${{ needs.find-agents.outputs.has_agents == 'true' }}
120+
runs-on: ubuntu-latest
121+
timeout-minutes: 15
122+
strategy:
123+
matrix:
124+
agent_path: ${{ fromJson(needs.find-agents.outputs.agents) }}
125+
fail-fast: false
126+
127+
name: build-${{ matrix.agent_path }}
128+
steps:
129+
- name: Checkout repository
130+
uses: actions/checkout@v4
131+
132+
- name: Set up Docker Buildx
133+
uses: docker/setup-buildx-action@v3
134+
135+
- name: Set up Python
136+
uses: actions/setup-python@v4
137+
with:
138+
python-version: "3.12"
139+
140+
- name: Get latest agentex-sdk version from PyPI
141+
id: get-version
142+
run: |
143+
LATEST_VERSION=$(curl -s https://pypi.org/pypi/agentex-sdk/json | jq -r '.info.version')
144+
echo "Latest agentex-sdk version: $LATEST_VERSION"
145+
echo "AGENTEX_SDK_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
146+
pip install agentex-sdk==$LATEST_VERSION
147+
echo "Installed agentex-sdk version $LATEST_VERSION"
148+
149+
- name: Generate Image name
150+
id: image-name
151+
run: |
152+
# Remove examples/tutorials/ prefix and replace / with -
153+
AGENT_NAME=$(echo "${{ matrix.agent_path }}" | sed 's|^examples/tutorials/||' | sed 's|/|-|g')
154+
echo "AGENT_NAME=$AGENT_NAME" >> $GITHUB_ENV
155+
echo "agent_name=$AGENT_NAME" >> $GITHUB_OUTPUT
156+
echo "Agent name set to $AGENT_NAME"
157+
158+
- name: Login to GitHub Container Registry
159+
# Only login if we're going to push (main branch or rebuild_all)
160+
if: ${{ github.event_name == 'push' || inputs.rebuild_all }}
161+
uses: docker/login-action@v3
162+
with:
163+
registry: ghcr.io
164+
username: ${{ github.actor }}
165+
password: ${{ secrets.GITHUB_TOKEN }}
166+
167+
- name: Build and Conditionally Push Agent Image
168+
env:
169+
REGISTRY: ghcr.io
170+
run: |
171+
AGENT_NAME="${{ steps.image-name.outputs.agent_name }}"
172+
REPOSITORY_NAME="${{ github.repository }}/tutorial-agents/${AGENT_NAME}"
173+
174+
# Determine if we should push based on event type
175+
if [ "${{ github.event_name }}" = "push" ] || [ "${{ inputs.rebuild_all }}" = "true" ]; then
176+
SHOULD_PUSH=true
177+
VERSION_TAG="latest"
178+
echo "🚀 Building and pushing agent: ${{ matrix.agent_path }}"
179+
else
180+
SHOULD_PUSH=false
181+
VERSION_TAG="${{ github.commit.sha }}"
182+
echo "🔍 Validating build for agent: ${{ matrix.agent_path }}"
183+
fi
184+
185+
# Build command - add --push only if we should push
186+
BUILD_ARGS="--manifest ${{ matrix.agent_path }}/manifest.yaml --registry ${REGISTRY} --tag ${VERSION_TAG} --platforms linux/amd64 --repository-name ${REPOSITORY_NAME}"
187+
188+
if [ "$SHOULD_PUSH" = "true" ]; then
189+
agentex agents build $BUILD_ARGS --push
190+
echo "✅ Successfully built and pushed: ${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}"
191+
else
192+
agentex agents build $BUILD_ARGS
193+
echo "✅ Build validation successful for: ${{ matrix.agent_path }}"
194+
fi

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.5.3"
2+
".": "0.6.0"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 34
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-2b422fbf02ff3b77795fb8c71cbe784de3a3add48560655ba4fe7f3fcc509995.yml
3-
openapi_spec_hash: bca5c04d823694c87417dae188480291
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-0556db8b729c565a582332ce7e175b6b0d95e0d56addd543673a9e52ebd5d58b.yml
3+
openapi_spec_hash: 8c0f9039f66b0017b2dea4574efefed4
44
config_hash: 0197f86ba1a4b1b5ce813d0e62138588

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## 0.6.0 (2025-11-04)
4+
5+
Full Changelog: [v0.5.3...v0.6.0](https://github.com/scaleapi/scale-agentex-python/compare/v0.5.3...v0.6.0)
6+
7+
### Features
8+
9+
* **api:** api update ([ec61dd3](https://github.com/scaleapi/scale-agentex-python/commit/ec61dd3124fbf169dcdcced262a30bfbed080b5f))
10+
11+
12+
### Chores
13+
14+
* **internal:** grammar fix (it's -> its) ([36e27da](https://github.com/scaleapi/scale-agentex-python/commit/36e27daed52435b300f090ac4643cd502a817a1e))
15+
316
## 0.5.3 (2025-10-31)
417

518
Full Changelog: [v0.5.2...v0.5.3](https://github.com/scaleapi/scale-agentex-python/compare/v0.5.2...v0.5.3)

examples/tutorials/00_sync/000_hello_acp/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ RUN uv pip install --system --upgrade pip setuptools wheel
2222

2323
ENV UV_HTTP_TIMEOUT=1000
2424

25+
2526
# Copy pyproject.toml and README.md to install dependencies
2627
COPY 000_hello_acp/pyproject.toml /app/000_hello_acp/pyproject.toml
2728
COPY 000_hello_acp/README.md /app/000_hello_acp/README.md
@@ -47,4 +48,4 @@ ENV PYTHONPATH=/app
4748
ENV AGENT_NAME=s000-hello-acp
4849

4950
# Run the agent using uvicorn
50-
CMD ["uvicorn", "project.acp:acp", "--host", "0.0.0.0", "--port", "8000"]
51+
CMD ["uvicorn", "project.acp:acp", "--host", "0.0.0.0", "--port", "8000"]

examples/tutorials/00_sync/000_hello_acp/project/acp.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
logger = make_logger(__name__)
1111

12-
1312
# Create an ACP server
1413
acp = FastACP.create(
1514
acp_type="sync",
@@ -18,18 +17,17 @@
1817

1918
@acp.on_message_send
2019
async def handle_message_send(
21-
params: SendMessageParams
20+
params: SendMessageParams,
2221
) -> Union[TaskMessageContent, AsyncGenerator[TaskMessageUpdate, None]]:
2322
"""Default message handler with streaming support"""
2423
# Extract content safely from the message
2524
message_text = ""
26-
if hasattr(params.content, 'content'):
27-
content_val = getattr(params.content, 'content', '')
25+
if hasattr(params.content, "content"):
26+
content_val = getattr(params.content, "content", "")
2827
if isinstance(content_val, str):
2928
message_text = content_val
3029

3130
return TextContent(
3231
author="agent",
3332
content=f"Hello! I've received your message. Here's a generic response, but in future tutorials we'll see how you can get me to intelligently respond to your message. This is what I heard you say: {message_text}",
3433
)
35-

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "agentex-sdk"
3-
version = "0.5.3"
3+
version = "0.6.0"
44
description = "The official Python library for the agentex API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -24,23 +24,23 @@ dependencies = [
2424
"pyyaml>=6.0.2,<7",
2525
"jsonschema>=4.23.0,<5",
2626
"jsonref>=1.1.0,<2",
27-
"temporalio>=1.10.0,<2",
27+
"temporalio>=1.18.2,<2",
2828
"aiohttp>=3.10.10,<4",
2929
"redis>=5.2.0,<6",
3030
"litellm>=1.66.0,<2",
3131
"kubernetes>=25.0.0,<29.0.0",
3232
"jinja2>=3.1.3,<4",
3333
"mcp[cli]>=1.4.1",
3434
"scale-gp>=0.1.0a59",
35-
"openai-agents==0.2.7", # 0.2.3 bug - https://github.com/openai/openai-agents-python/issues/1276
35+
"openai-agents==0.4.2",
3636
"tzlocal>=5.3.1",
3737
"tzdata>=2025.2",
3838
"pytest>=8.4.0",
3939
"json_log_formatter>=1.1.1",
4040
"pytest-asyncio>=1.0.0",
4141
"scale-gp-beta==0.1.0a20",
4242
"ipykernel>=6.29.5",
43-
"openai==1.99.9", # anything higher than 1.99.9 breaks litellm - https://github.com/BerriAI/litellm/issues/13711
43+
"openai>=2.2,<3", # Required by openai-agents 0.4.2; litellm now supports openai 2.x (issue #13711 resolved: https://github.com/BerriAI/litellm/issues/13711)
4444
"cloudpickle>=3.1.1",
4545
"datadog>=0.52.1",
4646
"ddtrace>=3.13.0"

0 commit comments

Comments
 (0)