Skip to main content
Vrin supports multi-turn conversations where each query has access to the full conversation history. The client tracks session state automatically.

Start a conversation

client.start_conversation()
Resets the current session. Returns self for chaining:
result = client.start_conversation().continue_conversation("What is ACME's revenue?")

Continue a conversation

r1 = client.continue_conversation("What was ACME's Q4 revenue?")
r2 = client.continue_conversation("How does that compare to Q3?")
r3 = client.continue_conversation("What drove the difference?")
continue_conversation() is syntactic sugar for query() with maintain_context=True. All query() parameters are accepted as keyword arguments:
r = client.continue_conversation(
    "Explain the revenue trend",
    response_mode="thinking",
    stream=True,
)

Parameters

query
string
required
Natural-language question with automatic conversation context.
All additional keyword arguments are forwarded to query().

End a conversation

client.end_conversation()
Archives the current session ID to conversation_history_ids and clears the active session. Returns self for chaining.

Resume a previous conversation

client.resume_conversation("sess_abc123")
Sets the active session to an existing conversation ID. Subsequent continue_conversation() calls will include that conversation’s history.

Parameters

conversation_id
string
required
The session ID of a previous conversation to resume.

List conversations

conversations = client.list_conversations(limit=20)
for conv in conversations:
    print(f"{conv['session_id']}: {conv.get('title', 'Untitled')}")

Parameters

limit
int
default:"50"
Maximum number of conversations to return.

Get conversation history

history = client.get_conversation("sess_abc123")
# Returns full message history for the conversation

Delete a conversation

success = client.delete_conversation("sess_abc123")
# Returns True on success, False on failure
Performs a soft-delete. If the deleted conversation is the current active session, the session is cleared.

Rename a conversation

success = client.rename_conversation("sess_abc123", "Revenue Analysis")
# Returns True on success, False on failure

Full example

from vrin import VRINClient

with VRINClient(api_key="vrin_abc123") as client:
    # First conversation
    client.start_conversation()
    r1 = client.continue_conversation("What is ACME's Q4 revenue?")
    r2 = client.continue_conversation("Who is the CEO?")
    client.end_conversation()

    # Second conversation
    client.start_conversation()
    r3 = client.continue_conversation("Compare Widget Corp and ACME")
    client.end_conversation()

    # Review past conversations
    for conv_id in client.conversation_history_ids:
        history = client.get_conversation(conv_id)
        print(history)