Skip to content

Agent directed workflows samples#271

Open
greenie-msft wants to merge 4 commits intomainfrom
agent-directed-workflows
Open

Agent directed workflows samples#271
greenie-msft wants to merge 4 commits intomainfrom
agent-directed-workflows

Conversation

@greenie-msft
Copy link
Copy Markdown
Collaborator

This pull request introduces a new sample for an agent-powered chat workflow using Durable Entities and Redis streaming in .NET. It sets up a durable, stateful chat agent that interacts with users via HTTP endpoints, leverages Azure OpenAI (or a mock echo client), and streams responses in real-time to clients using Redis pub/sub and Server-Sent Events (SSE). The main changes are the addition of the core agent entity, HTTP endpoints, supporting models, dependency injection setup, and project configuration.

Agent and HTTP Endpoint Implementation:

  • Added ChatAgentEntity, a durable entity that manages a chat session, interacts with an LLM, executes tool calls, and streams response chunks to Redis. This enables real-time, stateful chat workflows.
  • Implemented ChatEndpoints class with HTTP endpoints for sending messages (with SSE streaming or JSON fallback), retrieving chat history, and resetting sessions.

Models and State Management:

  • Introduced supporting models: ChatMsg, ChatRequest, ChatAgentState, and ChatTool to represent messages, requests, agent state, and tools.

Dependency Injection and Service Setup:

  • Registered dependencies in Program.cs, including Azure OpenAI-backed IChatClient (with fallback to a local echo client) and Redis connection. Provided a simple EchoChatClient for local development.

Project Configuration:

  • Added new project file AgentDirectedWorkflows.csproj targeting .NET 10, referencing Azure Functions, Durable Task, Redis, Azure OpenAI, and related packages. Included build steps for native assets and configuration for local development.

greenie-msft and others added 4 commits April 20, 2026 11:53
…Functions (.NET)

Demonstrates the entity-based agent loop pattern using durable entities with
Redis pub/sub for real-time streaming. Both samples include:

- ChatAgentEntity: durable entity holding conversation history
- Agent loop with tool calling (get_weather)
- SSE streaming and non-streaming (?stream=false) modes
- Conversation history and reset endpoints
- Echo fallback client when Azure OpenAI is not configured

Durable Task SDK version: ASP.NET minimal API with direct DTS connection
Durable Functions version: Azure Functions isolated worker with DTS backend

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ctions

- Durable Task SDK sample: FastAPI app with durable entity-based chat agent,
  SSE streaming via Redis pub/sub, echo fallback when no Azure OpenAI configured
- Durable Functions sample: Azure Functions v2 (Python) with DFApp, entity-based
  chat agent, async Redis pub/sub collection via asyncio.to_thread()
- Both samples tested end-to-end with DTS emulator and Redis

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant