@@ -35,7 +35,7 @@ agent FriendlyBot {
3535| ` prompt ` | string | ** 是** | - | v0.5+ | Agent 的核心任务指令 |
3636| ` model ` | string | 否 | 默认模型 | v0.5+ | 指定使用的 LLM 模型 |
3737| ` memory ` | string | 否 | - | v0.5+ | 记忆模式:` persistent ` (持久化)等 |
38- | ` stream ` | boolean | 否 | false | v0.5 + | 是否启用流式输出 |
38+ | ` stream ` | boolean | 否 | false | v2.1 + | 是否启用流式输出 |
3939| ` cache ` | boolean | 否 | false | v0.5+ | 是否启用智能缓存 |
4040| ` experience ` | string | 否 | - | v0.5+ | 长期记忆文件路径 |
4141| ` fallback ` | string/list | 否 | - | v0.5+ | 备用模型配置 |
@@ -45,6 +45,10 @@ agent FriendlyBot {
4545| ` retry ` | int | 否 | 3 | v0.5+ | 失败重试次数 |
4646| ` requires ` | clause | 否 | - | v1.2+ | 前置条件契约条款 |
4747| ` ensures ` | clause | 否 | - | v1.2+ | 后置条件契约条款 |
48+ | ` output_format ` | string | 否 | - | v2.1+ | 输出格式约束,支持 ` "json" ` |
49+ | ` output_schema ` | dict | 否 | - | v2.1+ | JSON Schema → 编译器自动生成 Pydantic |
50+ | ` max_tool_calls ` | int | 否 | - | v2.1+ | 最大工具调用轮数 |
51+ | ` tool_call_strategy ` | string | 否 | ` "auto" ` | v2.1+ | ` "auto" ` /` "required" ` /` "none" ` |
4852
4953### 属性详细说明
5054
@@ -228,6 +232,59 @@ agent HighAvailabilityBot {
228232}
229233```
230234
235+ #### ` output_format ` / ` output_schema ` — 结构化输出 (v2.1+)
236+
237+ ``` nexa
238+ agent Planner {
239+ output_format: "json",
240+ output_schema: {
241+ steps: [{title: "string", description: "string"}],
242+ estimated_time: "string"
243+ }
244+ }
245+ ```
246+
247+ #### ` max_tool_calls ` / ` tool_call_strategy ` — 工具调用控制 (v2.1+)
248+
249+ ``` nexa
250+ agent Coder {
251+ max_tool_calls: 10,
252+ tool_call_strategy: "auto"
253+ }
254+ ```
255+
256+ | 策略值 | 含义 |
257+ | --------| ------|
258+ | ` "auto" ` | 模型自行判断(默认) |
259+ | ` "required" ` | 强制调用至少一个工具 |
260+ | ` "none" ` | 禁用所有工具调用 |
261+
262+ ---
263+
264+ ## 🔄 v2.0 基础执行原语
265+
266+ ### ` autoloop ` (E维度)
267+ ``` nexa
268+ autoloop max_steps: 10, exit_when: "任务完成", timeout: 300 {
269+ result = Agent.run(input)
270+ }
271+ ```
272+
273+ ### ` try_agent ` / ` catch_correction ` (E+L维度)
274+ ``` nexa
275+ try_agent {
276+ result = Agent.run(input)
277+ } catch_correction(e: ToolError) {
278+ reflect "工具执行失败,请调整参数重试"
279+ }
280+ ```
281+
282+ ### ` @tool ` 注解 (T维度)
283+ ``` nexa
284+ @tool("搜索网页内容")
285+ fn web_search(query: string): string { ... }
286+ ```
287+
231288---
232289
233290## 🎯 Agent 修饰器(Decorators)
0 commit comments