Why Sphinx Is Different
Sphinx is a specialized data science agent that sees your entire working environment. When you send a prompt, Sphinx already knows:- Your notebook state — Every cell, its code, outputs, and execution status
- Your kernel state — All variables, dataframes, imports, and installed packages
- Your preferences — Rules you’ve configured and knowledge from past sessions
Sphinx works iteratively—it generates code, executes it, inspects the results, and continues until the task is complete. You don’t need to guide it step-by-step.
Core Principles
Focus on outcomes, not implementation
Sphinx knows how to write code. Tell it what you want to achieve, not how to achieve it.| Less Effective | More Effective |
|---|---|
| ”Create a pandas dataframe, merge it with the other table, then use matplotlib to create a bar chart" | "Show me a bar chart of total sales by region" |
| "Use sklearn to split the data 80/20, then fit a random forest classifier" | "Build a model to predict customer churn and validate its performance" |
| "Loop through each row and check if the date is valid" | "Find and fix any invalid dates in the orders table” |
Provide context that isn’t visible
Sphinx can see your data, but you should also share the context that is unique to your situation:- Business logic: “Revenue should exclude refunds and credits”
- Domain terminology: “A ‘whale’ is a customer with over $10k lifetime value”
- Data quirks: “The
statuscolumn uses legacy codes: 1=active, 2=churned, 3=paused” - Quality requirements: “This analysis is for the board—make visualizations presentation-ready”
Example: Adding context
Let Sphinx iterate
Sphinx validates its own work and refines its approach when needed. Avoid over-specifying every detail—give it room to explore and course-correct.| Over-specified | Better |
|---|---|
| ”Write a SQL query to join orders and customers on customer_id, filter where status=‘active’, group by region, and sum the totals…" | "Show me total orders by region for active customers" |
| "Load each CSV, check encodings, if that fails try latin-1, then concatenate and dedupe on id…" | "Combine all the CSV files in this folder into one dataset" |
| "Write a SQL query to join orders and customers on customer_id, filter where status=‘active’, group by region, and sum the totals…" | "Show me total orders by region for active customers” |
Structure complex requests clearly
For multi-part tasks, structure your request so Sphinx can track each component:Example: Multi-part request
Prompting Techniques
Different tasks benefit from different prompting styles:| Technique | When to Use | Example |
|---|---|---|
| Goal-oriented | Most tasks | ”Find the top 10 customers by lifetime value” |
| Constraint-based | Quality requirements | ”Exclude outliers beyond 3 standard deviations” |
| Comparative | Exploration and evaluation | ”Compare logistic regression vs random forest for this classification task” |
| Iterative refinement | After initial output | ”Make the legend more readable and use our brand colors” |
| Hypothetical | Testing assumptions | ”What would retention look like if we excluded the first 30 days?” |
Prompting for visualizations
Be specific about the chart’s purpose and audience:Good visualization prompts
Prompting for analysis
State the question you’re trying to answer:Good analysis prompts
Prompting for modeling
Define success criteria and validation approach:Good modeling prompts
Leveraging Built-in Features
Rules for persistent instructions
Use Rules to encode instructions that apply across sessions: SPHINX.md — Project-specific conventions in your workspace:- “Use type hints in all function definitions”
- “For all plots, ‘Palatino Linotype’ is the font that should be used”
- “Add docstrings to any functions you create”
Memories for persistent knowledge
Use Memories to capture knowledge that spans sessions:When to create memories
Choosing the right engine
Different engines suit different tasks:| Engine | Best For |
|---|---|
| Memphis (default) | Complex multi-step analysis, most general work |
| Cairo | Presentation-quality visualizations, thorough edge case handling |
| Siwa | Quick iterations, simple transformations, cost-sensitive work |
| Thebes | Extremely large notebooks requiring maximum context |
Guardrails for safety
Configure Guardrails to match your risk tolerance:- Strict mode: Approve all code before execution (best for production data)
- Standard mode: Approve potentially risky operations (default)
- Permissive mode: Minimal interruptions (best for exploratory work)