Files
agent-framework/python/samples/getting_started/workflows/declarative
T
Evan Mattson 9c094573e8 Python: Add declarative workflow runtime (#2815)
* Further support for declarative python workflows

* Add tests. Clean up for typing and formatting

* Improvements and cleanup

* Typing cleanup. Improve docstrings

* Proper code in docstrings

* Fix malformed code-block directive in docstring

* Remove dead links

* PR feedback

* Address PR feedback

* Address PR feedback

* Remove sl

* Update devui frontend

* More cleanup

* Fix uv lock

* Skip Py 3.14 tests as powerfx doesn't support it

* Fix mypy error

* Fix for tool calls

* Removed stale docstring

* Fix lint

* Standardize on .NET namespaces. Revert DevUI changes (bring in later)

* Implement remaining items for Python declarative support to match dotnet
9c094573e8 ยท 2026-01-13 07:11:21 +00:00
History
..

Declarative Workflows

Declarative workflows allow you to define multi-agent orchestration patterns in YAML, including:

  • Variable manipulation and state management
  • Control flow (loops, conditionals, branching)
  • Agent invocations
  • Human-in-the-loop patterns

See the main workflows README for the list of available samples.

Prerequisites

pip install agent-framework-declarative

Running Samples

Each sample directory contains:

  • workflow.yaml - The declarative workflow definition
  • main.py - Python code to load and execute the workflow
  • README.md - Sample-specific documentation

To run a sample:

cd <sample_directory>
python main.py

Workflow Structure

A basic workflow YAML file looks like:

name: my-workflow
description: A simple workflow example

actions:
  - kind: SetValue
    path: turn.greeting
    value: Hello, World!
    
  - kind: SendActivity
    activity:
      text: =turn.greeting

Action Types

Variable Actions

  • SetValue - Set a variable in state
  • SetVariable - Set a variable (.NET style naming)
  • AppendValue - Append to a list
  • ResetVariable - Clear a variable

Control Flow

  • If - Conditional branching
  • Switch - Multi-way branching
  • Foreach - Iterate over collections
  • RepeatUntil - Loop until condition
  • GotoAction - Jump to labeled action

Output

  • SendActivity - Send text/attachments to user
  • EmitEvent - Emit custom events

Agent Invocation

  • InvokeAzureAgent - Call an Azure AI agent
  • InvokePromptAgent - Call a local prompt agent

Human-in-Loop

  • Question - Request user input
  • WaitForInput - Pause for external input