module Riffer::Agent::Run
The generation loop — a pure module of functions over an agent, which owns every per-call value; Run just orchestrates.
Public Instance Methods
Source
# File lib/riffer/agent/run.rb, line 14 def generate(agent:, prompt: nil, files: nil, tags: {}) append_user_message(agent, prompt, files: files) run_loop(agent, tags: tags) end
Runs the generate loop for the given agent. See Riffer::Agent#generate for prompt/files semantics.
Source
# File lib/riffer/agent/run.rb, line 24 def stream(agent:, prompt: nil, files: nil, tags: {}) append_user_message(agent, prompt, files: files) # The enumerator body runs in its own fiber, where the fiber-local OTEL # context is empty — capture here so the run span parents to the caller's # trace. tags ride as an ordinary argument captured in the closure, so they # cross the fiber boundary without any re-propagation. trace_context = Riffer::Tracing.current_context Enumerator.new do |stream_yielder| Riffer::Tracing.with_context(trace_context) { run_loop(agent, tags: tags, stream_yielder: stream_yielder) } end end
Runs the streaming loop for the given agent. See Riffer::Agent#stream for prompt/files semantics.