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

Function last_assistant_text

atomic-agent/src/transcript/condense.rs:161–168  ·  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

159///
160/// Returns `None` when the transcript has no assistant text.
161pub fn last_assistant_text(raw: &[u8], format: &str) -> Option<String> {
162 condense_transcript(raw, format)
163 .into_iter()
164 .rev()
165 .find(|e| matches!(e.entry_type, EntryType::Assistant))
166 .and_then(|e| e.content)
167 .filter(|t| !t.trim().is_empty())
168}
169
170/// The transcript format produced by an agent's transcript file.
171///

Callers 2

inject_response_nodeMethod · 0.85
response_textFunction · 0.85

Calls 3

condense_transcriptFunction · 0.85
into_iterMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected