MCPcopy Create free account

hub / github.com/bojieli/ai-agent-book / functions

Functions13,003 in github.com/bojieli/ai-agent-book

↓ 2 callersFunctionrun_scenario
跑一遍 8 轮客服退款任务,两个开关正交组合出 2×2 中的一格。 两组做的是同样的逻辑工作,只在上下文构造上不同,因此成本差异纯粹来自 KV-cache 复用与上下文压缩这两个输入侧杠杆。
chapter7/agent-cost-analysis/agent.py:230
↓ 2 callersMethodrun_scenario
Run a complete LOCOMO scenario.
chapter3/mem0/experiment.py:199
↓ 2 callersFunctionrun_sequential
( sites: List[Website], target: str, browsers: BrowserPool, timeout: float, browser_receip
chapter10/parallel-web-research/agents.py:368
↓ 2 callersFunctionrun_server
Run the API server.
chapter3/structured-index/api_service.py:377
↓ 2 callersFunctionrun_shards
(repo: str, shards: list[dict], token: str, *, pages: int, workers: int)
scripts/gen_star_history.py:234
↓ 2 callersFunctionrun_single_test
Run a single live manual case Args: test_name: Name of manual case to run
chapter1/search-codegen/tests/manual/agent_cases.py:321
↓ 2 callersMethodrun_task
Launch the task in a background worker.
chapter9/browser-use-rpa/browser-use/browser_use/cli.py:852
↓ 2 callersFunctionrun_test_command
(repo: Path, command: list[str], timeout: int = 30)
chapter7/model-action-threshold/experiment.py:195
↓ 2 callersFunctionrun_tests
对 parse_fn 跑一组断言,返回 {passed: bool, report: str, results: [...]}。 通过条件(对每一条样本都要满足): 1. parse_fn(line) 不抛异常; 2. 返回值是非空 dict; 3. r
chapter5/adaptive-log-parser/tester.py:17
↓ 2 callersMethodrun_tests
冒烟测试:把文件跑起来,验证 import / 主流程不崩溃。
chapter10/staged-system-prompt/tools.py:97
↓ 2 callersFunctionrun_with_ablation
Run tau-bench with ablation modifications
chapter2/prompt-engineering/run_ablation.py:238
↓ 2 callersFunctionsafe
(text: str)
chapter9/hermes-self-evolution/finalize_evidence.py:42
↓ 2 callersFunctionsafe_regular_file
(path: Path, root: Path)
scripts/clean_site_files.py:51
↓ 2 callersFunctionsamePassage
(a: Annotation, b: Annotation)
web-astro/src/lib/annotations.ts:102
↓ 2 callersFunctionsame_row_regions
Return horizontal limits inferred from neighbouring labels on each row.
book-vi/fix_svg_text_layout.py:241
↓ 2 callersFunctionsandbox_hash
(root: Path)
chapter2/system-hint/run_experiment_2_8.py:50
↓ 2 callersFunctionsandbox_image
Return an operator-supplied image or the content-addressed local image.
chapter9/self-modifying-agent/candidate_sandbox.py:34
↓ 2 callersMethodsanitize_text
Replace PII values with [REDACTED] in the text Returns: - Sanitized text - Number of replacements ma
chapter3/log-sanitization/agent.py:250
↓ 2 callersFunctionsaveEvent
(event)
chapter6/phone-agent/static/app.js:46
↓ 2 callersFunctionsave_article
Append article to disk with a hash for future dedup.
chapter9/browser-use-rpa/browser-use/examples/apps/news-use/news_monitor.py:188
↓ 2 callersMethodsave_checkpoint
把当前状态写入检查点文件(JSON),返回文件路径。
chapter6/async-agent/runtime.py:384
↓ 2 callersFunctionsave_evidence
把一轮真实调用的全部回执写入 validation/<run>/evidence.json 并更新 latest.json。
chapter8/premature-completion-dpo/llm_client.py:83
↓ 2 callersFunctionsave_evidence
Persist direct receipts and fail-closed manuscript acceptance gates.
chapter10/multi-role-transfer/demo.py:190
↓ 2 callersMethodsave_history
Save conversation history to storage
chapter3/user-memory/conversation_history.py:76
↓ 2 callersMethodsave_index
Save the knowledge graph index to disk.
chapter3/structured-index/graphrag_indexer.py:522
↓ 2 callersFunctionsave_json
(path: Path, obj: Any)
chapter1/image-gen-workflow/main.py:79
↓ 2 callersMethodsave_metrics
Save all metrics and summary to files
chapter3/log-sanitization/metrics.py:127
↓ 2 callersMethodsave_results
(self, ad_content: bytes, prompt: str, analysis: str, url: str, timestamp: str)
chapter9/browser-use-rpa/browser-use/examples/apps/ad-use/ad_generator.py:256
↓ 2 callersMethodsave_sanitized_log
Save sanitized logs to output directory
chapter3/log-sanitization/agent.py:351
↓ 2 callersFunctionsave_user_config
Save command history only (config is saved via the new system).
chapter9/browser-use-rpa/browser-use/browser_use/cli.py:157
↓ 2 callersFunctionscore
(case: dict[str, Any], parsed: dict[str, Any])
chapter7/user-memory-policy-eval/runner.py:161
↓ 2 callersMethodscore
( self, instruction: str, text: str, min: int, max: int, examp
chapter2/prompt-engineering/tau_bench/model_utils/api/api.py:361
↓ 2 callersMethodscore
(self, query_tokens: List[str], idx: int)
chapter3/contextual-retrieval-for-user-memory/contextual_compare.py:68
↓ 2 callersMethodscore_document
Calculate total BM25 score for a document given query terms
chapter3/sparse-embedding/bm25_engine.py:330
↓ 2 callersFunctionscore_text
用 LLM judge 对全部 active 规则一次性打分。
chapter9/ai-style-skill/judge.py:171
↓ 2 callersFunctionscratch_blueprint
()
chapter5/agent-creator/test_creator.py:77
↓ 2 callersFunctionscrub_secret
(text: str, secret: str)
chapter6/computer-use-open-model/main.py:61
↓ 2 callersMethodsearch
(self, need: str, top_k: int = DISCOVERY_TOP_K)
chapter4/active-tool-discovery/run_exact_experiment.py:269
↓ 2 callersMethodsearch
(self, query: str, top_k: int)
chapter3/memory_rag_campaign.py:128
↓ 2 callersMethodsearch
Search for documents.
chapter3/retrieval-pipeline/test_client.py:29
↓ 2 callersMethodsearch
Search for documents.
chapter3/retrieval-pipeline/demo.py:29
↓ 2 callersMethodsearch
Search for similar documents.
chapter3/dense-embedding/test_client.py:28
↓ 2 callersMethodsearch_cards
Search memory cards by query. Args: query: Search query Returns: List of (memor
chapter3/contextual-retrieval-for-user-memory/advanced_memory_manager.py:241
↓ 2 callersMethodsearch_history
Search conversation history Args: query: Search query limit: Maximum number of results
chapter3/user-memory/conversation_history.py:145
↓ 2 callersFunctionsearch_impl
把模型给出的关键词交给 Parallel,返回供下一轮引用的资料。
chapter1/web-search-agent/parallel_search.py:24
↓ 2 callersFunctionsearch_location
Search for locations using Nominatim (OpenStreetMap) API (free, no API key required). Args: query: Location query (e.g., "Eiffel
chapter4/perception-tools/src/public_data_tools.py:660
↓ 2 callersMethodsearch_memories
Search memories by query
chapter3/user-memory/memory_manager.py:115
↓ 2 callersMethodsearch_memory
Search user memory for relevant information Args: query: Natural language search query top_k: Number
chapter3/contextual-retrieval-for-user-memory/tools.py:46
↓ 2 callersFunctionsearch_poi
Search for Points of Interest (POI) near a location using Overpass API (OpenStreetMap). Free, no API key required. Args: que
chapter4/perception-tools/src/public_data_tools.py:761
↓ 2 callersFunctionsearch_url
Extract specific content from a target URL. Args: url: Target URL to extract from query: What specific content to look for depth: H
chapter9/browser-use-rpa/browser-use/examples/cloud/05_search_api.py:86
↓ 2 callersMethodsearch_web
Search the web using Serper API Args: query: Search query num_results: Number of results to return
chapter2/context-compression/web_tools.py:38
↓ 2 callersFunctionselect_memory_mode_interactive
Interactively prompt the user to select a memory mode Returns: Selected MemoryMode
chapter3/user-memory/main.py:771
↓ 2 callersFunctionselect_mode_interactive
Interactive mode selection menu Returns: Selected mode string or None for all modes
chapter2/kv-cache/main.py:324
↓ 2 callersFunctionsend
(event)
chapter6/astra-async-steering/experiment.py:258
↓ 2 callersFunctionsend
(event)
chapter6/astra-async-steering/validation/runs/pilot-20260905-v1/source/experiment.py:243
↓ 2 callersFunctionsend
(event)
chapter6/astra-async-steering/validation/runs/exp6-14-20260905-formal/source/experiment.py:258
↓ 2 callersFunctionsend
(event)
chapter6/astra-async-steering/validation/runs/pilot-20260905-v2/source/experiment.py:243
↓ 2 callersFunctionsendControl
(event)
chapter6/phone-agent/static/app.js:58
↓ 2 callersFunctionseparator
(left, right)
web-astro/scripts/chapter3-figure-kit.mjs:71
↓ 2 callersFunctionsequence
(k, y, stages, name)
web-astro/scripts/computer-use-layout.mjs:30
↓ 2 callersMethodserialize
(message: UserMessage)
chapter9/browser-use-rpa/browser-use/browser_use/llm/groq/serializer.py:102
↓ 2 callersMethodserialize_accessible_elements
(self)
chapter9/browser-use-rpa/browser-use/browser_use/dom/serializer/serializer.py:77
↓ 2 callersFunctionserialize_arm
Convert an agents.py arm result into credential-free checkpoint JSON.
chapter10/book-translation/run_official_experiment.py:465
↓ 2 callersMethodserialize_messages
Serialize a list of messages, extracting any system message. Returns: Tuple of (bedrock_messages, system_message) where system_message is ext
chapter9/browser-use-rpa/browser-use/browser_use/llm/aws/serializer.py:237
↓ 2 callersMethodserve
(self)
chapter6/async-agent/runtime.py:183
↓ 2 callersFunctionsetState
(state: 'pending' | 'ok' | 'failed')
web-astro/src/scripts/machine-translation.ts:80
↓ 2 callersMethodset_index
Overwrite the index of the action
chapter9/browser-use-rpa/browser-use/browser_use/tools/registry/views.py:62
↓ 2 callersMethodset_multimodal_tools_enabled
Keep the multimodal tool state in sync.
chapter4/multimodal-agent/agent.py:330
↓ 2 callersFunctionset_receipt_path
(path: Path)
chapter10/generative-agents/run_campaign.py:236
↓ 2 callersFunctionset_timer
Set a timer that will notify when completed. Args: duration_seconds: How long to wait before timer expires timer_name: Option
chapter4/collaboration-tools/src/timer_tools.py:18
↓ 2 callersFunctionset_xhtml_direction
(data, language="ar")
flatten_epub_toc.py:95
↓ 2 callersFunctionsetup
()
chapter5/permission-embedded-data-objects/pedo/eval/enterprise_agent_scenarios.py:60
↓ 2 callersMethodsetup_event_bus_listener
Setup listener for browser session event bus.
chapter9/browser-use-rpa/browser-use/browser_use/cli.py:744
↓ 2 callersFunctionsetup_hiring_pedo
Create hiring test data in PEDO store.
chapter5/permission-embedded-data-objects/pedo/eval/dataguardbench/harness.py:293
↓ 2 callersFunctionsetup_hiring_raw
Create hiring test data in raw database.
chapter5/permission-embedded-data-objects/pedo/eval/dataguardbench/harness.py:261
↓ 2 callersMethodsetup_oauth_credentials
Guide user through OAuth credentials setup process. Returns True if setup is successful.
chapter9/browser-use-rpa/browser-use/examples/integrations/gmail_2fa_integration.py:80
↓ 2 callersFunctionsetup_pedo_test_data
Create test data in PEDO store and return IDs.
chapter5/permission-embedded-data-objects/pedo/eval/benchmark_safety_final.py:168
↓ 2 callersFunctionsetup_trigger_tables
Set up tables with PostgreSQL AFTER triggers implementing the same logic.
chapter5/permission-embedded-data-objects/pedo/eval/benchmark_reactions.py:30
↓ 2 callersFunctionsha256
(path: Path)
chapter7/user-memory-policy-eval/runner.py:198
↓ 2 callersFunctionsha256
(path: pathlib.Path)
chapter5/provider-failover/summarize.py:16
↓ 2 callersFunctionsha256
(path: Path)
chapter5/adaptive-log-parser/campaign.py:60
↓ 2 callersFunctionsha256
(path: Path)
chapter8/speech-sft-experiment/analyze_campaign.py:22
↓ 2 callersFunctionsha256
(path: Path)
chapter8/speech-sft-experiment/run_orpheus.py:47
↓ 2 callersFunctionsha256
(path: Path)
chapter8/speech-sft-experiment/run_sesame.py:44
↓ 2 callersFunctionsha256
(path: Path)
chapter6/phone-agent/verify_acceptance.py:76
↓ 2 callersFunctionsha256
(path: Path)
chapter6/controllable-tts/evaluate_audio_quality.py:58
↓ 2 callersFunctionsha256
(path: Path)
chapter10/book-translation/run_official_experiment.py:34
↓ 2 callersFunctionsha256_bytes
(value: bytes)
chapter6/claude-computer-use-native/run_weather_task.py:44
↓ 2 callersFunctionsha256_bytes
(value: bytes)
chapter2/attention_visualization/run_status_bar_experiment.py:27
↓ 2 callersFunctionsha256_bytes
(data: bytes)
chapter2/local_llm_serving/run_experiment.py:35
↓ 2 callersFunctionsha256_bytes
(value: bytes)
chapter2/prompt-injection/run_campaign.py:32
↓ 2 callersFunctionsha256_file
(path: Path)
chapter7/model-action-threshold/experiment.py:145
↓ 2 callersFunctionsha256_file
(path: Path)
chapter8/MiniMind-pretrain/validation/validate_vlm_evidence.py:41
↓ 2 callersFunctionsha256_file
(path: Path)
chapter8/MiniMind-pretrain/validation/validate_evidence.py:52
↓ 2 callersFunctionsha256_file
(path: Path)
chapter8/continued-pretraining/validation/validate_evidence.py:31
↓ 2 callersFunctionsha256_file
(path: Path)
chapter6/streaming-speech/test_official_experiment.py:11
↓ 2 callersFunctionsha256_file
(path: Path)
chapter6/phone-agent/speech.py:23
↓ 2 callersFunctionsha256_file
(path: Path)
chapter2/prompt-injection/run_campaign.py:36
↓ 2 callersMethodshort
给日志用的紧凑单行表示。
chapter10/parallel-web-research/message_bus.py:54
↓ 2 callersFunctionsimulate_battles
Simulate `num_battles` random pairwise battles. For each battle two distinct models are drawn uniformly at random. With probability `tie
chapter7/elo-leaderboard/battle_simulator.py:37
← previousnext →2,701–2,800 of 13,003, ranked by callers