Building a Custom AI Assistant
Design and build your own AI personal assistant from the ground up. Choose the right model, craft an effective system prompt, define personality traits, and architect the integration layer that connects your assistant to the real world.
Choosing the Right Model
Your model choice depends on your requirements for speed, capability, and cost:
| Use Case | Recommended Model | Why |
|---|---|---|
| General assistant | Claude Sonnet 4, GPT-4o | Good balance of speed, cost, and capability |
| Complex reasoning | Claude Opus 4, o3 | Best for multi-step planning and analysis |
| Quick responses | Claude Haiku, GPT-4o-mini | Fast and cheap for simple queries |
| Privacy-focused | Llama 3.3 70B (self-hosted) | Full data control, no external API calls |
| Multimodal | GPT-4o, Gemini 2.5 Pro | Strong vision + audio capabilities |
Crafting the System Prompt
The system prompt defines your assistant's behavior, personality, and capabilities. A well-crafted system prompt includes:
- Identity: Who the assistant is, what it does, and what it does not do
- Personality traits: Communication style, tone, verbosity level, humor
- User context: Information about the user (preferences, timezone, communication style)
- Tool instructions: How and when to use available tools and integrations
- Boundaries: What the assistant should refuse or redirect (safety, privacy, scope)
# Personal Assistant System Prompt You are Alex, a personal AI assistant for [User Name]. ## Personality - Concise and direct, but warm - Proactive: suggest actions, not just information - Remember and reference past conversations - Use the user's preferred name and communication style ## Context - Timezone: [User's timezone] - Work schedule: [User's typical hours] - Communication preference: [Brief/detailed] ## Tools Available - Calendar: read/write events - Email: read/draft/send - Web search: research topics - Notes: save and retrieve information ## Guidelines - Always confirm before sending emails or creating events - Summarize long content unless asked for details - If uncertain, ask for clarification rather than guessing
Architecture Design
A practical personal assistant architecture has these layers:
Interface Layer
How users interact: web UI, mobile app, voice interface, messaging platform (Slack, Discord, Telegram), or CLI.
Orchestration Layer
Manages conversation flow, routes to the right model, handles tool calls, and maintains session state.
LLM Layer
The AI models that process requests. Can be a single model or multiple models for different task types.
Tool Layer
Integrations with external services: calendar APIs, email APIs, web search, databases, smart home APIs.
Memory Layer
Persistent storage for conversation history, user preferences, and knowledge. Covered in detail in Lesson 5.
Building the Core Loop
import anthropic client = anthropic.Anthropic() def run_assistant(user_message, conversation_history, tools): # Add user message to history conversation_history.append({ "role": "user", "content": user_message }) # Call the LLM with tools response = client.messages.create( model="claude-sonnet-4-20250514", system=system_prompt, messages=conversation_history, tools=tools, max_tokens=4096 ) # Handle tool use if needed while response.stop_reason == "tool_use": tool_results = execute_tools(response) conversation_history.append(response) conversation_history.append(tool_results) response = client.messages.create(...) return response.content
Lilly Tech Systems