The split
| Agent | Schema access | Tools |
|---|---|---|
| Analyst | public (read-only via default_transaction_read_only=on) | SQLTools(read_only=True), introspect_schema, save_validated_query, ReasoningTools |
| Engineer | public (read), dash (read+write, blocked from public writes via SQLAlchemy event listener) | SQLTools (full), introspect_schema, update_knowledge, ReasoningTools |
| Leader | None directly | Routes the request, optional SlackTools for posting back |
public. These hold even if the model goes off-script.
How a question flows
- User: “What’s our MRR trend by plan?”
- Leader retrieves shared learnings (error patterns, gotchas) and routes to Analyst.
- Analyst retrieves table metadata + matching query patterns from knowledge.
- Analyst writes SQL grounded in the retrieved patterns.
- Analyst executes against
public(read-only). - Analyst interprets results, returns insight.
- Leader synthesizes and replies.
dash.monthly_mrr_by_plan as a view, records it in knowledge, the Analyst prefers it next time.
The self-learning loop
When the Analyst hits a SQL error and finds a fix, it saves the pattern viaLearningMachine:
- Knowledge holds the validated query library, table descriptions, business rules.
- Learnings holds the error patterns and fixes the team has discovered.
- The Analyst writes correct SQL faster because both are in context.
Why coordinate mode
TeamMode.coordinate means the leader decides who handles each request. Other modes:
| Mode | Behavior |
|---|---|
coordinate | Leader routes to one specialist per turn |
route | Same, but with explicit routing rules |
broadcast | Leader sends to all specialists, gathers responses |
tasks | Leader breaks the request into tasks, fans out, synthesizes |
coordinate is the right shape. One question maps to one specialist (Analyst for queries, Engineer for schema work). The leader picks based on the user’s intent.
What runs where
| File | Purpose |
|---|---|
agents/dash/team.py | Team definition, leader instructions |
agents/dash/agents/analyst.py | Read-only Analyst |
agents/dash/agents/engineer.py | Schema-managing Engineer |
agents/dash/knowledge/ | Loaded at boot via load_knowledge.py |
agents/dash/scripts/load_data.py | Generates the synthetic SaaS dataset |
See it in action
agents/dash/