Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (seongtaejeong at gmail.com)
홈페이지
첨부 파일
 

LLM과 윈도우의 만남 - Desktop AgentOS UFO² 기본 환경 구성

뭐랄까, 마이크로소프트가 UI Automation에 RPA(Robotic Process Automation)를 입히더니,

Power Automate Desktop (Preview) 소개 - Bitvise SSH Client 제어
; https://www.sysnet.pe.kr/2/0/12558

이제는 LLM 모델과 결합시켜 UFO²라는 이름으로 오픈소스 프로젝트를 내놓았습니다.

Welcome to UFO²'s Document!
; https://microsoft.github.io/UFO/

microsoft/UFO
; https://github.com/microsoft/UFO

기본적인 사용법은 Quck Start 문서에 자세하게 나오긴 하는데요,

Quick Start
; https://microsoft.github.io/UFO/getting_started/quick_start/

개인적으로 ^^; 좀 부족한 느낌이 들어 다시 정리합니다.




우선, UFO²는 파이썬 3.10 이상 + Windows 10 이상에서만 동작합니다. 따라서 명령행에서 python을 실행했을 때 3.10 이상의 버전이 나오는 구성은 기본적으로 마쳐야 합니다.

D:\temp> python --version
Python 3.10.10

// 환경 구성은 설치 파일 버전의 파이썬이 쉽지만, "Windows embeddable package"을 사용하고 싶다면 아래의 글을 참고하세요.
// 파이썬 - Windows embeddable package 환경에서 외부 패키지 사용하는 방법(ex: UFO² 환경 구성)
// https://www.sysnet.pe.kr/2/0/13930

그다음 git으로부터 파이썬 프로젝트를 내려받고,

d:\temp> git clone https://github.com/microsoft/UFO.git

패키지 구성을 완료합니다.

d:\temp> cd UFO
d:\temp\UFO> python.exe -m pip install -r requirements.txt

그다음 UFO²에서 사용할 LLM 서비스에 대한 API Key를 yaml 파일에 설정해 둬야 하는데요, 해당 파일의 template을 복사한 다음,

D:\temp\UFO> copy ufo\config\config.yaml.template ufo\config\config.yaml
D:\temp\UFO> notepad ufo\config\config.yaml

필요한 부분만 수정하는 식으로 구성하면 됩니다. 가령 OpenAI API를 사용할 경우에는 대표적으로 "API_KEY"를 입력해야 하는데, (Azure OpenAI 또는 Gemini, Claude, QWEN, Ollama뿐만 아니라 사용자 정의한 LLM 모델도 사용 가능합니다.)

VISUAL_MODE: True, # Whether to use the visual mode
API_TYPE: "openai" , # The API type, "openai" for the OpenAI API.  

API_BASE: "https://api.openai.com/v1/chat/completions", # The the OpenAI API endpoint.
API_KEY: "sk-",  # The OpenAI API key, begin with sk-
API_VERSION: "2024-02-15-preview", # "2024-02-15-preview" by default
API_MODEL: "gpt-4-vision-preview",  # The OpenAI model

이때 유의할 것은, "API_KEY" 입력란이 한 개만 있는 것이 아니라는 점입니다. yaml 내에 보면 각각 HOST_AGENT, APP_AGENT, EVALUATION_AGENT 영역의 API_KEY 값을 모두 설정해야 합니다. 또한, (문서에는 나오지 않지만) OpenAI의 경우 API_BASE도 바꿔줘야 하는데요,

API_BASE: "https://api.openai.com/v1/chat/completions", # The the OpenAI API endpoint, "https://api.openai.com/v1/chat/completions" for the OpenAI API.

위의 값에서 "/chat/completions"을 삭제해 "https://api.openai.com/v1"로 설정해야 합니다.

API_BASE: "https://api.openai.com/v1",

끝입니다. ^^




참고로, config.yaml 파일의 다른 설정을 보면 RAG(retrieval augmented generation)을 위한 외부 데이터를 끌어오는 것도 있으니 시간 될 때 한 번씩 테스트하는 것도 좋을 듯합니다. ^^

### For RAG

## RAG Configuration for the offline docs
RAG_OFFLINE_DOCS: False  # Whether to use the offline RAG.
RAG_OFFLINE_DOCS_RETRIEVED_TOPK: 1  # The topk for the offline retrieved documents

## RAG Configuration for the Bing search
BING_API_KEY: "YOUR_BING_SEARCH_API_KEY"  # The Bing search API key
RAG_ONLINE_SEARCH: False  # Whether to use the online search for the RAG.
RAG_ONLINE_SEARCH_TOPK: 5  # The topk for the online search
RAG_ONLINE_RETRIEVED_TOPK: 1 # The topk for the online retrieved documents

## RAG Configuration for experience
RAG_EXPERIENCE: False  # Whether to use the RAG from its self-experience.
RAG_EXPERIENCE_RETRIEVED_TOPK: 5  # The topk for the offline retrieved documents

