Skip to content

Commit bc7d43e

Browse files
Fix Samples (#34)
1 parent 4fa39aa commit bc7d43e

13 files changed

Lines changed: 454 additions & 547 deletions

File tree

README.md

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ coder_client: *client
153153
web_surfer_client: *client
154154
file_surfer_client: *client
155155
action_guard_client: *client
156-
user_proxy_client: *client
157156
```
158157
159158
The corresponding configuration for Azure OpenAI is:
@@ -188,7 +187,6 @@ coder_client: *client
188187
web_surfer_client: *client
189188
file_surfer_client: *client
190189
action_guard_client: *client
191-
user_proxy_client: *client
192190
```
193191
194192
@@ -246,11 +244,6 @@ cd ..
246244
magentic ui --port 8081
247245
```
248246

249-
For hosting the Magentic-UI, run the command:
250-
251-
```bash
252-
magentic ui --port 8081 --host 0.0.0.0
253-
```
254247

255248
#### Running the UI from source
256249

@@ -282,44 +275,6 @@ magentic ui --port 8081
282275

283276
The frontend from source will be available at <http://localhost:8000>, and the compiled frontend will be available at <http://localhost:8081>.
284277

285-
### Running the web surfer container directly
286-
287-
First, ensure it is built. Youc an do this by running Magentic UI once beforehand, or by running the following commands:
288-
289-
```bash
290-
cd src/magentic_ui/docker/magentic-ui-browser-docker
291-
docker build -t magentic-ui-vnc-browser:latest .
292-
```
293-
294-
Run it:
295-
296-
```bash
297-
docker run --rm \
298-
-p 9000:9000 \
299-
-p 9001:9001 \
300-
-v $(pwd):/workspace \
301-
-e PLAYWRIGHT_WS_PATH=/ws \
302-
-e PLAYWRIGHT_PORT=9000 \
303-
-e NO_VNC_PORT=9001 \
304-
magentic-ui-vnc-browser:latest
305-
```
306-
307-
Open a browser and navigate to <http://localhost:9001/vnc.html> to access the VNC viewer.
308-
309-
You'll see a black screen. The browser only launched when needed, so lets run a script to open a page.
310-
311-
```python
312-
from playwright.sync_api import sync_playwright
313-
import time
314-
315-
with sync_playwright() as p:
316-
browser = p.chromium.connect("ws://localhost:9000/ws")
317-
page = browser.new_page()
318-
page.goto("https://www.microsoft.com/en-us/research/lab/ai-frontiers/")
319-
time.sleep(60)
320-
```
321-
322-
323278
## Contributing
324279

325280
This project welcomes contributions and suggestions. Most contributions require you to agree to a

frontend/src/components/settings.tsx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const SettingsMenu: React.FC<SettingsMenuProps> = ({ isOpen, onClose }) => {
4343
const [allowedlistEnabled, setAllowedlistEnabled] = React.useState(false);
4444

4545
const MODEL_OPTIONS = [
46+
{ value: "azure-ai-foundry", label: "Azure AI Foundry Template" },
4647
{ value: "gpt-4o-2024-08-06", label: "GPT-4o" },
4748
{ value: "gpt-4o-mini-2024-07-18", label: "GPT-4o Mini" },
4849
{ value: "gpt-4.1-2025-04-14", label: "GPT-4.1" },
@@ -53,6 +54,28 @@ const SettingsMenu: React.FC<SettingsMenuProps> = ({ isOpen, onClose }) => {
5354
{ value: "o1-2024-12-17", label: "O1" },
5455
];
5556

57+
const AZURE_AI_FOUNDRY_YAML = `model_config: &client
58+
provider: AzureOpenAIChatCompletionClient
59+
config:
60+
model: gpt-4o
61+
azure_endpoint: "<YOUR ENDPOINT>"
62+
azure_deployment: "<YOUR DEPLOYMENT>"
63+
api_version: "2024-10-21"
64+
azure_ad_token_provider:
65+
provider: autogen_ext.auth.azure.AzureTokenProvider
66+
config:
67+
provider_kind: DefaultAzureCredential
68+
scopes:
69+
- https://cognitiveservices.azure.com/.default
70+
max_retries: 10
71+
72+
orchestrator_client: *client
73+
coder_client: *client
74+
web_surfer_client: *client
75+
file_surfer_client: *client
76+
action_guard_client: *client
77+
`;
78+
5679
React.useEffect(() => {
5780
if (isOpen) {
5881
setHasChanges(false);
@@ -177,6 +200,11 @@ const SettingsMenu: React.FC<SettingsMenuProps> = ({ isOpen, onClose }) => {
177200

178201
const updateModelInConfig = (modelName: string) => {
179202
try {
203+
if (modelName === "azure-ai-foundry") {
204+
handleUpdateConfig({ model_configs: AZURE_AI_FOUNDRY_YAML });
205+
message.success("Azure AI Foundry configuration applied");
206+
return;
207+
}
180208
const yamlLines = config.model_configs?.split("\n") || [];
181209
const updatedLines = yamlLines.map((line: string) => {
182210
if (line.includes("model:")) {
@@ -378,12 +406,12 @@ const SettingsMenu: React.FC<SettingsMenuProps> = ({ isOpen, onClose }) => {
378406
</div>
379407

380408
<div className="flex items-center justify-between">
381-
<span className="flex items-center gap-2">
409+
{/* <span className="flex items-center gap-2">
382410
Use Bing Search for Planning
383411
<Tooltip title="When enabled, Magentic-UI will use Bing Search when coming up with a plan. Note this adds 10 seconds to the planning time.">
384412
<InfoCircleOutlined className="text-secondary hover:text-primary cursor-help" />
385413
</Tooltip>
386-
</span>
414+
</span> */}
387415
<Switch
388416
checked={config.do_bing_search}
389417
checkedChildren="ON"

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ classifiers = [
1616
"Operating System :: OS Independent",
1717
]
1818
dependencies = [
19-
"autogen-agentchat==0.5.3",
20-
"autogen-core==0.5.3",
21-
"autogen-ext[openai,docker,file-surfer,web-surfer,magentic-one,task-centric-memory]==0.5.3",
19+
"autogen-agentchat==0.5.7",
20+
"autogen-core==0.5.7",
21+
"autogen-ext[openai,docker,file-surfer,web-surfer,magentic-one,task-centric-memory]==0.5.7",
2222
"aioconsole",
2323
"nest_asyncio",
2424
"docker",
@@ -50,11 +50,11 @@ eval = [
5050
]
5151

5252
azure = [
53-
"autogen-ext[azure]==0.5.3"
53+
"autogen-ext[azure]==0.5.7"
5454
]
5555

5656
ollama = [
57-
"autogen-ext[ollama]==0.5.3"
57+
"autogen-ext[ollama]==0.5.7"
5858
]
5959

6060
[project.scripts]

samples/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Magentic-UI Sample Scripts
2+
3+
This directory contains sample scripts to help explore Magentic-UI. Each script showcases a different agent or team configuration. See below for a brief explanation of each sample:
4+
5+
We will be adding more samples to help you get the most out of magentic-ui.
6+
7+
## 1. `sample_azure_agent.py`
8+
9+
**Description:**
10+
11+
- Demonstrates how to use an Azure AI Foundry agent within the Magentic-UI team.
12+
13+
**Usage:**
14+
15+
- Configure your Azure credentials and deployment names as needed.
16+
- Run the script to see the Azure agent respond to a simple message or in the Magentic-UI team.
17+
18+
## 2. `sample_coder.py`
19+
20+
**Description:**
21+
22+
- Runs the coding agent (`CoderAgent`) in a round-robin manner with the user.
23+
24+
**Usage:**
25+
26+
- Run with `python sample_coder.py --work_dir <directory>` (default: `debug`).
27+
- Enter your coding task at the prompt.
28+
29+
## 3. `sample_file_surfer.py`
30+
31+
**Description:**
32+
33+
- Runs the `FileSurfer` agent, which can browse and read files in a directory.
34+
35+
**Usage:**
36+
37+
- Run with `python sample_file_surfer.py --work-dir <directory>` (default: `debug`).
38+
- Enter your file-related task at the prompt.
39+
40+
## 4. `sample_web_surfer.py`
41+
42+
**Description:**
43+
44+
- Runs the `WebSurfer` agent, which can interact with web pages using a Playwright browser (local or Dockerized).
45+
- Supports both headless and VNC (noVNC) browser modes for web automation and browsing tasks.
46+
47+
**Usage:**
48+
49+
- Run with `python sample_web_surfer.py` for local browser.
50+
- Use `--port` and `--novnc-port` for Docker/VNC modes (see script help for details).
51+
- Enter your web task at the prompt.

samples/cuawebsurfer_test.py

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)