-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
When using the DevUI with a ConcurrentBuilder() workflow I get an error serializing ChatMessage. When this happens the UI goes blank.
[2025-10-17 10:26:04 - /mitted/agent-framework-learning/.venv/lib/python3.13/site-packages/agent_framework_devui/_server.py:544 - ERROR] Error in streaming execution: Unable to serialize unknown type: <class 'agent_framework._types.ChatMessage'>
Versions:
agent-framework 1.0.0b251016
agent-framework-a2a 1.0.0b251016
agent-framework-azure-ai 1.0.0b251016
agent-framework-copilotstudio 1.0.0b251016
agent-framework-core 1.0.0b251016
agent-framework-devui 1.0.0b251016
agent-framework-mem0 1.0.0b251016
agent-framework-purview 1.0.0b251016
agent-framework-redis 1.0.0b251016
And here is an example I based on the Agent Workflow - Content Review with Quality Routing sample: https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/devui/workflow_agents/workflow.py
# Copyright (c) Microsoft. All rights reserved.
"""Agent Workflow - Content Review with Quality Routing.
This sample demonstrates:
- Using agents directly as executors
- Conditional routing based on structured outputs
- Quality-based workflow paths with convergence
Use case: Content creation with automated review.
Writer creates content, Reviewer evaluates quality:
- High quality (score >= 80): → Publisher → Summarizer
- Low quality (score < 80): → Editor → Publisher → Summarizer
Both paths converge at Summarizer for final report.
"""
from agent_framework import ConcurrentBuilder
from agent_framework.azure import AzureOpenAIChatClient
from azure.identity import DefaultAzureCredential
from dotenv import load_dotenv
load_dotenv("../.env")
# Create Azure OpenAI chat client
CREDENTIAL = DefaultAzureCredential()
chat_client = AzureOpenAIChatClient(credential=CREDENTIAL)
# Create Writer agent - generates content
writer = chat_client.create_agent(
name="Writer",
instructions=(
"You are an excellent content writer. "
"Create clear, engaging content based on the user's request. "
"Focus on clarity, accuracy, and proper structure."
),
)
tagline_writer = chat_client.create_agent(
name="Tagline Writer",
instructions=(
"You are a creative tagline writer. "
"Generate catchy and memorable taglines that encapsulate the essence of the content provided."
),
)
workflow = (
ConcurrentBuilder().participants([writer, tagline_writer]).build()
)
def main():
"""Launch the branching workflow in DevUI."""
import logging
from agent_framework.devui import serve
logging.basicConfig(level=logging.INFO, format="%(message)s")
logger = logging.getLogger(__name__)
logger.info("Starting Agent Workflow (Content Review with Quality Routing)")
logger.info("Available at: http://localhost:8093")
logger.info("\nThis workflow demonstrates:")
logger.info("- Conditional routing based on structured outputs")
logger.info("- Path 1 (score >= 80): Reviewer → Publisher → Summarizer")
logger.info("- Path 2 (score < 80): Reviewer → Editor → Publisher → Summarizer")
logger.info("- Both paths converge at Summarizer for final report")
serve(entities=[workflow], port=8093, auto_open=True)
if __name__ == "__main__":
main()