Skip to content

Commit ae474c6

Browse files
committed
optimize for tutorial
1 parent 0c367c8 commit ae474c6

7 files changed

Lines changed: 109 additions & 108 deletions

File tree

documents/docs/galaxy/evaluation/result_json.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -679,22 +679,22 @@ def generate_performance_report(task_name: str, output_file: str = "report.md"):
679679
680680
| Metric | Value |
681681
|--------|-------|
682-
| Total Tasks | {metrics['task_count']} |
683-
| Completed Tasks | {metrics['completed_tasks']} |
684-
| Failed Tasks | {metrics['failed_tasks']} |
685-
| Success Rate | {metrics['task_statistics']['success_rate'] * 100:.1f}% |
686-
| Average Task Duration | {metrics['task_statistics']['average_task_duration']:.2f}s |
687-
| Min Task Duration | {metrics['task_statistics']['min_task_duration']:.2f}s |
688-
| Max Task Duration | {metrics['task_statistics']['max_task_duration']:.2f}s |
682+
| Total Tasks | `{metrics['task_count']}` |
683+
| Completed Tasks | `{metrics['completed_tasks']}` |
684+
| Failed Tasks | `{metrics['failed_tasks']}` |
685+
| Success Rate | `{metrics['task_statistics']['success_rate'] * 100:.1f}%` |
686+
| Average Task Duration | `{metrics['task_statistics']['average_task_duration']:.2f}s` |
687+
| Min Task Duration | `{metrics['task_statistics']['min_task_duration']:.2f}s` |
688+
| Max Task Duration | `{metrics['task_statistics']['max_task_duration']:.2f}s` |
689689
690690
## Constellation Performance
691691
692692
| Metric | Value |
693693
|--------|-------|
694-
| Parallelism Ratio | {result['session_results']['final_constellation_stats']['parallelism_ratio']:.2f} |
695-
| Critical Path Length | {result['session_results']['final_constellation_stats']['critical_path_length']:.2f}s |
696-
| Total Work | {result['session_results']['final_constellation_stats']['total_work']:.2f}s |
697-
| Max Width | {result['session_results']['final_constellation_stats']['max_width']} |
694+
| Parallelism Ratio | `{result['session_results']['final_constellation_stats']['parallelism_ratio']:.2f}` |
695+
| Critical Path Length | `{result['session_results']['final_constellation_stats']['critical_path_length']:.2f}s` |
696+
| Total Work | `{result['session_results']['final_constellation_stats']['total_work']:.2f}s` |
697+
| Max Width | `{result['session_results']['final_constellation_stats']['max_width']}` |
698698
699699
700700
# Example usage

documents/docs/tutorials/creating_app_agent/demonstration_provision.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## Provide Human Demonstrations to the AppAgent
1+
# Provide Human Demonstrations to the AppAgent
22

33
Users or application developers can provide human demonstrations to the `AppAgent` to guide it in executing similar tasks in the future. The `AppAgent` uses these demonstrations to understand the context of the task and the steps required to execute it, effectively becoming an expert in the application.
44

5-
### How to Prepare Human Demonstrations for the AppAgent?
5+
## How to Prepare Human Demonstrations for the AppAgent?
66