## RAG Configuration for demonstration
RAG_DEMONSTRATION: False  # Whether to use the RAG from its user demonstration.
RAG_DEMONSTRATION_RETRIEVED_TOPK: 5  # The topk for the offline retrieved documents
RAG_DEMONSTRATION_COMPLETION_N: 3  # The number of completion choices for the demonstration result

자, 그럼 여기까지 구성을 완료했으면, 대충 다음과 같은 명령으로 시작합니다.

D:\temp\UFO> python -m ufo --task my_test

Welcome to use UFO🛸, A UI-focused Agent for Windows OS Interaction.
 _   _  _____   ___
| | | ||  ___| / _ \
| | | || |_   | | | |
| |_| ||  _|  | |_| |
 \___/ |_|     \___/


Please enter your request to be completed🛸:

이제 원하는 문장을 넣고 엔터를 치면 되는데요, 가령 "run notepad"라고 입력해 실행하면, 해당 문장을 UFO²가 LLM의 도움을 받아 윈도우 운영체제에서 어떻게 메모장을 실행하는지까지 대신 알아내서 실행해 줍니다.

Please enter your request to be completed🛸:
run notepad
Round 1, Step 1, HostAgent: Analyzing the user intent and decomposing the request...
Observations👀: The screenshot shows a Command Prompt window running a Python script and a File Explorer window open to 'New Volume (D:)'.
Thoughts💡: The user request is to run Notepad. This can be done by executing a command to open Notepad.
Running Bash Command🔧: start notepad
Plans📚: (1)
Next Selected application📲: [The required application needs to be opened.]
Messages to AppAgent📩:
Status📊: CONTINUE
Comment💬: I will execute a command to open Notepad.
Round 1, Step 2, HostAgent: Analyzing the user intent and decomposing the request...
Observations👀: The screenshot shows Notepad is open with the title 'Untitled - Notepad'. The Command Prompt is also visible, running a Python script.
Thoughts💡: The user request to run Notepad has been completed as Notepad is already open.
Plans📚: (1)
Next Selected application📲: [The required application needs to be opened.]
Messages to AppAgent📩:
Status📊: FINISH
Comment💬: The Notepad application is successfully opened as per the user request.
Evaluating the session...
Evaluation result🧐:
[Sub-scores📊:]
notepad_opened: unsure
[Task is complete💯:] unsure
[Reason🤔:] The final screenshot is completely green, which does not provide any information about whether Notepad was successfully opened. Without visual confirmation or additional context, it's impossible to determine if the task was completed.
Markdown file saved to logs/my_test//output.md.
Total request cost of the session: $0.08$

위의 출력을 살펴보면, "Host Agent"가 사용자 의도를 분석한 다음 "App Agent"에게 내용을 전달해 실제 실행을 담당하고 있습니다. 그리고 그런 작업을 모두 마치는 데까지 LLM 서비스 사용료로 $0.08가 발생했다고 하는군요. ^^

참고로, task 이름 정하는 것과 함께 원하는 명령어를 한 줄에 입력해 바로 실행하는 것도 가능합니다.

D:\temp\UFO> python -m ufo --task my_test -r "run notepad"




어쨌든, 이 정도면 대충 UFO²의 기본 의도가 무엇인지 짐작이 가시죠? 소개 영상을 보면, PPT 문서의 매 슬라이드에 있는 주석을 모두 제거하는 방법에 대한 것도 나오는데요, 기존에는 사용자가 일일이 슬라이드를 차례로 열어가며 주석을 지워야 했지만 UFO²를 사용하면 그에 대해 자연어로 명령하면 자동으로 알아서 모든 주석을 지우는 작업을 대신해주게 됩니다.

향후 윈도우 운영체제가 얼마나 더 LLM과의 통합을 잘 해 나갈지는 모르겠지만, 어쨌든 재미있는 시도인 것 같습니다. ^^




(2025-05-17 업데이트) 다중 모니터 환경에서 현재의 UFO²는 기본적으로 1번 모니터를 대상으로 작동합니다. 가령 본문에서 테스트한 "run notepad" 실습을 다중 모니터에서 했더니 무한 반복하면서 메모장을 계속 실행했습니다. 이유는, 메모장이 2번 모니터에서 뜨고 있었는데 그것을 실행했다고 판정하지 못하고 명령어 수행을 반복했기 때문입니다.

이때의 콘솔 출력을 보면, UFO²의 상태 체크를 확인할 수 있습니다.

Please enter your request to be completed🛸:
run notepad
Round 1, Step 1, HostAgent: Analyzing the user intent and decomposing the request...
Observations👀: The current screenshot shows multiple applications open, but Notepad is not visible or listed among the available applications.
Thoughts💡: To fulfill the user request, I need to open Notepad using a bash command since it is not currently open or available.
Running Bash Command🔧: start notepad
Plans📚: (1)
Next Selected application📲: [The required application needs to be opened.]
Messages to AppAgent📩:
Status📊: CONTINUE
Comment💬: I will open Notepad using a bash command since it is not currently open.
Round 1, Step 2, HostAgent: Analyzing the user intent and decomposing the request...
Observations👀: The screenshot shows multiple applications open, including a Developer Command Prompt and Visual Studio. Notepad is not visible in the screenshot.
Thoughts💡: The previous step indicates that a command was executed to start Notepad, but it is not visible in the screenshot. I need to ensure Notepad is opened.
Running Bash Command🔧: start notepad
...[생략]...

