{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Treasure Code","product_name":"Treasure Code","type":"markdown"},"seo":{"title":"tdx chat - AI Chat Interface | Treasure Data","description":"Chat with LLM agents via tdx CLI. Interactive AI conversations for data analysis and marketing automation.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]},"image":"/assets/og-image.ba836864a30434f560a4f7720f8a09019ad30ff828b20c5052ae933ba7121524.d7ef4821.png"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"chat-commands","__idx":0},"children":["Chat Commands"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Simplified command for chatting with LLM agents."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"basic-usage","__idx":1},"children":["Basic Usage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"tdx chat <message> [options]\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"options","__idx":2},"children":["Options"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Option"},"children":["Option"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Default"},"children":["Default"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--agent <name>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Chat with specific agent (requires ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--new"]},")"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["default agent"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--new"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Start a new chat session"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["-"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":3},"children":["Examples"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Simple chat (uses default agent)\ntdx chat \"Show me the top customers by revenue\"\n\n# Continue previous conversation (default behavior)\ntdx chat \"What about last quarter?\"\n\n# Start a new conversation\ntdx chat --new \"Tell me about data modeling best practices\"\n\n# Start new chat with specific agent (--agent requires --new)\ntdx chat --new \"Analyze churn\" --agent \"MyProject/Data Analyst\"\n\n# Set default agent for all new chats\ntdx use agent \"MyProject/My Agent\"\ntdx chat --new \"Question 1\"\ntdx chat \"Question 2\"  # Continues the chat started above\n\n# Verbose mode shows chat session ID\ntdx chat \"Hello\" --verbose\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-it-works","__idx":4},"children":["How It Works"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Default behavior"]},": Continues last chat session automatically"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Session persistence"]},": Last chat ID saved to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".cache/tdx/last_chat_id"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["--new flag"]},": Starts a fresh chat session"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["--agent"]},": Use specific agent for new chat (requires ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--new"]},", use \"Project/Agent\" format)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Default agent"]},": Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx use agent <name>"]}," to set a default agent for new chats"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"agent-selection-priority","__idx":5},"children":["Agent Selection Priority"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When starting a new chat, the agent is selected in this order:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--agent"]}," flag"]},": Explicitly specified agent (highest priority)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Session agent"]},": Set via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx use agent \"Project/Agent\""]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx use agent \"AgentName\""]}," (uses current llm_project)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cached default agent"]},": Previously used default agent"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Default haiku agent"]},": Auto-created default agent with claude-4.5-haiku"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"setting-default-agent","__idx":6},"children":["Setting Default Agent"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Set both project and agent at once\ntdx use agent \"MyProject/MyAgent\"\n\n# Or set project first, then agent name only\ntdx use llm_project \"MyProject\"\ntdx use agent \"MyAgent\"\n\n# Now new chats use this agent automatically\ntdx chat --new \"Question 1\"\ntdx chat \"Question 2\"  # Continues chat with same agent\n\n# Override with --agent for a specific new chat\ntdx chat --new \"Question 3\" --agent \"OtherProject/OtherAgent\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"interactive-chat-selector","__idx":7},"children":["Interactive Chat Selector"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tdx chats"]}," command provides an interactive interface for browsing and resuming chat sessions."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"usage","__idx":8},"children":["Usage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"tdx chats [options]\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"options-1","__idx":9},"children":["Options"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Option"},"children":["Option"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--last"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Show the most recent chat session"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"examples-1","__idx":10},"children":["Examples"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Open interactive chat selector\ntdx chats\n\n# Show the most recent chat session\ntdx chats --last\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The interactive selector allows you to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Browse all your chat sessions"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["View chat history"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Resume conversations"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related-commands","__idx":11},"children":["Related Commands"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/treasure-code/commands/llm"},"children":["LLM Commands"]}," - Manage projects, agents, and chat history"]}]}]},"headings":[{"value":"Chat Commands","id":"chat-commands","depth":1},{"value":"Basic Usage","id":"basic-usage","depth":2},{"value":"Options","id":"options","depth":2},{"value":"Examples","id":"examples","depth":2},{"value":"How It Works","id":"how-it-works","depth":2},{"value":"Agent Selection Priority","id":"agent-selection-priority","depth":3},{"value":"Setting Default Agent","id":"setting-default-agent","depth":3},{"value":"Interactive Chat Selector","id":"interactive-chat-selector","depth":2},{"value":"Usage","id":"usage","depth":3},{"value":"Options","id":"options-1","depth":3},{"value":"Examples","id":"examples-1","depth":3},{"value":"Related Commands","id":"related-commands","depth":2}],"frontmatter":{"seo":{"title":"tdx chat - AI Chat Interface | Treasure Data","description":"Chat with LLM agents via tdx CLI. Interactive AI conversations for data analysis and marketing automation.","image":"/assets/og-image.ba836864a30434f560a4f7720f8a09019ad30ff828b20c5052ae933ba7121524.d7ef4821.png"}},"lastModified":"2026-02-14T00:54:05.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/treasure-code/commands/chat","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}