This runbook captures the full M1-M7 flow for the FastAPI compute module import path.
For the conceptual overview and screenshots of the import UX, see docs/foundry-auto-deploy.md.
Replace these with values from your Foundry enrollment:
FOUNDRY_URL=https://<your-stack>.palantirfoundry.comCOMPUTE_MODULE_RID=ri.foundry.main.deployed-app.<uuid>FOUNDRY_REPOSITORY=<artifact-repository-name>FOUNDRY_PROJECT_PATH=/<project>/<folder>/<repo>
- Use immutable tags only (no
latest) - Recommended tag format:
YYYYMMDD-HHMMSS-<gitsha7> - Image ref format:
${REGISTRY_HOST}/${FOUNDRY_REPOSITORY}/${IMAGE_NAME}:${IMAGE_TAG}
uv run python scripts/deploy/foundry_openapi.py --generate --spec-path openapi.foundry.json
uv run python scripts/deploy/foundry_openapi.py --spec-path openapi.foundry.jsonResulting contract contains only:
POST /classify/ae-pc(operationId=classifyAePc)POST /classify/ae-category(operationId=classifyAeCategory)POST /classify/pc-category(operationId=classifyPcCategory)servers = [{"url":"http://localhost:5000"}]
export REGISTRY_HOST="<from Foundry Container tab>"
export IMAGE_NAME="dspy-reference-examples"
export IMAGE_TAG="$(date -u +%Y%m%d-%H%M%S)-$(git rev-parse --short HEAD)"
export IMAGE_REF="${REGISTRY_HOST}/${FOUNDRY_REPOSITORY}/${IMAGE_NAME}:${IMAGE_TAG}"export OPENAPI_JSON="$(uv run python -c 'import json; print(json.dumps(json.load(open("openapi.foundry.json")), separators=(",", ":")))')"
docker buildx build \
--platform linux/amd64 \
--build-arg SERVER_OPENAPI="${OPENAPI_JSON}" \
--tag "${IMAGE_REF}" \
--load \
.uv run python scripts/deploy/foundry_openapi.py \
--spec-path openapi.foundry.json \
--image-ref "${IMAGE_REF}"Optional local runtime smoke test (non-production):
docker run --rm -d --name dspy-foundry-check -e DSPY_PROVIDER=local -e PORT=5000 -p 15000:5000 "${IMAGE_REF}"
sleep 4
curl -sSf http://127.0.0.1:15000/health
docker rm -f dspy-foundry-checkexport FOUNDRY_REGISTRY_USER="<from Foundry Container tab>"
export FOUNDRY_REGISTRY_TOKEN="<short-lived token from Foundry Container tab>"
echo "${FOUNDRY_REGISTRY_TOKEN}" | docker login "${REGISTRY_HOST}" --username "${FOUNDRY_REGISTRY_USER}" --password-stdin
docker push "${IMAGE_REF}"Then complete UI-only steps in Foundry:
- Open compute module
${COMPUTE_MODULE_RID}. - Link container image
${IMAGE_REF}from repository${FOUNDRY_REPOSITORY}. - Run
Detect from OpenAPI specification. - Confirm the three imported functions map to the three classify routes.
- Save and publish.
- H1: Provide
REGISTRY_HOST,FOUNDRY_REGISTRY_USER, and short-lived token. - H2: Execute image-link and OpenAPI detect/import UI actions.
- H3: Configure egress to
openrouter.ai:443and secret mapping forOPENROUTER_API_KEY. - H4: Run final smoke tests from Foundry function endpoints.