MCPcopy Index your code
hub / github.com/deepnote/deepnote / buildSystemPrompt

Function buildSystemPrompt

packages/runtime-core/src/agent-handler.ts:109–146  ·  view source on GitHub ↗
(
  notebookContext: string,
  integrations?: Array<{ id: string; name: string; type: string }>
)

Source from the content-addressed store, hash-verified

107}
108
109export function buildSystemPrompt(
110 notebookContext: string,
111 integrations?: Array<{ id: string; name: string; type: string }>
112): string {
113 let prompt = `You are a data science assistant working inside a Deepnote notebook. You can add code blocks and markdown blocks to the notebook.
114
115## Current notebook state
116
117${notebookContext}
118
119## Instructions
120
121- Use add_code_block to write and execute Python code. You will see the output.
122- Use add_markdown_block to add explanations, section headers, or documentation.
123- Analyze data step by step: load, explore, transform, visualize, summarize.
124- If a code block errors, read the error and try a different approach.
125- When you are done, provide a brief summary of what you did and found.
126- Be concise in markdown blocks. Prefer code that shows results over long explanations.`
127
128 if (integrations && integrations.length > 0) {
129 prompt += `
130
131## Available database integrations
132
133The following database integrations are configured and available. To query them,
134use add_code_block with the deepnote-toolkit SQL helper:
135
136\`\`\`python
137import deepnote_toolkit as dntk
138df = dntk.execute_sql("SELECT * FROM users LIMIT 10", "SQL_<INTEGRATION_ID>")
139\`\`\`
140
141Available integrations:
142${integrations.map(i => `- "${i.name}" (${i.type}, id: ${i.id})`).join('\n')}`
143 }
144
145 return prompt
146}
147
148export async function executeAgentBlock(block: AgentBlock, context: AgentBlockContext): Promise<AgentBlockResult> {
149 const openai = createOpenAI({

Callers 2

executeAgentBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected