ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""Compare the two sub-agent context-passing strategies (实验 4-4「对比效果」).
|
||||
|
||||
Spawns a sub-agent under BOTH `minimal` and `llm_generated` strategies on the
|
||||
SAME task and prints the difference (context tokens handed off, extra
|
||||
preparation cost, whether private data leaked, and each sub-agent's result).
|
||||
|
||||
Run:
|
||||
export OPENAI_API_KEY=your-openai-api-key # or OPENROUTER_API_KEY (default model: gpt-5.6-luna)
|
||||
python subagent_comparison.py
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Make the src/ modules importable (they use bare imports, matching quickstart).
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))
|
||||
|
||||
from subagent_tools import run_context_strategy_comparison # noqa: E402
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not os.getenv("OPENAI_API_KEY") and not os.getenv("OPENROUTER_API_KEY"):
|
||||
print("No LLM key set. Export OPENAI_API_KEY or OPENROUTER_API_KEY "
|
||||
"(universal fallback; default model: gpt-5.6-luna).")
|
||||
sys.exit(1)
|
||||
asyncio.run(run_context_strategy_comparison())
|
||||
Reference in New Issue
Block a user