interface ConversationStore

Methods

string|null
latestConversationId(string $participantType, string|int $participantId, string $agent)

Get the participant's most recent conversation ID with the given agent.

string
storeConversation(string|null $participantType, string|int|null $participantId, string $title, string|null $id = null)

Store a new conversation and return its ID.

string
storeUserMessage(string $conversationId, string|null $participantType, string|int|null $participantId, string $agent, UserMessage $message)

Store a new user message for the given conversation and return its ID.

string|null
storeAssistantMessage(string $conversationId, string|null $participantType, string|int|null $participantId, AgentPrompt $prompt, AgentResponse $response, Throwable|null $exception = null)

Store the assistant turn, folding a resume into the row it paused on, or null when nothing was stored.

getLatestConversationMessages(string $conversationId, int $limit)

Get the latest messages for the given conversation.

void
storeApprovalResults(string $conversationId, array $toolResults)

Durably record resolved approval results on the paused turn before the run continues.

Details

at line 23
string|null latestConversationId(string $participantType, string|int $participantId, string $agent)

Get the participant's most recent conversation ID with the given agent.

Parameters

string $participantType
string|int $participantId
string $agent

Return Value

string|null

at line 28
string storeConversation(string|null $participantType, string|int|null $participantId, string $title, string|null $id = null)

Store a new conversation and return its ID.

Parameters

string|null $participantType
string|int|null $participantId
string $title
string|null $id

Return Value

string

at line 35
string storeUserMessage(string $conversationId, string|null $participantType, string|int|null $participantId, string $agent, UserMessage $message)

Store a new user message for the given conversation and return its ID.

Parameters

string $conversationId
string|null $participantType
string|int|null $participantId
string $agent
UserMessage $message

Return Value

string

at line 42
string|null storeAssistantMessage(string $conversationId, string|null $participantType, string|int|null $participantId, AgentPrompt $prompt, AgentResponse $response, Throwable|null $exception = null)

Store the assistant turn, folding a resume into the row it paused on, or null when nothing was stored.

Parameters

string $conversationId
string|null $participantType
string|int|null $participantId
AgentPrompt $prompt
AgentResponse $response
Throwable|null $exception

the error the run died with, when it did not finish

Return Value

string|null

at line 49
Collection getLatestConversationMessages(string $conversationId, int $limit)

Get the latest messages for the given conversation.

Parameters

string $conversationId
int $limit

Return Value

Collection

at line 58
void storeApprovalResults(string $conversationId, array $toolResults)

Durably record resolved approval results on the paused turn before the run continues.

Parameters

string $conversationId
array $toolResults

Return Value

void

Exceptions

ApprovalMismatchException