MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / last_assistant_text

Function last_assistant_text

atomic-agent/src/transcript/condense.rs:151–158  ·  view source on GitHub ↗

Extract the agent's final response text from a transcript. Condenses the transcript and returns the text of the last assistant entry — what the agent said last. This is the fallback source for the session graph's `llm_response` node when the agent's stop payload does not carry the response itself. Returns `None` when the transcript has no assistant text.

(raw: &[u8], format: &str)

Source from the content-addressed store, hash-verified

149///
150/// Returns `None` when the transcript has no assistant text.
151pub fn last_assistant_text(raw: &[u8], format: &str) -> Option<String> {
152 condense_transcript(raw, format)
153 .into_iter()
154 .rev()
155 .find(|e| matches!(e.entry_type, EntryType::Assistant))
156 .and_then(|e| e.content)
157 .filter(|t| !t.trim().is_empty())
158}
159
160/// The transcript format produced by an agent's transcript file.
161///

Callers 1

inject_response_nodeMethod · 0.85

Calls 3

condense_transcriptFunction · 0.85
into_iterMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected