Merk
Tilgang til denne siden krever autorisasjon. Du kan prøve å logge på eller endre kataloger.
Tilgang til denne siden krever autorisasjon. Du kan prøve å endre kataloger.
DevUI is designed as a sample application for local development. This page covers security considerations and best practices if you need to expose DevUI beyond localhost.
Warning
DevUI is not intended for production use. For production deployments, build your own custom interface using the Agent Framework SDK with appropriate security measures.
Coming Soon
DevUI documentation for C# is coming soon. Please check back later or refer to the Python documentation for conceptual guidance.
UI Modes
DevUI offers two modes that control access to features:
Developer Mode (Default)
Full access to all features:
- Debug panel with trace information
- Hot reload for rapid development (
/v1/entities/{id}/reload) - Deployment tools (
/v1/deployments) - Verbose error messages for debugging
devui ./agents # Developer mode is the default
User Mode
Simplified, restricted interface:
- Chat interface and conversation management
- Entity listing and basic info
- Developer APIs disabled (hot reload, deployment)
- Generic error messages (details logged server-side)
devui ./agents --mode user
Authentication
Bearer-token authentication is enabled by default. For a loopback bind, DevUI generates a token and displays it in the console:
devui ./agents
For a repeatable token, set DEVUI_AUTH_TOKEN or use --auth-token. A
non-loopback bind requires an explicit token and fails closed without one:
# Custom token via CLI
devui ./agents --auth-token "your-secure-token"
# Custom token via environment variable
export DEVUI_AUTH_TOKEN="your-secure-token"
devui ./agents --host 0.0.0.0
All API requests must include the token in the Authorization header:
curl http://localhost:8080/v1/entities \
-H "Authorization: Bearer your-secure-token"
Use --no-auth only for isolated loopback development. DevUI rejects
unauthenticated non-loopback binds, and even loopback no-auth mode removes
protection against requests sent by hostile websites.
Recommended Deployment Configuration
If you need to expose DevUI to end users (not recommended for production):
DEVUI_AUTH_TOKEN="<secure-dev-token>" devui ./agents --mode user --host 0.0.0.0
This configuration:
- Restricts developer-facing APIs
- Requires authentication
- Binds to all network interfaces
Security Features
DevUI includes several security measures:
| Feature | Description |
|---|---|
| Localhost binding | Binds to 127.0.0.1 by default |
| User mode | Restricts developer APIs |
| Authentication | Bearer-token authentication is enabled by default |
| No-auth mode | Allowed only on localhost or 127.0.0.1 |
| Network binds | Require DEVUI_AUTH_TOKEN or --auth-token |
| Local entity loading | Only loads entities from local directories or in-memory |
| No remote execution | No remote code execution capabilities |
Best Practices
Credentials Management
- Store API keys and secrets in
.envfiles - Never commit
.envfiles to source control - Use
.env.examplefiles to document required variables
# .env.example (safe to commit)
OPENAI_API_KEY=your-api-key-here
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
# .env (never commit)
OPENAI_API_KEY=sk-actual-key
AZURE_OPENAI_ENDPOINT=https://my-resource.openai.azure.com/
Network Security
- Keep DevUI bound to localhost for development
- Use a reverse proxy (nginx, Caddy) if external access is needed
- Enable HTTPS through the reverse proxy
- Implement proper authentication at the proxy level
Entity Security
- Review all agent/workflow code before running
- Only load entities from trusted sources
- Be cautious with tools that have side effects (file access, network calls)
Resource Cleanup
Register cleanup hooks to properly close credentials and resources on shutdown:
import os
from azure.identity.aio import DefaultAzureCredential
from agent_framework import Agent
from agent_framework.openai import OpenAIChatCompletionClient
from agent_framework_devui import register_cleanup, serve
credential = DefaultAzureCredential()
client = OpenAIChatCompletionClient(
model=os.environ["AZURE_OPENAI_CHAT_COMPLETION_MODEL"],
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
api_version=os.getenv("AZURE_OPENAI_API_VERSION"),
credential=credential,
)
agent = Agent(name="MyAgent", client=client)
# Register cleanup hook - credential will be closed on shutdown
register_cleanup(agent, credential.close)
serve(entities=[agent])
MCP Tools Considerations
When using MCP (Model Context Protocol) tools with DevUI:
# Correct - DevUI handles cleanup automatically
mcp_tool = MCPStreamableHTTPTool(url="http://localhost:8011/mcp", client=chat_client)
agent = Agent(tools=mcp_tool)
serve(entities=[agent])
Important
Don't use async with context managers when creating agents with MCP tools for DevUI. Connections will close before execution. MCP tools use lazy initialization and connect automatically on first use.
Note
Go support for this feature is coming soon. See the Agent Framework Go repository for the latest status.
Next Steps
- Samples - Browse sample agents and workflows
- API Reference - Learn about the API endpoints