|
| 1 | +--- |
| 2 | +title: DevUI API Reference |
| 3 | +description: Learn about the OpenAI-compatible API endpoints provided by DevUI. |
| 4 | +author: moonbox3 |
| 5 | +ms.topic: reference |
| 6 | +ms.author: evmattso |
| 7 | +ms.date: 12/10/2025 |
| 8 | +ms.service: agent-framework |
| 9 | +zone_pivot_groups: programming-languages |
| 10 | +--- |
| 11 | + |
| 12 | +# API Reference |
| 13 | + |
| 14 | +DevUI provides an OpenAI-compatible Responses API, allowing you to use the OpenAI SDK or any HTTP client to interact with your agents and workflows. |
| 15 | + |
| 16 | +::: zone pivot="programming-language-csharp" |
| 17 | + |
| 18 | +## Coming Soon |
| 19 | + |
| 20 | +DevUI documentation for C# is coming soon. Please check back later or refer to the Python documentation for conceptual guidance. |
| 21 | + |
| 22 | +::: zone-end |
| 23 | + |
| 24 | +::: zone pivot="programming-language-python" |
| 25 | + |
| 26 | +## Base URL |
| 27 | + |
| 28 | +``` |
| 29 | +http://localhost:8080/v1 |
| 30 | +``` |
| 31 | + |
| 32 | +The port can be configured with the `--port` CLI option. |
| 33 | + |
| 34 | +## Authentication |
| 35 | + |
| 36 | +By default, DevUI does not require authentication for local development. When running with `--auth`, Bearer token authentication is required. |
| 37 | + |
| 38 | +## Using the OpenAI SDK |
| 39 | + |
| 40 | +### Basic Request |
| 41 | + |
| 42 | +```python |
| 43 | +from openai import OpenAI |
| 44 | + |
| 45 | +client = OpenAI( |
| 46 | + base_url="http://localhost:8080/v1", |
| 47 | + api_key="not-needed" # API key not required for local DevUI |
| 48 | +) |
| 49 | + |
| 50 | +response = client.responses.create( |
| 51 | + metadata={"entity_id": "weather_agent"}, # Your agent/workflow name |
| 52 | + input="What's the weather in Seattle?" |
| 53 | +) |
| 54 | + |
| 55 | +# Extract text from response |
| 56 | +print(response.output[0].content[0].text) |
| 57 | +``` |
| 58 | + |
| 59 | +### Streaming |
| 60 | + |
| 61 | +```python |
| 62 | +response = client.responses.create( |
| 63 | + metadata={"entity_id": "weather_agent"}, |
| 64 | + input="What's the weather in Seattle?", |
| 65 | + stream=True |
| 66 | +) |
| 67 | + |
| 68 | +for event in response: |
| 69 | + # Process streaming events |
| 70 | + print(event) |
| 71 | +``` |
| 72 | + |
| 73 | +### Multi-turn Conversations |
| 74 | + |
| 75 | +Use the standard OpenAI `conversation` parameter for multi-turn conversations: |
| 76 | + |
| 77 | +```python |
| 78 | +# Create a conversation |
| 79 | +conversation = client.conversations.create( |
| 80 | + metadata={"agent_id": "weather_agent"} |
| 81 | +) |
| 82 | + |
| 83 | +# First turn |
| 84 | +response1 = client.responses.create( |
| 85 | + metadata={"entity_id": "weather_agent"}, |
| 86 | + input="What's the weather in Seattle?", |
| 87 | + conversation=conversation.id |
| 88 | +) |
| 89 | + |
| 90 | +# Follow-up turn (continues the conversation) |
| 91 | +response2 = client.responses.create( |
| 92 | + metadata={"entity_id": "weather_agent"}, |
| 93 | + input="How about tomorrow?", |
| 94 | + conversation=conversation.id |
| 95 | +) |
| 96 | +``` |
| 97 | + |
| 98 | +DevUI automatically retrieves the conversation's message history and passes it to the agent. |
| 99 | + |
| 100 | +## REST API Endpoints |
| 101 | + |
| 102 | +### Responses API (OpenAI Standard) |
| 103 | + |
| 104 | +Execute an agent or workflow: |
| 105 | + |
| 106 | +```bash |
| 107 | +curl -X POST http://localhost:8080/v1/responses \ |
| 108 | + -H "Content-Type: application/json" \ |
| 109 | + -d '{ |
| 110 | + "metadata": {"entity_id": "weather_agent"}, |
| 111 | + "input": "What is the weather in Seattle?" |
| 112 | + }' |
| 113 | +``` |
| 114 | + |
| 115 | +### Conversations API (OpenAI Standard) |
| 116 | + |
| 117 | +| Endpoint | Method | Description | |
| 118 | +|----------|--------|-------------| |
| 119 | +| `/v1/conversations` | POST | Create a conversation | |
| 120 | +| `/v1/conversations/{id}` | GET | Get conversation details | |
| 121 | +| `/v1/conversations/{id}` | POST | Update conversation metadata | |
| 122 | +| `/v1/conversations/{id}` | DELETE | Delete a conversation | |
| 123 | +| `/v1/conversations?agent_id={id}` | GET | List conversations (DevUI extension) | |
| 124 | +| `/v1/conversations/{id}/items` | POST | Add items to conversation | |
| 125 | +| `/v1/conversations/{id}/items` | GET | List conversation items | |
| 126 | +| `/v1/conversations/{id}/items/{item_id}` | GET | Get a conversation item | |
| 127 | + |
| 128 | +### Entity Management (DevUI Extension) |
| 129 | + |
| 130 | +| Endpoint | Method | Description | |
| 131 | +|----------|--------|-------------| |
| 132 | +| `/v1/entities` | GET | List discovered agents/workflows | |
| 133 | +| `/v1/entities/{entity_id}/info` | GET | Get detailed entity information | |
| 134 | +| `/v1/entities/{entity_id}/reload` | POST | Hot reload entity (developer mode) | |
| 135 | + |
| 136 | +### Health Check |
| 137 | + |
| 138 | +```bash |
| 139 | +curl http://localhost:8080/health |
| 140 | +``` |
| 141 | + |
| 142 | +### Server Metadata |
| 143 | + |
| 144 | +Get server configuration and capabilities: |
| 145 | + |
| 146 | +```bash |
| 147 | +curl http://localhost:8080/meta |
| 148 | +``` |
| 149 | + |
| 150 | +Returns: |
| 151 | +- `ui_mode` - Current mode (`developer` or `user`) |
| 152 | +- `version` - DevUI version |
| 153 | +- `framework` - Framework name (`agent_framework`) |
| 154 | +- `runtime` - Backend runtime (`python`) |
| 155 | +- `capabilities` - Feature flags (tracing, OpenAI proxy, deployment) |
| 156 | +- `auth_required` - Whether authentication is enabled |
| 157 | + |
| 158 | +## Event Mapping |
| 159 | + |
| 160 | +DevUI maps Agent Framework events to OpenAI Responses API events. The table below shows the mapping: |
| 161 | + |
| 162 | +### Lifecycle Events |
| 163 | + |
| 164 | +| OpenAI Event | Agent Framework Event | |
| 165 | +|--------------|----------------------| |
| 166 | +| `response.created` + `response.in_progress` | `AgentStartedEvent` | |
| 167 | +| `response.completed` | `AgentCompletedEvent` | |
| 168 | +| `response.failed` | `AgentFailedEvent` | |
| 169 | +| `response.created` + `response.in_progress` | `WorkflowStartedEvent` | |
| 170 | +| `response.completed` | `WorkflowCompletedEvent` | |
| 171 | +| `response.failed` | `WorkflowFailedEvent` | |
| 172 | + |
| 173 | +### Content Types |
| 174 | + |
| 175 | +| OpenAI Event | Agent Framework Content | |
| 176 | +|--------------|------------------------| |
| 177 | +| `response.content_part.added` + `response.output_text.delta` | `TextContent` | |
| 178 | +| `response.reasoning_text.delta` | `TextReasoningContent` | |
| 179 | +| `response.output_item.added` | `FunctionCallContent` (initial) | |
| 180 | +| `response.function_call_arguments.delta` | `FunctionCallContent` (args) | |
| 181 | +| `response.function_result.complete` | `FunctionResultContent` | |
| 182 | +| `response.output_item.added` (image) | `DataContent` (images) | |
| 183 | +| `response.output_item.added` (file) | `DataContent` (files) | |
| 184 | +| `error` | `ErrorContent` | |
| 185 | + |
| 186 | +### Workflow Events |
| 187 | + |
| 188 | +| OpenAI Event | Agent Framework Event | |
| 189 | +|--------------|----------------------| |
| 190 | +| `response.output_item.added` (ExecutorActionItem) | `ExecutorInvokedEvent` | |
| 191 | +| `response.output_item.done` (ExecutorActionItem) | `ExecutorCompletedEvent` | |
| 192 | +| `response.output_item.added` (ResponseOutputMessage) | `WorkflowOutputEvent` | |
| 193 | + |
| 194 | +### DevUI Custom Extensions |
| 195 | + |
| 196 | +DevUI adds custom event types for Agent Framework-specific functionality: |
| 197 | + |
| 198 | +- `response.function_approval.requested` - Function approval requests |
| 199 | +- `response.function_approval.responded` - Function approval responses |
| 200 | +- `response.function_result.complete` - Server-side function execution results |
| 201 | +- `response.workflow_event.complete` - Workflow events |
| 202 | +- `response.trace.complete` - Execution traces |
| 203 | + |
| 204 | +These custom extensions are namespaced and can be safely ignored by standard OpenAI clients. |
| 205 | + |
| 206 | +## OpenAI Proxy Mode |
| 207 | + |
| 208 | +DevUI provides an **OpenAI Proxy** feature for testing OpenAI models directly through the interface without creating custom agents. Enable via Settings in the UI. |
| 209 | + |
| 210 | +```bash |
| 211 | +curl -X POST http://localhost:8080/v1/responses \ |
| 212 | + -H "X-Proxy-Backend: openai" \ |
| 213 | + -d '{"model": "gpt-4.1-mini", "input": "Hello"}' |
| 214 | +``` |
| 215 | + |
| 216 | +> [!NOTE] |
| 217 | +> Proxy mode requires `OPENAI_API_KEY` environment variable configured on the backend. |
| 218 | +
|
| 219 | +::: zone-end |
| 220 | + |
| 221 | +## Next Steps |
| 222 | + |
| 223 | +- [Tracing & Observability](./tracing.md) - View traces for debugging |
| 224 | +- [Security & Deployment](./security.md) - Secure your DevUI deployment |
0 commit comments