Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
13 changes: 13 additions & 0 deletions temporal-maf-agents-poc/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.git
.venv
venv
__pycache__
*.pyc
.pytest_cache
.env
dist
build
*.egg-info
k8s
docs
tests
40 changes: 40 additions & 0 deletions temporal-maf-agents-poc/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ---------------------------------------------------------------------------
# Temporal connection (used by workers + starter)
# ---------------------------------------------------------------------------
TEMPORAL_ADDRESS=localhost:7233
TEMPORAL_NAMESPACE=agent-platform

# ---------------------------------------------------------------------------
# Agent runtime mode
# mock -> Phase 1: deterministic mocked Agent Framework responses (default)
# live -> Phase 2: real Microsoft Agent Framework agents (TODO stubs)
# ---------------------------------------------------------------------------
AGENT_MODE=mock

# ---------------------------------------------------------------------------
# Approval gate behaviour (ApprovalAgentWorkflow)
# TEMPORAL_APPROVAL_AUTO=true -> auto-approve after the timeout (POC default)
# TEMPORAL_APPROVAL_AUTO=false -> block until a `submit_decision` signal
# ---------------------------------------------------------------------------
TEMPORAL_APPROVAL_AUTO=true
TEMPORAL_APPROVAL_TIMEOUT_SECONDS=30

# Health endpoint port for k8s probes.
HEALTH_PORT=8080

# Demo: force the planner activity to fail once so Temporal's retry policy
# visibly re-runs it (set to 1 to enable).
# FORCE_TRANSIENT_ERROR=1

# ---------------------------------------------------------------------------
# Phase 2 — live integrations (consumed inside activities only)
# Set AGENT_MODE=live above to enable.
# ---------------------------------------------------------------------------
AZURE_OPENAI_ENDPOINT=https://<your-resource>.openai.azure.com
AZURE_OPENAI_CHAT_DEPLOYMENT=gpt-4o
AZURE_OPENAI_API_VERSION=2024-10-21
# Leave AZURE_OPENAI_API_KEY unset to use DefaultAzureCredential (az login / workload identity)
# AZURE_OPENAI_API_KEY=
GITHUB_TOKEN=
# Required in live mode (fail-closed): the owner the GitHub agent may write to
GITHUB_ALLOWED_OWNER=
10 changes: 10 additions & 0 deletions temporal-maf-agents-poc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
__pycache__/
*.py[cod]
.venv/
venv/
.env
*.egg-info/
.pytest_cache/
dist/
build/
.DS_Store
37 changes: 37 additions & 0 deletions temporal-maf-agents-poc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Single image, shared by all five worker deployments. Each Kubernetes
# Deployment / docker-compose service selects which worker to run by setting
# the WORKER_MODULE env var (e.g. orchestrator_worker.worker).
FROM python:3.12-slim AS base

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONPATH=/app/src \
HEALTH_PORT=8080 \
AGENT_MODE=mock

WORKDIR /app

# Install deps first for layer caching.
ARG INSTALL_LIVE=false
COPY requirements.txt requirements-live.txt ./
RUN if [ "$INSTALL_LIVE" = "true" ]; then \
pip install --no-cache-dir -r requirements-live.txt; \
else \
pip install --no-cache-dir -r requirements.txt; \
fi

# App source.
COPY src ./src
COPY sample-input.json ./sample-input.json

# Run as non-root.
RUN useradd --create-home --uid 10001 appuser \
&& chown -R appuser:appuser /app
USER appuser

EXPOSE 8080

# WORKER_MODULE is required at runtime; default to the orchestrator so the
# image is runnable as-is. Override per deployment.
ENV WORKER_MODULE=orchestrator_worker.worker
ENTRYPOINT ["sh", "-c", "exec python -m \"$WORKER_MODULE\""]
44 changes: 44 additions & 0 deletions temporal-maf-agents-poc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Convenience targets for the Temporal + MAF POC.
# Local-without-docker workflow uses a venv; docker workflow uses compose.

IMAGE ?= temporal-maf-agents-poc:dev
export PYTHONPATH := src

.PHONY: help install up down logs run test build workers \
worker-orchestrator worker-planner worker-github worker-aks worker-approval

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-22s\033[0m %s\n", $$1, $$2}'

install: ## Install Python deps into the active environment
pip install -r requirements.txt -e .

up: ## Start Temporal + all 5 workers via docker-compose
docker compose up --build

down: ## Stop the docker-compose stack and remove volumes
docker compose down -v

logs: ## Tail worker logs
docker compose logs -f orchestrator-worker planner-agent-worker github-agent-worker aks-agent-worker approval-agent-worker

run: ## Start one orchestration from sample-input.json
python -m starter

test: ## Run the unit tests (no Temporal server needed)
pytest -q

build: ## Build the shared worker image
docker build -t $(IMAGE) .

# --- Run individual workers locally (needs a reachable Temporal at $TEMPORAL_ADDRESS) ---
worker-orchestrator: ## Run the orchestrator worker locally
python -m orchestrator_worker.worker
worker-planner: ## Run the planner agent worker locally
python -m planner_agent_worker.worker
worker-github: ## Run the github agent worker locally
python -m github_agent_worker.worker
worker-aks: ## Run the aks agent worker locally
python -m aks_agent_worker.worker
worker-approval: ## Run the approval agent worker locally
python -m approval_agent_worker.worker
Loading