Skip to main content
This workshop is a docs transcript of demos/enterprise/02_snippets_and_predicates.py and 03_agent_analysis_session.py. Live LLM analysis is optional (HVNB_RUN_LLM_DEMO=1).
You will register readonly SQL snippets and predicates, execute them through the database MCP profile, and simulate an agent analysis session. MCP tool-call logging is documented but not yet shipped on the current release base.

1. Prerequisites

Complete Data connection or ensure demos/data/warehouse.db exists:

2. Register Snippets and Predicates

Script: demos/enterprise/02_snippets_and_predicates.py Store readonly SQL as db-snippet rows and reusable filters as db-predicate rows:

3. Run Snippets Through the Database Profile

The database profile extends read/query tool groups and adds run_snippet and suggest_sql. It auto-enables the extension on first use:
Write snippets are refused unless heavenbase.database.allow_write=true in CM_HVNB (default false).

4. Agent Analysis Session

Script: demos/enterprise/03_agent_analysis_session.py Expose the database profile and simulate in-process agent calls:
Serve for external agents:
Optional live LLM analysis (requires provider credentials):
The script uses deepseek-v4-flash and attaches the database MCP toolkit to an LLMSession.

5. Session Logging (Planned)

MCP tool-call logging via heavenbase.mcp.log_sessions is specified in the prototype plan but not implemented on the current release base. CLI logging through hb llm chat and hb llm session is shipped today. When MCP logging lands, enterprise demo 03 documents three meta-analysis queries over agent-message rows:
  • Tool frequency — group by tool_name
  • Error rate — filter rows where error_flag is true
  • Slow calls — sort by duration_ms descending

Summary

  • Readonly db-snippet rows execute safely through the database profile; write access stays off by default.
  • suggest_sql searches snippets and predicates by card text without calling an LLM inside the engine.
  • Agents connect through MCP with a small, schema-aware tool surface scoped to db-* entities.

Further Exploration

Related resources: