core.history.conversation

Manage API-facing message history for provider SDK calls.

Manage API-facing message history for provider SDK calls.

class ConversationHistory[source]

Bases: object

API-facing message history for provider SDK calls.

Unlike PermanentHistory, turns here carry no timestamps and the history is intended to be cleared (e.g. when starting a new conversation context). The get_turns() output is structured for direct injection into provider message APIs.

add_turn_assistant(content)[source]

Append an assistant turn to the history.

Parameters:

content (str) – The assistant’s response text.

Return type:

None

add_turn_user(content)[source]

Append a user turn, coalescing with the previous user turn if adjacent.

Parameters:

content (str) – The user’s input text.

Return type:

None

get_turns()[source]

Return all turns formatted for provider message APIs.

Returns:

List of message dictionaries with role and content keys.

Return type:

list[dict[str, Any]]

Classes

class ConversationHistory[source]

Bases: object

API-facing message history for provider SDK calls.

Unlike PermanentHistory, turns here carry no timestamps and the history is intended to be cleared (e.g. when starting a new conversation context). The get_turns() output is structured for direct injection into provider message APIs.

add_turn_assistant(content)[source]

Append an assistant turn to the history.

Parameters:

content (str) – The assistant’s response text.

Return type:

None

add_turn_user(content)[source]

Append a user turn, coalescing with the previous user turn if adjacent.

Parameters:

content (str) – The user’s input text.

Return type:

None

get_turns()[source]

Return all turns formatted for provider message APIs.

Returns:

List of message dictionaries with role and content keys.

Return type:

list[dict[str, Any]]