Skip to content

Commit 0b08a3f

Browse files
committed
fix(agents): update scripts to agents
1 parent 2dfc1f1 commit 0b08a3f

File tree

14 files changed

+619
-467
lines changed

14 files changed

+619
-467
lines changed

.env.example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ GCP__ZONE=us-central1-a
2121
GCP__MACHINE_TYPE=c3-standard-4
2222
GCP__SERVICE_ACCOUNT=confidential-sa@verifiable-ai-hackathon.iam.gserviceaccount.com
2323
GCP__TEE_IMAGE_REFERENCE=ghcr.io/flare-foundation/flare-ai-kit:main
24-
# For production, use `confidential-space-250301`
25-
GCP__CONFIDENTIAL_IMAGE=confidential-space-debug-250301
24+
# For production, use `family/confidential-space`
25+
GCP__CONFIDENTIAL_IMAGE=family/confidential-space-debug
2626
# For production, use `false`
2727
GCP__TEE_CONTAINER_LOG_REDIRECT=true
28+
# Use either TDX or SEV
2829
GCP__CONFIDENTIAL_COMPUTE_TYPE=TDX
2930
GCP__SCOPES=https://www.googleapis.com/auth/cloud-platform
3031
GCP__TAGS=flare-ai,http-server,https-server
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
1-
name: Docker Scripts Validation
1+
name: Agents Validation
22

33
on:
4-
push:
5-
branches: ["main"]
6-
paths:
7-
- "Dockerfile"
8-
- "scripts/**"
9-
- "pyproject.toml"
10-
- "uv.lock"
114
pull_request:
12-
branches: ["main"]
5+
branches:
6+
- main
137
paths:
8+
- ".github/workflows/docker-agents.yml"
149
- "Dockerfile"
15-
- "scripts/**"
10+
- "agents/**"
1611
- "pyproject.toml"
1712
- "uv.lock"
1813

1914
permissions:
2015
contents: read
2116

2217
jobs:
23-
validate-docker-scripts:
18+
validate-docker-agents:
2419
runs-on: ubuntu-latest
25-
20+
2621
strategy:
2722
matrix:
28-
script:
23+
agent:
2924
- name: "PDF Ingestion"
3025
extras: "pdf"
31-
script_file: "ingest_pdf.py"
26+
filename: "ingest_pdf.py"
3227
test_timeout: "300" # 5 minutes
33-
3428
env:
35-
# Test environment variables
3629
LOG_LEVEL: INFO
3730
AGENT__GEMINI_MODEL: "gemini-2.0-flash"
3831
AGENT__GEMINI_API_KEY: ${{ secrets.AGENT__GEMINI_API_KEY }}
@@ -47,46 +40,46 @@ jobs:
4740
- name: Set up Docker Buildx
4841
uses: docker/setup-buildx-action@v3
4942

