Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/build-and-push-tutorial-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,92 @@ on:
required: true
type: string
default: "latest"

permissions:
contents: read
packages: write

jobs:
build-and-push-agent:
timeout-minutes: 10
name: Build Tutorial Agent
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Validate agent path exists
run: |
if [ ! -d "${{ inputs.agent_path }}" ]; then
echo "❌ Error: Agent path '${{ inputs.agent_path }}' does not exist"
exit 1
fi
echo "βœ… Agent path verified: ${{ inputs.agent_path }}"

- name: Validate manifest.yaml exists
run: |
if [ ! -f "${{ inputs.agent_path }}/manifest.yaml" ]; then
echo "❌ Error: manifest.yaml not found in '${{ inputs.agent_path }}'"
exit 1
fi
echo "βœ… manifest.yaml found"
echo "### Validation Summary" >> $GITHUB_STEP_SUMMARY
echo "- **Agent Path**: ${{ inputs.agent_path }}" >> $GITHUB_STEP_SUMMARY
echo "- **Version Tag**: ${{ inputs.version_tag }}" >> $GITHUB_STEP_SUMMARY
echo "- **Status**: βœ… Validation passed" >> $GITHUB_STEP_SUMMARY

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Get latest agentex-sdk version from PyPI
id: get-version
run: |
LATEST_VERSION=$(curl -s https://pypi.org/pypi/agentex-sdk/json | jq -r '.info.version')
echo "Latest agentex-sdk version: $LATEST_VERSION"
echo "AGENTEX_SDK_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
pip install agentex-sdk==$LATEST_VERSION
echo "Installed agentex-sdk version $LATEST_VERSION"

- name: Generate Image name
id: image-name
run: |
# Remove examples/tutorials/ prefix and replace / with -
AGENT_NAME=$(echo "${{ inputs.agent_path }}" | sed 's|^examples/tutorials/||' | sed 's|/|-|g')
echo "AGENT_NAME=$AGENT_NAME" >> $GITHUB_ENV
echo "agent_name=$AGENT_NAME" >> $GITHUB_OUTPUT
echo "Agent name set to $AGENT_NAME"

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Agent Image
env:
REGISTRY: ghcr.io
REPOSITORY_PREFIX: agentex-agents
run: |
AGENT_NAME="${{ steps.image-name.outputs.agent_name }}"
VERSION_TAG="${{ inputs.version_tag }}"
REPOSITORY_NAME="${REPOSITORY_PREFIX}/${AGENT_NAME}"
FULL_IMAGE="${REGISTRY}/${REPOSITORY_NAME}:${VERSION_TAG}"

agentex agents build \
--manifest "${{ inputs.agent_path }}/manifest.yaml" \
--registry "${REGISTRY}" \
--tag "${VERSION_TAG}" \
--platforms "linux/amd64" \
--repository-name "${REPOSITORY_NAME}" \
--push

echo "Successfully built and pushed: ${FULL_IMAGE}"
echo "### Build Complete" >> $GITHUB_STEP_SUMMARY
echo "- **Image**: \`${FULL_IMAGE}\`" >> $GITHUB_STEP_SUMMARY
3 changes: 2 additions & 1 deletion examples/tutorials/00_sync/000_hello_acp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RUN uv pip install --system --upgrade pip setuptools wheel

ENV UV_HTTP_TIMEOUT=1000


# Copy pyproject.toml and README.md to install dependencies
COPY 000_hello_acp/pyproject.toml /app/000_hello_acp/pyproject.toml
COPY 000_hello_acp/README.md /app/000_hello_acp/README.md
Expand All @@ -38,4 +39,4 @@ RUN uv pip install --system .
ENV PYTHONPATH=/app

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