Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
langgraph==1.0.2

azure-ai-agentserver-langgraph==1.0.0b3
azure-ai-agentserver-langgraph==1.0.0b4

pytest==8.4.2
azure-identity==1.25.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
azure-ai-agentserver-agentframework==1.0.0b3
azure-ai-agentserver-agentframework==1.0.0b4
agent-framework
azure-ai-projects==1.1.0b4

pytest==8.4.2
azure-identity==1.25.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"mcpServers": {
"deepwiki": {
"type": "http",
"url": "https://mcp.deepwiki.com/mcp"
},
"context7": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
},
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
},
"sequential-thinking-tools": {
"command": "npx",
"args": ["-y", "mcp-sequentialthinking-tools"],
"env": {
"MAX_HISTORY_SIZE": "1000"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Builder stage - use slim Python image
FROM python:3.12-slim-bookworm AS builder

# Set working directory
WORKDIR /app

# Install uv manually (following official installation)
ARG UV_VERSION=0.5.11
ENV UV_VERSION=${UV_VERSION}
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
&& curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | sh \
&& rm -rf /var/lib/apt/lists/*

# Add uv to PATH
ENV PATH="/root/.local/bin:$PATH"

# Enable bytecode compilation for faster startup
ENV UV_COMPILE_BYTECODE=1

# Copy uv cache to a predictable location for caching
ENV UV_LINK_MODE=copy

# Install dependencies first (separate layer for better caching)
# Copy only dependency files first for better layer caching
COPY uv.lock pyproject.toml README.md ./
RUN uv sync --frozen --no-install-project --no-dev

# Copy the project source code
COPY . /app

# Sync the project itself (now including the source code)
RUN uv sync --frozen --no-dev

# Temporarily install to resolve confliction
RUN uv pip install --force-reinstall /app/azure_ai_agentserver_agentframework-1.0.0b5-py3-none-any.whl
RUN uv pip install azure-ai-projects==2.0.0b1 agent-framework-core==1.0.0b251111 agent-framework-azure-ai==1.0.0b251111

# Final runtime stage - use slim Python image
FROM python:3.12-slim-bookworm

# Set working directory
WORKDIR /app

# Install Node.js (required for MCP tools) and uv
ENV UV_VERSION=0.5.11
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | sh \
&& rm -rf /var/lib/apt/lists/*

# Add uv to PATH
ENV PATH="/root/.local/bin:$PATH"

# Copy the virtual environment from the builder
COPY --from=builder /app/.venv /app/.venv

# Copy the application code
COPY --from=builder /app /app

# Add virtual environment to PATH
ENV PATH="/app/.venv/bin:$PATH"

# Set environment variables
ENV PYTHONUNBUFFERED=1

EXPOSE 8088

# Run the application using uv run (just like locally)
CMD ["uv", "run", "app"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: EventPlanningAgent
description: A multi-agent event planning workflow built with Microsoft Agent Framework - combining Semantic Kernel's enterprise orchestration with AutoGen's multi-agent patterns.
metadata:
example:
- role: user
content: |-
Plan a corporate holiday party for 50 people on December 6th, 2025 in Seattle
with a budget of $5,000. Include venue options, catering for dietary restrictions,
and check the weather forecast.
tags:
- AI Agent Hosting
- Azure AI AgentServer
- Microsoft Agent Framework
authors:
- JC-386
template:
name: EventPlanningAgent
kind: hosted
environment_variables:
- name: AZURE_AI_PROJECT_ENDPOINT
value: ${AZURE_AI_PROJECT_ENDPOINT}
- name: AI_FOUNDRY_PROJECT_RESOURCE_ID
value: ${AI_FOUNDRY_PROJECT_RESOURCE_ID}
- name: BING_CONNECTION_ID
# TODO: Change back to BING_CONNECTION_NAME once Foundry bug is fixed (currently requires full resource ID)
# /subscriptions/YOUR_SUB/resourceGroups/YOUR_RG/providers/Microsoft.CognitiveServices/accounts/YOUR_ACCOUNT/projects/YOUR_PROJECT/connections/YOUR_CONNECTION
value: ${BING_CONNECTION_ID}
- name: AZURE_AI_MODEL_DEPLOYMENT_NAME
value: gpt-4o-mini
- name: WEB_SEARCH_MODEL
value: gpt-4o-mini
- name: AZURE_OPENAI_API_VERSION
value: 2024-05-01-preview
resources:
- kind: model
id: gpt-4o-mini
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
[project]
name = "spec-to-agents"
version = "0.0.1"
description = "Backend for Spec-to-Agent sample demonstrating Microsoft Agent Framework"
authors = [{ name = "Microsoft", email = "opensource@microsoft.com" }]
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"agent-framework-core==1.0.0b251111",
"agent-framework-azure-ai==1.0.0b251111",
"agent-framework-a2a==1.0.0b251111",
"agent-framework-devui==1.0.0b251111",
"azure-identity>=1.25.0",
"python-dotenv>=1.1.1",
"httpx>=0.27.0",
"aiohttp>=3.9.0",
"icalendar>=5.0.11",
"pytz>=2024.1",
"rich>=13.7.0",
# OpenTelemetry packages for observability
"opentelemetry-api",
"opentelemetry-sdk",
"azure-monitor-opentelemetry",
"azure-monitor-opentelemetry-exporter>=1.0.0b41",
"opentelemetry-exporter-otlp-proto-grpc",
"opentelemetry-semantic-conventions-ai",
"dependency-injector>=4.48.2",
]

[project.scripts]
app = "main:main"

[project.optional-dependencies]
dev = [
# Development and testing
"pytest",
"ruff",
"pre-commit",
]

[tool.uv]
prerelease = "allow"

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
asyncio_mode = "auto"

[dependency-groups]
dev = [
"mypy>=1.18.2",
"pyright>=1.1.406",
"pytest-asyncio>=1.2.0",
"pytest-cov>=6.0.0",
"types-pytz>=2025.2.0.20250809",
"pip-audit>=2.6.0",
"ruff>=0.14.0",
"pre-commit>=4.0.0",
]

# [tool.uv.sources]
# "agent-framework-core" = { git = "https://github.com/microsoft/agent-framework.git", branch = "main", subdirectory = "python/packages/core" }
# "agent-framework-azure-ai" = { git = "https://github.com/microsoft/agent-framework.git", branch = "main", subdirectory = "python/packages/azure-ai" }
# "agent-framework-a2a" = { git = "https://github.com/microsoft/agent-framework.git", branch = "main", subdirectory = "python/packages/a2a" }
# "agent-framework-copilotstudio" = { git = "https://github.com/microsoft/agent-framework.git", branch = "main", subdirectory = "python/packages/copilotstudio" }
# "agent-framework-mem0" = { git = "https://github.com/microsoft/agent-framework.git", branch = "main", subdirectory = "python/packages/mem0" }
# "agent-framework-redis" = { git = "https://github.com/microsoft/agent-framework.git", branch = "main", subdirectory = "python/packages/redis" }
# "agent-framework-devui" = { git = "https://github.com/microsoft/agent-framework.git", branch = "main", subdirectory = "python/packages/devui" }

# Use this to get Victor's latest changes
# [tool.uv.sources]
# "agent-framework-core" = { git = "https://github.com/victordibia/agent-framework.git", branch = "devui_oai_responses", subdirectory = "python/packages/core" }
# "agent-framework-azure-ai" = { git = "https://github.com/victordibia/agent-framework.git", branch = "devui_oai_responses", subdirectory = "python/packages/azure-ai" }
# "agent-framework-a2a" = { git = "https://github.com/victordibia/agent-framework.git", branch = "devui_oai_responses", subdirectory = "python/packages/a2a" }
# "agent-framework-copilotstudio" = { git = "https://github.com/victordibia/agent-framework.git", branch = "devui_oai_responses", subdirectory = "python/packages/copilotstudio" }
# "agent-framework-mem0" = { git = "https://github.com/victordibia/agent-framework.git", branch = "devui_oai_responses", subdirectory = "python/packages/mem0" }
# "agent-framework-redis" = { git = "https://github.com/victordibia/agent-framework.git", branch = "devui_oai_responses", subdirectory = "python/packages/redis" }
# "agent-framework-devui" = { git = "https://github.com/victordibia/agent-framework.git", branch = "devui_oai_responses", subdirectory = "python/packages/devui" }

# [tool.uv.sources]
# "agent-framework-core" = { path = "third_party/agent-framework/python/packages/core", editable = true }
# "agent-framework-azure-ai" = { path = "third_party/agent-framework/python/packages/azure-ai", editable = true }
# "agent-framework-a2a" = { path = "third_party/agent-framework/python/packages/a2a", editable = true }
# "agent-framework-copilotstudio" = { path = "third_party/agent-framework/python/packages/copilotstudio", editable = true }
# "agent-framework-mem0" = { path = "third_party/agent-framework/python/packages/mem0", editable = true }
# "agent-framework-redis" = { path = "third_party/agent-framework/python/packages/redis", editable = true }
# "agent-framework-devui" = { path = "third_party/agent-framework/python/packages/devui", editable = true }

[tool.ruff]
line-length = 120
target-version = "py310"
fix = true
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
exclude = ["docs/*"]
preview = true

[tool.ruff.lint]
fixable = ["ALL"]
unfixable = []
select = [
"ASYNC", # async checks
"B", # bugbear checks
"CPY", # copyright
"D", # pydocstyle checks
"E", # pycodestyle error checks
"ERA", # remove connected out code
"F", # pyflakes checks
"FIX", # fixme checks
"I", # isort
"INP", # implicit namespace package
"ISC", # implicit string concat
"Q", # flake8-quotes checks
"RET", # flake8-return check
"RSE", # raise exception parantheses check
"RUF", # RUF specific rules
"SIM", # flake8-simplify check
"T20", # typing checks
"TD", # todos
"W", # pycodestyle warning checks
"T100", # Debugger,
"S", # Bandit checks
]
ignore = [
"D100", # allow missing docstring in public module
"D104", # allow missing docstring in public package
"D418", # allow overload to have a docstring
"TD003", # allow missing link to todo issue
"FIX002", # allow todo
"B027", # allow empty non-abstract method in ABC
]

[tool.ruff.lint.per-file-ignores]
# Ignore all directories named `tests` and `samples`.
"**/tests/**" = ["D", "INP", "TD", "ERA001", "RUF", "S"]
"samples/**" = ["D", "INP", "ERA001", "RUF", "S", "T201"]
"*.ipynb" = ["CPY", "E501"]
"**/console.py" = [
"T201",
"ASYNC250",
"D401",
] # Allow print and blocking input in CLI


[tool.ruff.lint.flake8-copyright]
notice-rgx = "^# Copyright \\(c\\) Microsoft\\. All rights reserved\\."
min-file-size = 1

[tool.pyright]
include = ["app"]
exclude = ["**/tests/**", "docs", "**/.venv/**"]
typeCheckingMode = "strict"
reportUnnecessaryIsInstance = false
reportMissingTypeStubs = false

[tool.mypy]
plugins = ['pydantic.mypy']
strict = true
python_version = "3.10"
ignore_missing_imports = true
disallow_untyped_defs = true
no_implicit_optional = true
check_untyped_defs = true
warn_return_any = true
show_error_codes = true
warn_unused_ignores = false
disallow_incomplete_defs = true
disallow_untyped_decorators = true

[tool.coverage.run]
source = ["src/spec_to_agents"]
omit = ["tests/*", "*/__pycache__/*", "*/migrations/*", "venv/*", ".venv/*"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
show_missing = true
precision = 2

[tool.coverage.html]
directory = "htmlcov"

[build-system]
requires = ["uv_build>=0.9.5,<0.10.0"]
build-backend = "uv_build"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from azure.ai.agentserver.agentframework import from_agent_framework
from dotenv import load_dotenv


def main() -> None:
from spec_to_agents.container import AppContainer
from spec_to_agents.workflow.core import build_event_planning_workflow

load_dotenv()

container = AppContainer()
container.wire(modules=[__name__])

from_agent_framework(lambda _: build_event_planning_workflow().as_agent("event_planning_agent")).run()


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) Microsoft. All rights reserved.

from importlib.metadata import version

__version__ = version("spec_to_agents")
Loading
Loading