77
Currently, UFO supports learning from user trajectories recorded by [Steps Recorder](https://support.microsoft.com/en-us/windows/record-steps-to-reproduce-a-problem-46582a9b-620f-2e36-00c9-04e25d784e47) integrated within Windows. More tools will be supported in the future.
88

@@ -14,9 +14,10 @@ Follow the [official guidance](https://support.microsoft.com/en-us/windows/recor
1414

1515
Include any specific details or instructions for UFO to notice by adding comments. Since Steps Recorder doesn't capture typed text, include any necessary typed content in the comments as well.
1616

17-
<p align="center">
18-
<img src="../../img/add_comment.png" alt="Adding Comments in Steps Recorder"/>
19-
</p>
17+
<figure markdown>
18+
![Adding Comments in Steps Recorder](../../img/add_comment.png)
19+
<figcaption>Adding comments in Steps Recorder for additional context</figcaption>
20+
</figure>
2021

2122

2223
### Step 3: Review and Save the Recorded Demonstrations
@@ -57,14 +58,15 @@ Would you like to save any one of them as a future reference for the agent? Pres
5758

5859
Press `1` to save the plan into its memory for future reference. A sample can be found [here](https://github.com/microsoft/UFO/blob/main/vectordb/demonstration/example.yaml).
5960

60-
You can view a demonstration video below:
61+
You can view a demonstration video [here](https://github.com/yunhao0204/UFO/assets/59384816/0146f83e-1b5e-4933-8985-fe3f24ec4777).
6162

62-
<iframe width="560" height="315" src="https://github.com/yunhao0204/UFO/assets/59384816/0146f83e-1b5e-4933-8985-fe3f24ec4777" frameborder="0" allowfullscreen></iframe>
63-
64-
<br>
65-
66-
### How to Use Human Demonstrations to Enhance the AppAgent?
63+
## How to Use Human Demonstrations to Enhance the AppAgent?
6764

6865
After creating the offline indexer, refer to the [Learning from User Demonstrations](../../ufo2/core_features/knowledge_substrate/learning_from_demonstration.md) section for guidance on how to use human demonstrations to enhance the AppAgent.
6966

70-
---
67+
## Related Documentation
68+
69+
- [Overview: Enhancing AppAgent Capabilities](./overview.md) - Learn about all enhancement approaches
70+
- [Help Document Provision](./help_document_provision.md) - Provide knowledge through documentation
71+
- [Wrapping App-Native API](./warpping_app_native_api.md) - Create efficient MCP action servers
72+
- [Knowledge Substrate Overview](../../ufo2/core_features/knowledge_substrate/overview.md) - Understanding the RAG architecture

documents/docs/tutorials/creating_app_agent/help_document_provision.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
Help documents provide guidance to the `AppAgent` in executing specific tasks. The `AppAgent` uses these documents to understand the context of the task and the steps required to execute it, effectively becoming an expert in the application.
44

5-
## How to Provide Help Documents to the AppAgent?
6-
7-
### Step 1: Prepare Help Documents and Metadata
5+
## Step 1: Prepare Help Documents and Metadata
86

97
UFO currently supports processing help documents in `json` format. More formats will be supported in the future.
108

@@ -30,11 +28,11 @@ An example of a help document in `json` format is as follows:
3028

3129
Save each help document in a `json` file of your target folder.
3230

33-
### Step 2: Place Help Documents in the AppAgent Directory
31+
## Step 2: Place Help Documents in the AppAgent Directory
3432

3533
Once you have prepared all help documents and their metadata, place them into a folder. Sub-folders for the help documents are allowed, but ensure that each help document and its corresponding metadata are placed in the same directory.
3634

37-
### Step 3: Create a Help Document Indexer
35+
## Step 3: Create a Help Document Indexer
3836

3937
After organizing your documents in a folder named `path_of_the_docs`, you can create an offline indexer to support RAG for UFO. Follow these steps:
4038

@@ -48,10 +46,16 @@ python -m learner --app <app_name> --docs <path_of_the_docs>
4846

4947
This command will create an offline indexer for all documents in the `path_of_the_docs` folder using Faiss and embedding with sentence transformer (additional embeddings will be supported soon). By default, the created index will be placed [here](https://github.com/microsoft/UFO/tree/main/vectordb/docs).
5048

51-
!!! note
49+
!!! note "Application Name Requirement"
5250
Ensure the `app_name` is accurately defined, as it is used to match the offline indexer in online RAG.
5351

52+
## How to Use Help Documents to Enhance the AppAgent?
53+
54+
After creating the offline indexer, refer to the [Learning from Help Documents](../../ufo2/core_features/knowledge_substrate/learning_from_help_document.md) section for guidance on how to use the help documents to enhance the `AppAgent`.
5455

55-
### How to Use Help Documents to Enhance the AppAgent?
56+
## Related Documentation
5657

57-
After creating the offline indexer, you can find the guidance on how to use the help documents to enhance the `AppAgent` in the [Learning from Help Documents](../../ufo2/core_features/knowledge_substrate/learning_from_help_document.md) section.
58+
- [Overview: Enhancing AppAgent Capabilities](./overview.md) - Learn about all enhancement approaches
59+
- [User Demonstrations Provision](./demonstration_provision.md) - Teach through examples
60+
- [Wrapping App-Native API](./warpping_app_native_api.md) - Create efficient MCP action servers
61+
- [Knowledge Substrate Overview](../../ufo2/core_features/knowledge_substrate/overview.md) - Understanding the RAG architecture

documents/docs/tutorials/creating_app_agent/overview.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
# Enhancing AppAgent Capabilities
22

3-
UFO² provides a flexible framework for application developers and users to enhance `AppAgent` capabilities for specific applications. By providing additional knowledge and tools, you can significantly improve the `AppAgent`'s effectiveness in automating tasks within your applications.
3+
UFO² provides a flexible framework for application developers and users to enhance `AppAgent` capabilities for specific applications. AppAgent enhancement is about **augmenting** the existing AppAgent's capabilities through:
44

5-
!!!info "What is AppAgent Enhancement?"
6-
AppAgent enhancement is about **augmenting** the existing AppAgent's capabilities, not creating a new agent. You provide:
7-
- **Knowledge** (help documents, demonstrations) to guide decision-making
8-
- **Native API tools** (via MCP servers) for efficient automation
9-
- **Application-specific context** for better understanding
5+
- **Knowledge** (help documents, demonstrations) to guide decision-making
6+
- **Native API tools** (via MCP servers) for efficient automation
7+
- **Application-specific context** for better understanding
108

119
## Enhancement Components
1210

1311
The `AppAgent` can be enhanced through three complementary approaches:
1412

1513
| Component | Description | Tutorial | Implementation Guide |
1614
| --- | --- | --- | --- |
17-
| **[Help Documents](./help_document_provision.md)** | Provide application-specific guidance and instructions to help the agent understand tasks and workflows | This section | [Learning from Help Documents](../../ufo2/core_features/knowledge_substrate/learning_from_help_document.md) |
18-
| **[User Demonstrations](./demonstration_provision.md)** | Supply recorded user interactions to teach the agent how to perform specific tasks through examples | This section | [Learning from Demonstrations](../../ufo2/core_features/knowledge_substrate/learning_from_demonstration.md) |
19-
| **[Native API Tools](./warpping_app_native_api.md)** | Create custom MCP action servers that wrap application COM APIs or other native interfaces for efficient automation | This section | [Creating MCP Servers](../creating_mcp_servers.md) |
15+
| **[Help Documents](./help_document_provision.md)** | Provide application-specific guidance and instructions to help the agent understand tasks and workflows | [Provision Guide](./help_document_provision.md) | [Learning from Help Documents](../../ufo2/core_features/knowledge_substrate/learning_from_help_document.md) |
16+
| **[User Demonstrations](./demonstration_provision.md)** | Supply recorded user interactions to teach the agent how to perform specific tasks through examples | [Provision Guide](./demonstration_provision.md) | [Learning from Demonstrations](../../ufo2/core_features/knowledge_substrate/learning_from_demonstration.md) |
17+
| **[Native API Tools](./warpping_app_native_api.md)** | Create custom MCP action servers that wrap application COM APIs or other native interfaces for efficient automation | [Wrapping Guide](./warpping_app_native_api.md) | [Creating MCP Servers](../creating_mcp_servers.md) |
2018

2119
## Enhancement Workflow
2220

documents/docs/tutorials/creating_app_agent/warpping_app_native_api.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Wrapping Application Native APIs as MCP Action Servers
22

3-
!!!info "Modern Approach: MCP Servers"
4-
UFO² uses **MCP (Model Context Protocol) servers** to expose application native APIs to the AppAgent. This document shows you how to create custom MCP action servers that wrap your application's COM APIs, REST APIs, or other programmable interfaces.
3+
UFO² uses **MCP (Model Context Protocol) servers** to expose application native APIs to the AppAgent. This document shows you how to create custom MCP action servers that wrap your application's COM APIs, REST APIs, or other programmable interfaces.
54

65
## Overview
76

@@ -12,7 +11,7 @@ While AppAgent can automate applications through UI controls, providing **native
1211
| **UI Automation** | Slower | Prone to UI changes | Visual elements, dialogs, menus |
1312
| **Native API** | ~10x faster | Deterministic | Data manipulation, batch operations |
1413

15-
!!!success "Hybrid Automation"
14+
!!! tip "Hybrid Automation"
1615
AppAgent combines both approaches - the LLM intelligently selects **GUI tools** (from UIExecutor) or **API tools** (from your custom MCP server) based on the task requirements.
1716

1817
## Prerequisites
@@ -27,8 +26,6 @@ Before creating a native API MCP server:
2726

2827
### Step 1: Create Your MCP Server File
2928

30-
### Step 1: Create Your MCP Server File
31-
3229
Create a new Python file in `ufo/client/mcp/local_servers/` for your application's MCP server:
3330

3431
```python
@@ -80,8 +77,6 @@ def create_your_app_executor(process_name: str, *args, **kwargs) -> FastMCP:
8077

8178
### Step 2: Define Tool Methods with @mcp.tool()
8279

83-
### Step 2: Define Tool Methods with @mcp.tool()
84-
8580
Add tool methods to your MCP server using the `@mcp.tool()` decorator. Each tool wraps a native API call:
8681

8782
```python
@@ -383,10 +378,6 @@ def __app_root_mappping(self, app_root_name: str) -> Optional[str]:
383378

384379
Configure the MCP server for your application in `config/ufo/mcp.yaml`:
385380

386-
### Step 6: Register the MCP Server in mcp.yaml
387-
388-
Configure the MCP server for your application in `config/ufo/mcp.yaml`:
389-
390381
```yaml
391382
AppAgent:
392383
YOURAPP.EXE:
@@ -591,12 +582,24 @@ def apply_table_style(style_name: str) -> str:
591582

592583
## Related Documentation
593584

585+
**Core Tutorials:**
586+
594587
- **[Creating MCP Servers Tutorial](../creating_mcp_servers.md)** - Complete MCP server development guide
588+
- [Overview: Enhancing AppAgent Capabilities](./overview.md) - Learn about all enhancement approaches
589+
- [Help Document Provision](./help_document_provision.md) - Provide knowledge through documentation
590+
- [User Demonstrations Provision](./demonstration_provision.md) - Teach through examples
591+
592+
**MCP Documentation:**
593+
595594
- [MCP Configuration](../../mcp/configuration.md) - Registering MCP servers
596595
- [MCP Overview](../../mcp/overview.md) - Understanding MCP architecture
597596
- [WordCOMExecutor](../../mcp/servers/word_com_executor.md) - Reference implementation
598597
- [ExcelCOMExecutor](../../mcp/servers/excel_com_executor.md) - Reference implementation
598+
599+
**Advanced Features:**
600+
599601
- [Hybrid GUI–API Actions](../../ufo2/core_features/hybrid_actions.md) - How AppAgent chooses tools
602+
- [Knowledge Substrate Overview](../../ufo2/core_features/knowledge_substrate/overview.md) - Understanding the RAG architecture
600603

601604
---
602605

documents/docs/tutorials/creating_mcp_servers.md

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
This tutorial teaches you how to create, register, and deploy custom MCP servers for UFO² agents. You'll learn to build **local**, **HTTP**, and **stdio** MCP servers, and how to register them with different agents.
44

5-
!!!info "Prerequisites"
6-
- Basic Python knowledge
7-
- Familiarity with [MCP Overview](../mcp/overview.md)
8-
- Understanding of [MCP Configuration](../mcp/configuration.md)
9-
- Review [Built-in Local Servers](../mcp/local_servers.md) as examples
5+
**Prerequisites**: Basic Python knowledge, familiarity with [MCP Overview](../mcp/overview.md) and [MCP Configuration](../mcp/configuration.md). Review [Built-in Local Servers](../mcp/local_servers.md) as examples.
106

117
---
128

@@ -43,11 +39,11 @@ All MCP servers fall into two categories:
4339
| **Data Collection** | Read-only observation | ❌ No | ✅ Yes |
4440
| **Action** | State-changing execution | ✅ Yes | ❌ No |
4541

46-
!!!tip "Tool Selection"
47-
- **Data Collection tools**: Automatically invoked by the framework to build observation prompts
48-
- **Action tools**: LLM agent actively selects which tool to execute at each step
49-
50-
**Write clear docstrings and type annotations** - they become LLM instructions!
42+
**Tool Selection:**
43+
- **Data Collection tools**: Automatically invoked by the framework to build observation prompts
44+
- **Action tools**: LLM agent actively selects which tool to execute at each step
45+
46+
**Important**: Write clear docstrings and type annotations - they become LLM instructions!
5147

5248
---
5349

@@ -199,7 +195,7 @@ if __name__ == "__main__":
199195
200196
### Example: Application-Specific Server
201197
202-
Here's a real-world example - a server for Chrome browser automation:
198+
Here's a real-world example - a server for Chrome browser automation. For more details on wrapping application native APIs, see [Wrapping App Native API](creating_app_agent/warpping_app_native_api.md).
203199
204200
```python
205201
# File: ufo/client/mcp/local_servers/chrome_executor.py
@@ -412,18 +408,17 @@ python -m ufo.client.mcp.http_servers.my_http_server --host localhost --port 802
412408
python -m ufo.client.mcp.http_servers.my_http_server --host 0.0.0.0 --port 8020
413409
```
414410

415-
!!!tip "Background Execution"
416-
For production, run as a background service:
417-
418-
**Linux/macOS:**
419-
```bash
420-
nohup python -m ufo.client.mcp.http_servers.my_http_server --host 0.0.0.0 --port 8020 &
421-
```
422-
423-
**Windows:**
424-
```powershell
425-
Start-Process python -ArgumentList "-m", "ufo.client.mcp.http_servers.my_http_server", "--host", "0.0.0.0", "--port", "8020" -WindowStyle Hidden
426-
```
411+
**For production, run as a background service:**
412+
413+
**Linux/macOS:**
414+
```bash
415+
nohup python -m ufo.client.mcp.http_servers.my_http_server --host 0.0.0.0 --port 8020 &
416+
```
417+
418+
**Windows:**
419+
```powershell
420+
Start-Process python -ArgumentList "-m", "ufo.client.mcp.http_servers.my_http_server", "--host", "0.0.0.0", "--port", "8020" -WindowStyle Hidden
421+
```
427422

428423
### Step 3: Configure HTTP Server in mcp.yaml
429424

@@ -603,8 +598,7 @@ LinuxAgent:
603598
path: "/mcp"
604599
```
605600
606-
!!!success "Cross-Platform Workflow"
607-
Now your Windows UFO² agent can execute Linux commands remotely! The LLM will select `execute_command` or `get_system_info` as needed.
601+
**Cross-Platform Workflow**: Now your Windows UFO² agent can execute Linux commands remotely! The LLM will select `execute_command` or `get_system_info` as needed.
608602

609603
---
610604

@@ -954,11 +948,10 @@ AppAgent:
954948

955949
### 1. Write Comprehensive Docstrings
956950

957-
!!!tip "Docstrings → LLM Instructions"
958-
Your docstrings are **directly converted to LLM prompts**. The LLM uses them to understand:
959-
- **What** the tool does
960-
- **When** to use it
961-
- **How** to use it correctly
951+
Your docstrings are **directly converted to LLM prompts**. The LLM uses them to understand:
952+
- **What** the tool does
953+
- **When** to use it
954+
- **How** to use it correctly
962955

963956
**Bad Example:**
964957
```python
@@ -1259,12 +1252,13 @@ asyncio.run(test())
12591252

12601253
## Next Steps
12611254

1262-
Now that you've learned to create MCP servers:
1255+
Now that you've learned to create MCP servers, explore these related topics:
12631256

12641257
1. **Review Built-in Servers**: See [Local Servers](../mcp/local_servers.md) for production examples
12651258
2. **Explore HTTP Deployment**: Read [Remote Servers](../mcp/remote_servers.md) for cross-platform automation
12661259
3. **Understand Agent Configuration**: Study [MCP Configuration](../mcp/configuration.md) for advanced setups
1267-
4. **Create Your First Agent**: Follow [Creating App Agent](creating_app_agent/overview.md) to build custom agents
1260+
4. **Learn about Computer Class**: Review [Computer](../client/computer.md) to understand the MCP client integration
1261+
5. **Create Your First Agent**: Follow [Creating App Agent](creating_app_agent/overview.md) to build custom agents
12681262

12691263
---
12701264

@@ -1280,10 +1274,11 @@ Now that you've learned to create MCP servers:
12801274

12811275
---
12821276

1283-
!!!quote "Best Practices Summary"
1284-
- ✅ **Write clear docstrings** - they become LLM instructions
1285-
- ✅ **Use descriptive names** - for tools, parameters, and namespaces
1286-
- ✅ **Handle errors gracefully** - return structured error messages
1287-
- ✅ **Test in isolation** - before integrating with agents
1288-
- ✅ **Use `reset: true`** - for stateful servers (COM, API clients)
1289-
- ✅ **Validate connectivity** - for HTTP/Stdio servers before deployment
1277+
## Best Practices Summary
1278+
1279+
- ✅ **Write clear docstrings** - they become LLM instructions
1280+
- ✅ **Use descriptive names** - for tools, parameters, and namespaces
1281+
- ✅ **Handle errors gracefully** - return structured error messages
1282+
- ✅ **Test in isolation** - before integrating with agents
1283+
- ✅ **Use `reset: true`** - for stateful servers (COM, API clients)
1284+
- ✅ **Validate connectivity** - for HTTP/Stdio servers before deployment

0 commit comments

Comments
 (0)