# Few-Shot Examples for Agent Generation Below are examples of user descriptions and their corresponding configs. --- ## Example 1: Simple ReAct Agent **User**: "帮我做一个能分析 CSV 数据的 agent" ```yaml agentId: csv-data-analyzer name: CSV 数据分析助手 description: 读取 CSV 文件并进行数据分析、统计摘要和可视化建议 type: react model: provider: dashscope name: qwen3-max-2026-01-23 temperature: 0.3 maxTokens: 4096 systemPrompt: | 你是一个专业的 CSV 数据分析助手。 工作流程: 1. 使用 file 工具读取用户指定的 CSV 文件 2. 使用 shell 工具执行 Python 脚本进行数据分析 3. 输出分析报告,包括: - 数据概览(行数、列数、数据类型) - 统计摘要(均值、中位数、标准差) - 缺失值分析 - 关键发现和建议 工具调用格式: ```json {"tool": "file", "action": "read", "path": "data.csv"} {"tool": "shell", "command": "python3 -c 'import pandas as pd; ...'"} ``` 完成分析后使用 terminate 返回报告。 react: maxSteps: 10 observationEnabled: true toolTimeout: 30 memory: enabled: true strategy: local size: 20 ttl: 3600 mcp: localTools: - shell - file - terminate policy: mode: auto guard: dangerousCommandBlock: true highRiskConfirmation: true maxOutputLength: 5000 ``` --- ## Example 2: Chain Agent (Pipeline) **User**: "做一个翻译 agent,先翻译再校对再润色" ```yaml agentId: translate-polish-pipeline name: 翻译润色流水线 description: 三步翻译流水线:初译 → 校对 → 润色 type: chain model: provider: dashscope name: qwen3-max-2026-01-23 temperature: 0.5 maxTokens: 4096 systemPrompt: | 你是一个专业的多阶段翻译系统,通过三个步骤确保翻译质量。 chain: steps: - name: translate prompt: | 将以下文本翻译为 {target_language},保持原文含义和语气: {input} 直接输出翻译结果,不要添加说明。 outputParser: text - name: proofread prompt: | 校对以下翻译,检查并修正: - 语法错误 - 用词不当 - 漏译或误译 原文:{input} 翻译:{translate} 输出修正后的翻译。如无问题,原样输出。 outputParser: text - name: polish prompt: | 润色以下翻译,使其更加自然流畅,符合目标语言的表达习惯: {proofread} 只输出最终润色结果。 outputParser: text guard: validator: "len(x.strip()) > 10" retry: 1 memory: enabled: false mcp: localTools: - terminate policy: mode: auto guard: maxOutputLength: 10000 ``` --- ## Example 3: Agent with Online Search **User**: "我需要一个能上网搜索信息的调研助手" ```yaml agentId: web-research-assistant name: 网络调研助手 description: 能够搜索互联网信息并进行深度分析的调研助手 type: react model: provider: dashscope name: qwen3-max-2026-01-23 temperature: 0.5 maxTokens: 4096 systemPrompt: | 你是一个专业的调研助手,擅长通过搜索获取信息并进行分析。 工作流程: 1. 理解用户的调研需求 2. 制定搜索策略,分步查询 3. 对搜索结果进行去重、验证和整合 4. 输出结构清晰的分析报告 使用 terminate 输出最终报告。 react: maxSteps: 12 observationEnabled: true toolTimeout: 45 memory: enabled: true strategy: local size: 20 ttl: 7200 mcp: onlineTool: example-mcp-server: - everything_get_sum localTools: - terminate policy: mode: auto guard: validator: "len(x.strip()) > 50" retry: 2 app: mcp: custom: nodes: example-mcp-server: url: https://your-mcp-endpoint.example.com endpoint: /mcp/airouting headers: Authorization: "${MCP_AUTH_TOKEN}" ``` --- ## Example 4: Desktop Automation Agent **User**: "做一个能控制我电脑的全能助手" ```yaml agentId: desktop-automation name: 桌面自动化助手 description: 能直接操控电脑的全能型 AI 助手 type: react model: provider: anthropic name: claude-sonnet-4-20250514 temperature: 0.3 maxTokens: 2048 systemPrompt: | 你是一个运行在用户电脑上的自动化助手。 可用工具: - shell: 执行终端命令 - file: 读写文件 - browser: 打开网页 - app: 控制应用程序 - system: 查询系统信息 - screenshot: 截屏查看当前画面 工具调用格式: ```json {"tool": "shell", "command": "ls -la"} {"tool": "file", "action": "read", "path": "/path/to/file"} {"tool": "screenshot"} ``` 工作原则: 1. 执行命令前评估风险 2. 优先使用安全的只读操作 3. 修改文件前先备份 4. 完成后用 terminate 报告结果 react: maxSteps: 15 observationEnabled: true toolTimeout: 30 memory: enabled: true strategy: local size: 20 ttl: 3600 mcp: localTools: - shell - file - browser - app - system - screenshot - terminate policy: mode: auto guard: dangerousCommandBlock: true highRiskConfirmation: true maxOutputLength: 3000 ```