You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run a single sample directly. This demonstrates how to wrap agents and workflows programmatically without needing a directory structure:
21
+
Run a single sample directly. This demonstrates how to register agents and workflows in code without using DevUI's directory discovery.
22
+
23
+
This sample uses Azure AI Foundry. Before running it:
24
+
25
+
1. Copy `.env.example` in this folder to `.env`, or export the same values in your shell
26
+
2. Set `FOUNDRY_PROJECT_ENDPOINT` and `FOUNDRY_MODEL`
27
+
3. Run `az login`
28
+
29
+
Then start the sample:
22
30
23
31
```bash
24
32
cd python/samples/02-agents/devui
25
33
python in_memory_mode.py
26
34
```
27
35
28
-
This opens your browser at http://localhost:8090 with pre-configured agents and a basic workflow.
36
+
This opens your browser at http://localhost:8090 with two Foundry-backed agents and a simple text transformation workflow.
29
37
30
-
### Option 2: Directory Discovery
38
+
### Option 2: Directory Discovery with Shared Root `.env`
31
39
32
-
Launch DevUI to discover all samples in this folder:
40
+
Run the folder-level launcher to load `samples/02-agents/devui/.env` and then start DevUI with directory discovery for this folder:
33
41
34
42
```bash
35
43
cd python/samples/02-agents/devui
36
-
devui
44
+
python main.py
37
45
```
38
46
39
-
This starts the server at http://localhost:8080 with all agents and workflows available.
47
+
This starts the server at http://localhost:8080 with all discoverable agents and workflows available. The root `.env` acts as shared fallback configuration for discovered samples.
48
+
49
+
### Option 3: Directory Discovery with the `devui` CLI
50
+
51
+
If you prefer the CLI directly, you can still launch DevUI from this folder:
52
+
53
+
```bash
54
+
cd python/samples/02-agents/devui
55
+
devui .
56
+
```
57
+
58
+
DevUI discovery checks for a sample-specific `.env` first and then falls back to `.env` in `samples/02-agents/devui/`.
40
59
41
60
## Sample Structure
42
61
43
-
Each agent/workflow follows a strict structure required by DevUI's discovery system:
62
+
DevUI discovers samples from Python packages that export either `agent` or `workflow`.
63
+
64
+
Typical agent layout:
44
65
45
66
```
46
67
agent_name/
47
-
├── __init__.py # Must export: agent = Agent(...)
68
+
├── __init__.py # Must export: agent = ...
48
69
├── agent.py # Agent implementation
49
-
└── .env.example # Example environment variables
70
+
└── .env.example # Optional example environment variables
|[**agent_weather/**](agent_weather/)|A richer Foundry-backed weather agent that shows chat middleware, function middleware, tool calling, and an approval-required tool alongside auto-approved tools. |`FOUNDRY_PROJECT_ENDPOINT`, `FOUNDRY_MODEL`, plus Azure CLI auth via `az login`|
90
+
|[**agent_foundry/**](agent_foundry/)| A minimal Foundry-backed weather agent with current weather and forecast tools. Use this when you want the smallest possible directory-discovered agent sample. |`FOUNDRY_PROJECT_ENDPOINT`, `FOUNDRY_MODEL`, plus Azure CLI auth via `az login`|
60
91
61
92
### Workflows
62
93
63
-
| Sample | Description | Features |Required Environment Variables |
|[**workflow_declarative/**](workflow_declarative/)| A YAML-defined workflow loaded through `WorkflowFactory`, with nested age-based branching and no model client code. | None |
97
+
|[**workflow_with_agents/**](workflow_with_agents/)| A content review workflow that uses agents as executors and routes based on structured review output (`Writer -> Reviewer -> Editor/Publisher -> Summarizer`).|`AZURE_OPENAI_ENDPOINT`, plus `AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME` or `AZURE_OPENAI_DEPLOYMENT_NAME`; Azure CLI auth via `az login`; `AZURE_OPENAI_API_VERSION` is optional|
98
+
|[**workflow_spam/**](workflow_spam/)| A multi-step spam detection workflow with human-in-the-loop approval, branching for spam vs. legitimate messages, and a final reporting step. | None |
99
+
|[**workflow_fanout/**](workflow_fanout/)| A larger fan-out/fan-in data processing workflow with parallel validation, multiple transformations, QA, aggregation, and demo failure toggles. | None |
|[**in_memory_mode.py**](in_memory_mode.py)|Demonstrates programmatic entity registration without directory structure | In-memory agent and workflow registration, multiple entities served from a single file, includes basic workflow, simplest way to get started|
103
+
| Sample | What it demonstrates | Required keys / auth|
|[**in_memory_mode.py**](in_memory_mode.py)|Registers multiple entities directly in Python: two Foundry-backed agents plus a simple workflow, all served from one file without directory discovery. |`FOUNDRY_PROJECT_ENDPOINT`, `FOUNDRY_MODEL`, plus Azure CLI auth via `az login`|
75
106
76
107
## Environment Variables
77
108
78
-
Each sample that requires API keys includes a `.env.example` file. To use:
109
+
For samples that require external services:
110
+
111
+
1. Copy `.env.example` to `.env`
112
+
2. Fill in the required values
113
+
3. Run `az login` for samples that use Azure CLI authentication
79
114
80
-
1. Copy `.env.example` to `.env` in the same directory
81
-
2. Fill in your actual API keys
82
-
3. DevUI automatically loads `.env` files from entity directories
115
+
Directory discovery checks `.env` files in this order:
116
+
117
+
1. The entity directory itself, for example `agent_weather/.env`
118
+
2. The root DevUI samples folder, `samples/02-agents/devui/.env`
119
+
120
+
That means the root `.env.example` can hold shared defaults for multiple samples, while a sample-specific `.env` can override those values when needed.
121
+
122
+
`in_memory_mode.py` and `main.py` both load `.env` from `samples/02-agents/devui/`, so the root `.env.example` in this folder is the right starting point for both commands.
83
123
84
124
Alternatively, set environment variables globally:
**Missing API keys**: Check your `.env` files or environment variables.
196
+
**Missing credentials or settings**: Check your `.env` files, confirm the required variables for the sample you are running, and make sure `az login` has completed for Azure-authenticated samples.
149
197
150
198
**Import errors**: Make sure you've installed the devui package:
0 commit comments