> ## Documentation Index
> Fetch the complete documentation index at: https://askmarvin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Building a Conversational Assistant

> Keep a conversation in a named thread

This command-line assistant keeps conversation history in a named thread. [Install and configure Marvin](https://askmarvin.ai/installation.md) first.

```python theme={null}
import marvin

assistant = marvin.Agent(
    name="Support",
    instructions="Answer briefly. Ask for missing details rather than inventing them.",
)
thread = marvin.Thread(id="support-demo")

while True:
    message = input("You: ").strip()
    if message.lower() in {"exit", "quit"}:
        break
    if message:
        response = assistant.say(message, thread=thread)
        print(response)
```

Restarting with the same thread ID and database resumes the history. Use a distinct thread ID for each conversation in an application.

The agent can refer to earlier messages in this thread. For facts that should be searchable across conversations, attach a [memory](https://askmarvin.ai/concepts/memory.md) with a persistent provider. A thread is enough for this example; the default vector-memory provider is ephemeral.

To expose external data, add a real Python function to the agent's `tools`. A prompt that asks for current weather or web research does not provide access to those sources.

For async applications, use `await assistant.say_async(message, thread=thread)`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.