# \donttest{
if (interactive()) {
# Start with default agent (intelligent terminal mode)
console_chat("openai:gpt-4o")
# Start in debug mode with full tool logs
console_chat("openai:gpt-4o", verbose = TRUE)
# Simple chat mode without tools
console_chat("openai:gpt-4o", agent = NULL)
# Start with an existing session
chat <- create_chat_session("anthropic:claude-3-5-sonnet-latest")
console_chat(chat)
# Start with a custom agent
agent <- create_agent("MathAgent", "Does math", system_prompt = "You are a math wizard.")
console_chat("openai:gpt-4o", agent = agent)
# Available commands in the chat:
# /quit or /exit - End the chat
# /save [path] - Save session to file
# /load [path] - Load session from file
# /model - Open the provider/model chooser
# /model [id] - Switch to a different model
# /model current - Show the active model
# /history - Show conversation history
# /stats - Show token usage statistics
# /clear - Clear conversation history
# /stream [on|off] - Toggle streaming mode
# /inspect [on|off] - Toggle inspect mode
# /inspect turn - Open overlay for the latest turn
# /inspect tool - Open overlay for a tool in the latest turn
# /inspect next - Move inspector overlay to the next tool
# /inspect prev - Move inspector overlay to the previous tool
# /inspect close - Close the active inspect overlay
# /debug [on|off] - Toggle detailed tool/thinking output
# /local [on|off]- Toggle local execution mode (Global Environment)
# /help - Show available commands
# /agent [on|off] - Toggle agent mode
}
# }
Run the code above in your browser using DataLab