How vercel-labs/eve-data-analyst-template works
This repository is a Slack-based data analyst: a user asks a business question, the eve agent discovers schema and definitions, executes guarded read-only SQL against Postgres, and responds in the thread, optionally with a chart or table and a SQL record. The graph preserves documented safety, access, memory, and Slack reply capabilities. Source excerpts show the Slack channel setup, query logging, visualization posting, and memory scoping; several tool and analyst implementations are not excerpted, so their internal call links are omitted.
Main entry points: agent.ts Eve analyst agent · post.ts Visualization delivery · run_sql.ts SQL execution tool · channel.ts Slack channel adapter
Components 24
Conversation and agent
- Slack channel adapter
agent/lib/integrations/slack/channel.ts - Eve analyst agent
agent/agent.ts - Time instructions
agent/instructions/current-time.ts - Web search and fetch
agent/tools/web_search.ts
Analyst query runtime
- Schema lookup
agent/tools/describe_schema.ts - Schema descriptions
agent/lib/tools/describe-schema.ts - SQL execution tool
agent/tools/run_sql.ts - Read-only SQL runtime
agent/lib/analyst/postgres.ts - Postgres
- Cost approval policy
agent/lib/analyst/approval.ts - Query log
agent/lib/analyst/query-log.ts
Slack responses
- Approval card
agent/lib/analyst/approval-card.ts - SQL reply attachment
agent/lib/analyst/sql-attachment.ts - Chart tool
agent/tools/post_slack_chart.ts - Table tool
agent/tools/post_slack_table.ts - Visualization delivery
agent/lib/integrations/slack/visualizations/post.ts - Slack API
agent/lib/integrations/slack/api.ts - Slack thread
- Text replies
agent/lib/integrations/slack/replies.ts - Reply continuation
agent/lib/integrations/slack/reply-continuation.ts
Scoped memory
- User preferences
agent/memory/user-preferences.ts - Channel preferences
agent/memory/channel-preferences.ts - Memory scopes
agent/lib/memory/scope.ts
Other components
- Slack user
Connections 26
- Slack user → Slack channel adapter: asks question
- Slack channel adapter → Eve analyst agent: routes turn
- Eve analyst agent → Schema lookup: looks up schema
- Schema lookup → Schema descriptions: describes schema
- Eve analyst agent → SQL execution tool: invokes SQL
- SQL execution tool → Read-only SQL runtime: runs query
- Read-only SQL runtime → Postgres: reads data
- SQL execution tool → Cost approval policy: checks cost
- Cost approval policy → Approval card: requests approval
- Approval card → Slack channel adapter: registers input
agent/channels/slack.ts - SQL execution tool → Query log: records query
- Chart tool → Visualization delivery: posts chart
- Table tool → Visualization delivery: posts table
- Visualization delivery → Query log: reads turn queries
agent/lib/integrations/slack/visualizations/post.ts - Visualization delivery → SQL reply attachment: formats SQL
agent/lib/integrations/slack/visualizations/post.ts - Visualization delivery → Slack API: posts message
agent/lib/integrations/slack/visualizations/post.ts - Slack API → Slack thread: delivers blocks
- Eve analyst agent → Text replies: forms answer
- Text replies → Slack thread: replies in thread
- Eve analyst agent → User preferences: uses preferences
- Eve analyst agent → Channel preferences: uses preferences
- User preferences → Memory scopes: scopes by principal
agent/memory/user-preferences.ts - Channel preferences → Memory scopes: scopes by channel
agent/memory/channel-preferences.ts - Reply continuation → Query log: transfers queries
- Eve analyst agent → Time instructions: uses time context
- Eve analyst agent → Web search and fetch: network disabled