mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
bb3d3c2efc
* Add workflow support for Azure Functions * fix compatability with latest framework changes and add integration tests * refactor code * remove white space Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * align help text with actual port used Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * replace instance id with a place holder Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * remove unused import Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * remove redundant typing import and fix SIM115 * fix latest breaking changes * fix mypy issues * clean up imports * define source marker strings as constants * fix json module name * refactor _extract_message_content_from_dict * refactor serialization * add helper method for error response construction and remove _extract_message_content_from_dict since it is not needed * use strict tpe checking for edges * change how duplicate agent registrations are handled * cancel approval_task on HITL timeout * update docstring * fix: align azurefunctions package with core API changes after rebase - State.import_state/export_state are now sync (removed await) - Add State.commit() before export_state() in activity execution - Rename executor parameter shared_state -> state - Rename ctx.set_shared_state/get_shared_state -> set_state/get_state (sync) - WorkflowBuilder now takes start_executor as constructor kwarg - Update WorkflowOutputEvent -> WorkflowEvent with type='output' - Update RequestInfoEvent -> WorkflowEvent[Any] - Update SharedState -> State in test imports - Update duplicate agent name tests to match new warning behavior - Update sample README API references * fix sample check errors * fix mypy issues * fix trailing white spaces * fix test imports * feat: add durable workflow samples and adapt to main branch changes - Add workflow samples 09-12 to 04-hosting/azure_functions/ - Adapt to ChatMessage -> Message rename from main - Adapt to pickle-based checkpoint encoding from main - Simplify _serialization.py to delegate to core encode/decode - Fix Message -> WorkflowMessage disambiguation in _context.py - Remove non-existent _checkpoint_summary import * fix: update create_checkpoint signature to match superclass * fix: correct relative link in HITL sample README * fix: resolve import breakage after rebase (State, DurableAgentThread, get_logger) --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
bb3d3c2efc
ยท
2026-02-17 22:11:33 +00:00
History
Sample Integration Tests
Integration tests that validate the Durable Agent Framework samples by running them as Azure Functions.
Setup
1. Create .env file
Copy .env.example to .env and fill in your Azure credentials:
cp .env.example .env
Required variables:
AZURE_OPENAI_ENDPOINTAZURE_OPENAI_CHAT_DEPLOYMENT_NAMEAZURE_OPENAI_API_KEYAzureWebJobsStorageDURABLE_TASK_SCHEDULER_CONNECTION_STRINGFUNCTIONS_WORKER_RUNTIME
2. Start required services
Azurite (for orchestration tests):
docker run -d -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite
Durable Task Scheduler:
docker run -d -p 8080:8080 -p 8082:8082 -e DTS_USE_DYNAMIC_TASK_HUBS=true mcr.microsoft.com/dts/dts-emulator:latest
Running Tests
The tests automatically start and stop the Azure Functions app for each sample.
Run all sample tests
uv run pytest packages/azurefunctions/tests/integration_tests -v
Run specific sample
uv run pytest packages/azurefunctions/tests/integration_tests/test_01_single_agent.py -v
Run with verbose output
uv run pytest packages/azurefunctions/tests/integration_tests -sv
How It Works
Each test file uses pytest markers to automatically configure and start the function app:
pytestmark = [
pytest.mark.sample("01_single_agent"),
pytest.mark.usefixtures("function_app_for_test"),
skip_if_azure_functions_integration_tests_disabled,
]
The function_app_for_test fixture:
- Loads environment variables from
.env - Validates required variables are present
- Starts the function app on a dynamically allocated port
- Waits for the app to be ready
- Runs your tests
- Tears down the function app
Troubleshooting
Missing environment variables:
Ensure your .env file contains all required variables from .env.example.
Tests timeout: Check that Azure OpenAI credentials are valid and the service is accessible.