RememberConversation
class RememberConversation
Methods
Record the steps a run completed before it died, so the tools it already ran are not lost with it.
Store the complete turn and apply its conversation ID after persistence succeeds.
Split a participant into the type and key it is stored under.
Determine whether this turn should be persisted.
Determine whether this turn belongs to a conversation, however it ended.
Determine whether this attempt needs to create a conversation.
Start an eligible title request alongside the main generation.
Details
at line 39
__construct(ConversationStore $store, TextProvider $provider)
Create a new middleware instance.
at line 48
static bool
appliesTo(Agent $agent)
Determine whether the given agent remembers its conversations.
at line 57
AgentResponse|StreamableAgentResponse
handle(AgentPrompt $prompt, Closure $next)
Handle the incoming prompt.
at line 168
protected void
rememberFailedTurn(AgentPrompt $prompt, Throwable $exception, string|null $pendingConversationId, bool $retryable = true)
Record the steps a run completed before it died, so the tools it already ran are not lost with it.
at line 204
protected StoredTurn
rememberTurn(AgentPrompt $prompt, AgentResponse $response, string|null $pendingConversationId, Throwable|null $exception = null)
Store the complete turn and apply its conversation ID after persistence succeeds.
at line 299
protected array
participantKeys(object|null $participant)
Split a participant into the type and key it is stored under.
at line 311
protected bool
shouldRemember(Agent $agent, AgentPrompt $prompt, AgentResponse $response)
Determine whether this turn should be persisted.
at line 322
protected bool
shouldRememberTurn(Agent $agent, AgentPrompt $prompt)
Determine whether this turn belongs to a conversation, however it ended.
at line 335
protected bool
startsConversation(AgentPrompt $prompt)
Determine whether this attempt needs to create a conversation.
at line 346
protected PendingConversationTitle|null
startConcurrentTitle(AgentPrompt $prompt)
Start an eligible title request alongside the main generation.
at line 372
protected string
generateTitle(AgentPrompt $prompt)
Generate a title for the conversation.