Files
wehub-resource-sync e768098d0e
Flake8 Lint / flake8 (push) Waiting to run
Spell check CI / Spell_Check (push) Waiting to run
tools_continuous_delivery / Private PyPI non-main branch release (push) Has been skipped
tools_continuous_delivery / Private PyPI main branch release (push) Failing after 2m42s
Publish Promptflow Doc / Build (push) Has been cancelled
Publish Promptflow Doc / Deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:39:52 +08:00

1.5 KiB

Basic Chat — Microsoft Agent Framework

This is the Microsoft Agent Framework (MAF) version of the chat-basic Prompt Flow example.

It implements the same behaviour: a helpful assistant chatbot that remembers conversation history and responds to user questions.

Architecture

[InputExecutor] ──→ [ChatExecutor]
  (question +          (Agent with
   chat_history)        FoundryChatClient)
Prompt Flow concept MAF equivalent
flow.dag.yaml WorkflowBuilder in chat_flow.py
chat.jinja2 (system prompt) Agent(instructions="You are a helpful assistant.")
LLM node (api: chat) FoundryChatClient + Agent.run()
chat_history input Message list assembled in InputExecutor
open_ai_connection Environment variables (FOUNDRY_PROJECT_ENDPOINT, FOUNDRY_MODEL) + DefaultAzureCredential

Prerequisites

  • Python 3.10+
  • An Azure subscription with a Microsoft Foundry project (or Azure OpenAI resource)
  • az login completed

Setup

pip install -r requirements.txt

cp .env.example .env
# Edit .env with your Foundry project endpoint and model deployment name

Run

python chat_flow.py

This runs two test interactions:

  1. A single-turn question with no history
  2. A follow-up question with one prior turn of chat history