File size: 752 Bytes
ceccf86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Declarative Tool Runner hooks for research activity narration."""

from __future__ import annotations

from fast_agent.hooks import HookContext

try:
    from .activity_narrator import activity_batch_from_hook, current_activity_narrator
except ImportError:  # loaded directly from the fast-agent home
    from research.activity_narrator import (
        activity_batch_from_hook,
        current_activity_narrator,
    )


async def capture_after_llm(ctx: HookContext) -> None:
    narrator = current_activity_narrator.get()
    if narrator is None:
        return
    try:
        narrator.observe(activity_batch_from_hook(ctx))
    except Exception:
        # Narration is presentation-only and must never affect the research loop.
        return