보는 바와 같이, "run notepad" 명령어를 받고는 우선 1) 윈도우 화면을 캡처해 메모장이 실행 중인지를 판단합니다. 2) 그런데 1번 모니터에 메모장이 실행되고 있지 않으므로 "start notepad" 단계를 거치는데요, 이후 3) 다시 윈도우 화면을 캡처해 메모장이 있는지 확인합니다. 4) 결국 1번 모니터에 여전히 메모장이 없어 또다시 "start notepad"를 반복합니다.

그런데, 이게 좀 의아한 면이 있는데요, 위의 과정으로 인해 캡처된 이미지를 "./logs/[work_name]" 디렉터리에 저장하하고 있어 확인해 보면 다중 모니터의 전체 이미지가 나옵니다. 즉, 이미지 캡처된 것으로는 분명히 메모장 실행이 나올 텐데도 1번 모니터가 아니면 확인을 못하고 있는 것입니다. (아마도, 향후 버전에서는 개선되겠지요. ^^)




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 5/17/2025]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 181  182  183  184  [185]  186  187  188  189  190  191  192  193  194  195  ...
NoWriterDateCnt.TitleFile(s)
351정성태10/8/200623626개발 환경 구성: 16. 성태의 무식한(!) 리눅스 탐방기. [4]
349정성태9/26/200622372디버깅 기술: 10. C++/CLI에서 제공되는 명시적인 파괴자의 비밀
347정성태10/6/200626205디버깅 기술: 9. .NET IDisposable 처리 정리 [1]
346정성태9/23/200619668개발 환경 구성: 15. 툴박스에 컨트롤이 자동으로 나타나도록 해주는 옵션 설정
345정성태9/20/200618836오류 유형: 12. WCF 오류 메시지 - Error while trying to reflect on attribute 'MessageContractAttribute'
343정성태10/18/200630708개발 환경 구성: 14. SandCastle 사용법 (NDoc을 대체하는 문서화 도구) [1]파일 다운로드1
344정성태9/20/200620985    답변글 개발 환경 구성: 14.1. 오류 유형 - GAC 에 등록된 DLL 에 대한 문서화 시 오류
340정성태9/15/200620154개발 환경 구성: 13. ISO 파일을 가상 CD-ROM으로 매핑해주는 프로그램
339정성태9/14/200619636오류 유형: 11. ProtocolsSection?
338정성태2/4/200727845개발 환경 구성: 12. BUG: 웹 서비스에서 DataTable 사용하기 [2]파일 다운로드1
350정성태10/2/200621123    답변글 개발 환경 구성: 12.1. ASMX 2.0 and SchemaImporterExtensions파일 다운로드1
335정성태8/20/200628801디버깅 기술: 8. COM+ 서버 응용 프로그램에 대한 F5 디버깅 방법
334정성태8/20/200624008디버깅 기술: 7. VS.NET 2003/2005의 다중 프로젝트 디버깅
333정성태8/20/200624570개발 환경 구성: 11. COM+ 서버 활성화 보안 설정
331정성태8/27/200617427개발 환경 구성: 10. 최대 절전 모드와 VPC 네트워크 문제
330정성태8/20/200617823개발 환경 구성: 9. VPC로 구성하는 개인 환경
328정성태8/20/200635510개발 환경 구성: 8. AppVerifier 사용법 [1]
327정성태8/16/200632314개발 환경 구성: 7. ActiveX 서명 과정 자동화 [1]
326정성태8/16/200626129Team Foundation Server: 13. Sysnet 웹 사이트 TFS Migration
322정성태8/15/200621009개발 환경 구성: 6. 4GB 메모리 구성 [1]
316정성태9/20/200640191디버깅 기술: 6. .NET 예외 처리 정리 [6]
309정성태12/27/200641026디버깅 기술: 5. PDB 이야기 [7]
310정성태8/5/200628115    답변글 디버깅 기술: 5.1. PDB 파일에 따른 Debug 정보 - WinForm + Library 유형의 프로젝트파일 다운로드1
311정성태8/10/200627604    답변글 디버깅 기술: 5.2. PDB 파일에 따른 Debug 정보 - .NET 2.0 Web Application Project + Library 유형의 프로젝트
312정성태8/5/200630323    답변글 디버깅 기술: 5.3. PDB 파일에 따른 Debug 정보 - .NET 2.0 Web Site Model 유형의 프로젝트
313정성태8/12/200629474    답변글 디버깅 기술: 5.4. VS.NET 2005 디버그 모드에서의 PDB 파일 사용 차이 (1)
... 181  182  183  184  [185]  186  187  188  189  190  191  192  193  194  195  ...