Skip to content

Commit 82b5d53

Browse files
[WIP] Fara-7B in Magentic-UI (#448)
1 parent 1249afe commit 82b5d53

28 files changed

+2165
-15
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Magentic-UI is a **research prototype** human-centered AI agent that solves comp
1818

1919
## ✨ What's New
2020

21+
Microsoft latest agentic model [Fara-7B](https://www.microsoft.com/en-us/research/blog/fara-7b-an-efficient-agentic-model-for-computer-use/) is now integrated in Magentic-UI, read how to launch in <a href="#Magentic-UI with Fara-7B">Fara-7B guide</a>.
22+
23+
2124
- **"Tell me When"**: Automate monitoring tasks and repeatable workflows that require web or API access that span minutes to days. *Learn more [here](https://www.microsoft.com/en-us/research/blog/tell-me-when-building-agents-that-can-wait-monitor-and-act/).*
2225
- **File Upload Support**: Upload any file through the UI for analysis or modification
2326
- **MCP Agents**: Extend capabilities with your favorite MCP servers
@@ -212,6 +215,59 @@ If you face issues with Docker, please refer to the [TROUBLESHOOTING.md](TROUBLE
212215
Once the server is running, you can access the UI at <http://localhost:8081>.
213216

214217

218+
219+
### Magentic-UI with Fara-7B
220+
221+
1) First install magentic-ui with the fara extras:
222+
223+
```bash
224+
```bash
225+
python3 -m venv .venv
226+
source .venv/bin/activate
227+
pip install magentic-ui[fara]
228+
```
229+
230+
2) In a seperate process, serve the Fara-7B model using vLLM:
231+
232+
```bash
233+
vllm serve "microsoft/Fara-7B" --port 5000 --dtype auto
234+
```
235+
236+
3) First create a `fara_config.yaml` file with the following content:
237+
238+
```yaml
239+
model_config_local_surfer: &client_surfer
240+
provider: OpenAIChatCompletionClient
241+
config:
242+
model: "microsoft/Fara-7B"
243+
base_url: http://localhost:5000/v1
244+
api_key: not-needed
245+
model_info:
246+
vision: true
247+
function_calling: true
248+
json_output: false
249+
family: "unknown"
250+
structured_output: false
251+
multiple_system_messages: false
252+
253+
orchestrator_client: *client_surfer
254+
coder_client: *client_surfer
255+
web_surfer_client: *client_surfer
256+
file_surfer_client: *client_surfer
257+
action_guard_client: *client_surfer
258+
model_client: *client_surfer
259+
```
260+
Note: if you are hosting vLLM on a different port or host, change the `base_url` accordingly.
261+
262+
263+
Then launch Magentic-UI with the fara agent:
264+
265+
```bash
266+
magentic-ui --fara --port 8081 --config fara_config.yaml
267+
```
268+
269+
Finally, navigate to <http://localhost:8081> to access the interface!
270+
215271
### Configuration
216272

217273
#### Model Client Configuration

docker/magentic-ui-browser-docker/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
IMAGE_NAME=magentic-ui-browser
4-
IMAGE_VERSION=0.0.1
4+
IMAGE_VERSION=0.0.2
55
REGISTRY=ghcr.io/microsoft
66

77
# Check if --push flag is provided or PUSH environment variable is set

docker/magentic-ui-browser-docker/playwright-server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const port = process.env.PLAYWRIGHT_PORT || 37367;
1414
args: [
1515
"--start-fullscreen",
1616
"--start-maximized",
17-
"--window-size=1440,1440",
17+
"--window-size=1440,900",
1818
"--window-position=0,0",
1919
"--disable-infobars",
2020
"--no-default-browser-check",

docker/magentic-ui-browser-docker/supervisord.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ logfile_maxbytes=50MB
55
loglevel=info
66

77
[program:xvfb]
8-
command=Xvfb :99 -screen 0 1440x1440x24 -ac -nolisten tcp
8+
command=Xvfb :99 -screen 0 1440x900x24 -ac -nolisten tcp
99
autorestart=true
1010
stdout_logfile=/dev/stdout
1111
stdout_logfile_maxbytes=0
@@ -34,7 +34,7 @@ stderr_logfile=/dev/stderr
3434
stderr_logfile_maxbytes=0
3535

3636
[program:x11vnc]
37-
command=x11vnc -display :99 -forever -shared -nopw -geometry 1440x1440 -scale 1:1 -nomodtweak
37+
command=x11vnc -display :99 -forever -shared -nopw -geometry 1440x900 -scale 1:1 -nomodtweak
3838
autorestart=true
3939
priority=20
4040
stdout_logfile=/dev/stdout

docker/magentic-ui-browser-docker/x11-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fi
99
xsetroot -solid "#000000"
1010

1111
# Force X11 to use the exact screen dimensions without any offsets
12-
xrandr --output default --mode 1440x1440 --pos 0x0
12+
xrandr --output default --mode 1440x900 --pos 0x0
1313

1414
# Set proper DPI settings for the display
1515
echo "Xft.dpi: 96" | xrdb -merge

fara_config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
model_config_local_surfer: &client_surfer
2+
provider: OpenAIChatCompletionClient
3+
config:
4+
model: "microsoft/Fara-7B"
5+
base_url: http://localhost:5000/v1
6+
api_key: not-needed
7+
model_info:
8+
vision: true
9+
function_calling: true
10+
json_output: false
11+
family: "unknown"
12+
structured_output: false
13+
multiple_system_messages: false
14+
15+
orchestrator_client: *client_surfer
16+
coder_client: *client_surfer
17+
web_surfer_client: *client_surfer
18+
file_surfer_client: *client_surfer
19+
action_guard_client: *client_surfer
20+
model_client: *client_surfer

pyproject.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ ollama = [
7070
"autogen-ext[ollama]==0.5.7"
7171
]
7272

73+
fara = [
74+
"pillow",
75+
"tenacity",
76+
"pyyaml",
77+
"jsonschema",
78+
"browserbase",
79+
"vllm>=0.10.0",
80+
]
81+
7382
[project.scripts]
7483
magentic = "magentic_ui.backend.cli:run"
7584
magentic-ui = "magentic_ui.backend.cli:run"
@@ -132,7 +141,7 @@ exclude = ["src/magentic_ui/eval"]
132141

133142
[tool.pyright]
134143
include = ["src", "tests", "samples"]
135-
exclude = ["src/magentic_ui/eval/benchmarks/assistantbench/evaluate_utils", "src/magentic_ui/agents/web_surfer/_cua_web_surfer.py", "src/magentic_ui/backend/web/routes"]
144+
exclude = ["src/magentic_ui/eval/benchmarks/assistantbench/evaluate_utils", "src/magentic_ui/agents/web_surfer/_cua_web_surfer.py", "src/magentic_ui/backend/web/routes", "src/magentic_ui/agents/web_surfer/fara", "src/magentic_ui/tools/playwright/playwright_controller_fara.py"]
136145
typeCheckingMode = "strict"
137146
reportUnnecessaryIsInstance = false
138147
reportMissingTypeStubs = false

src/magentic_ui/_docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
DOCKER_REGISTRY = "ghcr.io/microsoft"
1111
BROWSER_IMAGE = os.getenv(
12-
BROWSER_IMAGE_ENV_VAR, f"{DOCKER_REGISTRY}/magentic-ui-browser:0.0.1"
12+
BROWSER_IMAGE_ENV_VAR, f"{DOCKER_REGISTRY}/magentic-ui-browser:0.0.2"
1313
)
1414
PYTHON_IMAGE = os.getenv(
1515
PYTHON_IMAGE_ENV_VAR, f"{DOCKER_REGISTRY}/magentic-ui-python-env:0.0.1"

src/magentic_ui/agents/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
from .web_surfer import WebSurfer, WebSurferCUA
1+
from .web_surfer import WebSurfer, WebSurferCUA, FaraWebSurfer
22
from ._coder import CoderAgent
33
from ._user_proxy import USER_PROXY_DESCRIPTION
44
from .file_surfer import FileSurfer
55

66
__all__ = [
77
"WebSurfer",
88
"WebSurferCUA",
9+
"FaraWebSurfer",
910
"CoderAgent",
1011
"USER_PROXY_DESCRIPTION",
1112
"FileSurfer",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from ._web_surfer import WebSurfer, WebSurferConfig
22
from ._cua_web_surfer import WebSurferCUA
3+
from .fara._fara_web_surfer import FaraWebSurfer
34

45
__all__ = [
56
"WebSurfer",
67
"WebSurferConfig",
78
"WebSurferCUA",
9+
"FaraWebSurfer",
810
]

0 commit comments

Comments
 (0)