DevUI for Microsoft Agent Framework

1.0.0b260409 · active · verified Wed Apr 15

agent-framework-devui is a lightweight, standalone sample application providing a debug UI for the Microsoft Agent Framework. It offers an OpenAI-compatible API server for running and testing AI agents and workflows, supporting directory-based discovery, in-memory entity registration, and a gallery of sample entities. It also includes an OpenAI Proxy feature, enabling direct testing of OpenAI models via the interface while keeping API keys secure on the server. Primarily designed as an 'inner-loop' developer tool, it visualizes agent execution, including reasoning, actions, and observations.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to define a simple agent with a tool and then launch the DevUI to interact with it. The `serve` function starts the web UI and API server, making the agent accessible for testing and debugging in a browser. Ensure `OPENAI_API_KEY` is set as an environment variable if you intend for the agent to use an actual OpenAI client.

import os
from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from agent_framework.devui import serve

# NOTE: Set OPENAI_API_KEY environment variable for actual API calls
# Example for a simple tool
def get_weather(location: str) -> str:
    """Get weather for a location."""
    return f"Weather in {location}: 72°F and sunny"

# Create your agent
agent = Agent(
    name="WeatherAgent",
    client=OpenAIChatClient(api_key=os.environ.get('OPENAI_API_KEY', '')) if os.environ.get('OPENAI_API_KEY') else None, # Pass API key if available
    tools=[get_weather]
)

# Launch debug UI - this opens a browser to http://localhost:8080
print("Launching DevUI... access at http://localhost:8080")
serve(entities=[agent], auto_open=True)

view raw JSON →