Azure / Azure/azure-sdk-for-python
Feature Request: Dynamic Workflow Variable Initialization
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 3.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 193
Description
**Summary**
Enable dynamic initialization of workflow variables from API requests to support parameterized workflow execution.
**Problem Statement**
Currently, workflows can only initialize variables with static values using SetVariable actions in the OnConversationStart trigger. For example:
```yaml
- kind: SetVariable
id: set_customer_id
variable: Local.CustomerId
value: "cust-1" # Hard-coded value
```
This creates challenges for:
- Testing: Cannot parameterize test scenarios with different customer/account IDs
- Reusability: Same workflow cannot be used with different input parameters
- Evaluation: Cannot run automated test suites with varied inputs
**Current Workarounds Attempted**
Metadata in ChatMessage: Tried passing variables in [message.metadata] but they're not accessible in workflow expressions
System.Variables: Attempted =System.Variables.CustomerId, but no mechanism exists to populate this from API requests
extra_body parameters: Explored various [extra_body] configurations but no documented approach works
Option 1: Structured Inputs (Preferred)
Allow passing workflow variables via structured_inputs in the API request:
```python
response = await openai_client.responses.create(
conversation=conversation_id,
input="User message",
extra_body={
"agent": {"name": "workflow-name", "type": "agent_reference"},
"structured_inputs": {
"CustomerId": "cust-3",
"AccountId": "acct-125"
}
}
)
```
Workflow could access these as:
```yaml
- kind: SetVariable
variable: Local.CustomerId
value: =System.StructuredInputs.CustomerId
```
Or automatically make them available without SetVariable:
```yaml
- kind: InvokeAzureAgent
input:
arguments:
CustomerId: =Input.CustomerId
```
**Priority**
High - This is a fundamental requirement for production workflows and automated testing scenarios.
Contributor guide
Assessment
This issue has not been assessed yet.