microsoft / microsoft/agent-framework

.NET: DevUI limitation should be documented and addressed if possible

Open
#2,084 16 comments 8 reactions 2 assignees View on GitHub

Nobody has claimed this yet.

.NET devui documentation question
Dominant language
Python
Stars
13.6k
Forks
2.3k
Avg merge
2d 45m
Merged PRs (30d)
358

Description

## Limitation Details

- Only workflows and agents that are dependency injected can be visualized in the DevUI.
- ~~Workflows must be registered using the agents using `AddAsAIAgent` to be visualized and funcational.~~
- Non agentic workflows must take ChatMessage as input in order to run the workflow in the DevUI.
- Conversations API failes if agents in not dependency injected but the parent workflow is.
- Non agentic workflow should be named using the `WithName` (provide `name` param for agentic workflow), which must match the workflow name in the dependency injection registration.
- Chat History/Agent Thread is not maintaince
- By default, only AgentsAsExecutor can be executed in the DevUI; otherwise, every executor should be inherited from `ChatProtocolExecutor` or needs to support getting both `List` and `TurnToken` as input. See the sample below:

```csharp
// Disclaimer: This might not be the intended way to implement an executor, but is a workaround to make it work in DevUI.
internal sealed class UppercaseExecutor() : Executor("UppercaseExecutor")
{
private List _messages = [];

protected override Microsoft.Agents.AI.Workflows.RouteBuilder ConfigureRoutes(Microsoft.Agents.AI.Workflows.RouteBuilder routeBuilder)
{
return routeBuilder
.AddHandler>(this.RouteMessages)
.AddHandler(this.RouteTurnTokenAsync); // here `string` is the input type of the next executor (output of this)
// Add your orginal input type as a new handler here
}

private ValueTask RouteMessages(List messages, IWorkflowContext context, CancellationToken cancellationToken)
{
this._messages = messages;
return ValueTask.CompletedTask;
}

private ValueTask RouteTurnTokenAsync(TurnToken token, IWorkflowContext context, CancellationToken cancellationToken)
{
// Not sure why DevUI wraps the actual input this way...
return ValueTask.FromResult(JsonDocument.Parse(this._messages.Last().Text).RootElement.GetProperty("input").GetString()!.ToUpperInvariant());
}
}
```
- Details about inner agents (Agents inside Executor) itself like Tools calls will not be shown

## Expectation

- For errors/exceptions, DevUI should show a toast message or some indication of what went wrong instead of just failing silently.
- DevUI should support non agentic workflows and executors more seamlessly without the need for workarounds.
- Simplify the process of registering and visualizing workflows in DevUI, such as not requiring the use of `WithName` to match the DI registration name or ~~calling `AddAsAIAgent`.~~
- Provide alternative ways to register workflows and agents that can be visualized in DevUI without strict dependency injection requirements.
- Improved documentation on how to set up workflows and agents with all the requirements and limitations for DevUI visualization.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.