50-
- name: Build Docker image for ${{ matrix.script.name }}
43+
- name: Build Docker image for ${{ matrix.agent.name }}
5144
run: |
5245
docker build \
53-
--build-arg EXTRAS=${{ matrix.script.extras }} \
54-
--build-arg SCRIPT=${{ matrix.script.script_file }} \
55-
--tag fai-script-${{ matrix.script.extras }} \
46+
--build-arg EXTRAS=${{ matrix.agent.extras }} \
47+
--build-arg AGENT=${{ matrix.agent.filename }} \
48+
--tag fai-agent-${{ matrix.agent.extras }} \
5649
--cache-from type=gha \
5750
--cache-to type=gha,mode=max \
5851
.
5952
60-
- name: Validate script exists in image
53+
- name: Validate agent script exists in image
6154
run: |
62-
docker run --rm fai-script-${{ matrix.script.extras }} \
63-
test -f "/app/scripts/${{ matrix.script.script_file }}"
55+
docker run --rm fai-agent-${{ matrix.agent.extras }} \
56+
test -f "/app/agents/${{ matrix.agent.filename }}"
6457
65-
- name: Test script startup (dry run)
58+
- name: Test agent startup (dry run)
6659
timeout-minutes: 5
6760
run: |
68-
# Simple validation that the script exists and dependencies are available
61+
# Simple validation that the agent exists and dependencies are available
6962
docker run --rm \
7063
-e LOG_LEVEL="$LOG_LEVEL" \
7164
-e AGENT__GEMINI_MODEL="$AGENT__GEMINI_MODEL" \
7265
-e AGENT__GEMINI_API_KEY="$AGENT__GEMINI_API_KEY" \
7366
-e ECOSYSTEM__WEB3_PROVIDER_URL="$ECOSYSTEM__WEB3_PROVIDER_URL" \
7467
-e INGESTION__CHUNK_SIZE="$INGESTION__CHUNK_SIZE" \
7568
-e TEE__SIMULATE_ATTESTATION_TOKEN="$TEE__SIMULATE_ATTESTATION_TOKEN" \
76-
fai-script-${{ matrix.script.extras }} \
69+
fai-agent-${{ matrix.agent.extras }} \
7770
python -c "
7871
import sys
7972
import os
8073
81-
# Test that script file exists
82-
script_path = '/app/scripts/${{ matrix.script.script_file }}'
83-
if not os.path.exists(script_path):
84-
print(f'❌ Script not found: {script_path}')
74+
# Test that agent file exists
75+
agent_path = '/app/agents/${{ matrix.agent.filename }}'
76+
if not os.path.exists(agent_path):
77+
print(f'❌ Agent not found: {agent_path}')
8578
sys.exit(1)
86-
print(f'✅ Script exists: {script_path}')
79+
print(f'✅ Agent exists: {agent_path}')
8780
8881
# Test that required dependencies are available
89-
if '${{ matrix.script.extras }}' == 'pdf':
82+
if '${{ matrix.agent.extras }}' == 'pdf':
9083
try:
9184
import PIL
9285
import fitz # pymupdf
@@ -96,25 +89,24 @@ jobs:
9689
print(f'❌ PDF dependency missing: {e}')
9790
sys.exit(1)
9891
99-
print('✅ Script validation completed successfully')
92+
print('✅ Agent validation completed successfully')
10093
"
10194
10295
- name: Test container health
10396
run: |
10497
# Test that the container can start and the Python environment is healthy
105-
docker run --rm fai-script-${{ matrix.script.extras }} \
98+
docker run --rm fai-agent-${{ matrix.agent.extras }} \
10699
python -c "
107100
import sys
108101
print(f'Python version: {sys.version}')
109102
print(f'Python path: {sys.path}')
110103
111-
# Test core dependencies (some modules may require optional deps)
104+
# Test core dependencies
112105
try:
113106
import flare_ai_kit
114107
print('✅ flare-ai-kit imported successfully')
115108
except ImportError as e:
116-
print(f'⚠️ flare-ai-kit import issue (may need more extras): {e}')
117-
# Test basic Python packages instead
109+
print(f'⚠️ flare-ai-kit import issue: {e}')
118110
import httpx, pydantic, structlog
119111
print('✅ Core Python dependencies available')
120112
@@ -127,16 +119,15 @@ jobs:
127119
print('✅ Container health check passed')
128120
"
129121
130-
- name: Test script dependencies for ${{ matrix.script.name }}
122+
- name: Test agent dependencies for ${{ matrix.agent.name }}
131123
run: |
132124
# Test that the specific extras are properly installed
133-
docker run --rm fai-script-${{ matrix.script.extras }} \
125+
docker run --rm fai-agent-${{ matrix.agent.extras }} \
134126
python -c "
135127
import sys
136-
137-
extras = '${{ matrix.script.extras }}'
128+
extras = '${{ matrix.agent.extras }}'
138129
print(f'Testing dependencies for extras: {extras}')
139-
130+
140131
if 'pdf' in extras:
141132
try:
142133
import PIL
@@ -146,7 +137,7 @@ jobs:
146137
except ImportError as e:
147138
print(f'❌ PDF dependency missing: {e}')
148139
sys.exit(1)
149-
140+
150141
if 'rag' in extras:
151142
try:
152143
import qdrant_client
@@ -155,23 +146,21 @@ jobs:
155146
except ImportError as e:
156147
print(f'❌ RAG dependency missing: {e}')
157148
sys.exit(1)
158-
149+
159150
if 'a2a' in extras:
160151
try:
161152
import fastapi
162153
print('✅ A2A dependencies (fastapi) available')
163154
except ImportError as e:
164155
print(f'❌ A2A dependency missing: {e}')
165156
sys.exit(1)
166-
157+
167158
print('✅ All expected dependencies are available')
168159
"
169160
170-
171-
172161
validate-build-args:
173162
runs-on: ubuntu-latest
174-
163+
175164
steps:
176165
- name: Checkout repository
177166
uses: actions/checkout@v6
@@ -182,21 +171,21 @@ jobs:
182171
- name: Test build without extras
183172
run: |
184173
docker build \
185-
--build-arg SCRIPT=ingest_pdf.py \
186-
--tag fai-script-base \
174+
--build-arg AGENT=ingest_pdf.py \
175+
--tag fai-agent-base \
187176
.
188177
189178
- name: Test build with multiple extras
190179
run: |
191180
docker build \
192181
--build-arg EXTRAS=pdf,rag \
193-
--build-arg SCRIPT=ingest_pdf.py \
194-
--tag fai-script-multi \
182+
--build-arg AGENT=ingest_pdf.py \
183+
--tag fai-agent-multi \
195184
.
196185
197186
- name: Validate multi-extras build
198187
run: |
199-
docker run --rm fai-script-multi \
188+
docker run --rm fai-agent-multi \
200189
python -c "
201190
import PIL, fitz, pytesseract # PDF deps
202191
import qdrant_client, dulwich # RAG deps
@@ -205,27 +194,27 @@ jobs:
205194
206195
validate-documentation:
207196
runs-on: ubuntu-latest
208-
197+
209198
steps:
210199
- name: Checkout repository
211200
uses: actions/checkout@v6
212201

