async-repl-protocol

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Async REPL Protocol

异步REPL协议

When working with Agentica's async REPL harness for testing.
在使用Agentica的异步REPL测试工具时。

Rules

规则

1. Use
await
for Future-returning tools

1. 对返回Future的工具使用
await

python
content = await view_file(path)  # NOT view_file(path)
answer = await ask_memory("...")
python
content = await view_file(path)  # 不要写成view_file(path)
answer = await ask_memory("...")

2. Single code block per response

2. 每个响应仅包含单个代码块

Compute AND return in ONE block. Multiple blocks means only first executes.
python
undefined
计算和返回都要放在同一个代码块中。多个代码块的话,只有第一个会执行。
python
undefined

GOOD: Single block

正确:单个代码块

content = await view_file(path) return any(c.isdigit() for c in content)
content = await view_file(path) return any(c.isdigit() for c in content)

BAD: Split blocks (second block never runs)

错误:拆分代码块(第二个代码块永远不会执行)

content = await view_file(path)
content = await view_file(path)
undefined