213202
- name: Check documentation exists
214203
run: |
215-
test -f docs/docker_scripts_guide.md
216-
echo "✅ Docker scripts guide exists"
204+
test -f docs/docker_agents_guide.md
205+
echo "✅ Docker agents guide exists"
217206
218207
- name: Validate README updates
219208
run: |
220209
grep -q "parametric Dockerfile" README.md
221210
grep -q "EXTRAS" README.md
222-
grep -q "docker_scripts_guide.md" README.md
223-
echo "✅ README contains Docker scripts documentation"
211+
echo "✅ README contains Docker agents documentation"
224212
225-
- name: Check scripts directory structure
213+
- name: Check agents directory structure
226214
run: |
227-
test -d scripts
228-
test -f scripts/ingest_pdf.py
229-
test -d scripts/data
230-
test -f scripts/data/create_sample_invoice.py
231-
echo "✅ Scripts directory structure is correct"
215+
test -d agents
216+
test -f agents/ingest_pdf.py
217+
test -d agents/data
218+
test -f agents/data/create_sample_invoice.py
219+
220+
echo "✅ Agents directory structure is correct"

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ FROM python:3.12-slim-bookworm AS runtime
6262

6363
# Pass build args to runtime stage
6464
ARG EXTRAS
65-
ARG SCRIPT
65+
ARG AGENT
6666

6767
# Install runtime system dependencies
6868
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -73,7 +73,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
7373

7474
ENV PIP_NO_CACHE_DIR=1 \
7575
UV_PYTHON_DOWNLOADS=0 \
76-
SCRIPT_NAME="$SCRIPT" \
76+
AGENT_NAME="$AGENT" \
7777
PYTHONPATH="/app/scripts:/app:$PYTHONPATH"
7878

7979
# Create non-root user
@@ -90,8 +90,8 @@ ENV PATH="/app/.venv/bin:$PATH"
9090
# Switch to non-root user
9191
USER app
9292

93-
# Validate that the script exists
94-
RUN test -f "/app/scripts/$SCRIPT" || (echo "Error: Script /app/scripts/$SCRIPT not found" && exit 1)
93+
# Validate that the agent exists
94+
RUN test -f "/app/agents/$AGENT" || (echo "Error: Script /app/agents/$AGENT not found" && exit 1)
9595

96-
# Default command runs the specified script
97-
CMD ["sh", "-c", "python \"/app/scripts/$SCRIPT_NAME\""]
96+
# Default command runs the specified agent
97+
CMD ["sh", "-c", "python \"/app/agents/$AGENT_NAME\""]

0 commit comments

Comments
 (0)