The GitHub Copilot SDK lets you embed Copilot's agentic workflows directly into your apps, and it's available for Python, TypeScript, Go, and .NET.
TimeTrack is a desktop app built with the GitHub Copilot SDK (TypeScript) and Azure Cosmos DB. You can:
- ⏱️ Track time with a start/stop timer, projects, and tags
- 🗣️ Ask questions about your time data in plain English — Copilot generates and runs Cosmos DB SQL queries behind the scenes
- 📊 View reports and charts across multiple users
Here is a demo of the app in action:
If you want to try it yourself, the code is on GitHub. Works with Azure Cosmos DB or the vNext emulator — clone, configure, and npm start.
For local development, you don't need an Azure account. The Cosmos DB vNext emulator runs as a Docker container, so you can seed sample data and start querying right away.
Behind the Scenes
What makes this interesting is the SDK's tool calling. You define a tool using defineTool with a schema (powered by Zod), and Copilot decides when to call it. Here's what the core of it looks like:
const queryTool = defineTool("query_time_data", {
description: "Execute a read-only Cosmos DB SQL query against time entries",
parameters: z.object({
query: z.string().describe("Cosmos DB SQL query"),
}),
handler: async ({ query }) => {
// query is scoped to the user's partition key
const result = await runQuery(userId, query);
return JSON.stringify(result);
},
});
session = await client.createSession({
tools: [queryTool],
systemMessage: { mode: "replace", content: "..." },
});
When a user asks "what was my most productive day this week?", the model generates a SQL query, executes it against Cosmos DB (scoped to the user's partition key), and returns a conversational answer. If the generated SQL hits a Cosmos DB error — say, an unsupported ORDER BY on an aggregate alias — the error is returned to the model as a tool result. The model reads it, adjusts the query, and retries. This usually succeeds within 1–2 attempts, with no user intervention.
Here's the overall flow:
+--------------+ +----------------+ +-------------+
| Electron UI | --> | Copilot SDK | --> | Copilot CLI |
| (renderer) | | (main process)| | (sidecar) |
+--------------+ +----------------+ +------+------+
^ |
| tool call: query_time_data
| |
| +------v------+
| | Cosmos DB |
| +------+------+
| |
| result or error
| |
| +------v------+
| | Model |
| | (interpret) |
| +------+------+
| | |
| success? SQL error?
| | retry with
| | corrected SQL
| | |
+--- AI response <---------------+ (back to Cosmos DB)
Because the AI writes arbitrary SQL rather than picking from canned reports, the range of questions is wide. A few examples:
- Do I tend to work longer hours early in the week or late in the week?
- How does my Monday workload compare to Friday?
- Compare my total hours this week vs last week
- Rank my projects by total hours and show the percentage each represents
- Summarize my last two weeks in 3 bullet points
The app uses GPT-4.1 by default, but you can switch to any supported Copilot model — gpt-5, claude-sonnet-4.5, etc. — by setting COPILOT_MODEL in .env.
If you want to go beyond Copilot's model lineup entirely, the app supports BYOK (Bring Your Own Key). Point it at your own Azure AI Foundry deployment — set your endpoint, API key, and deployment name in .env and the SDK routes all AI calls to your model. The tool calling, session management, and agent runtime stay identical. You control the model, the billing, and the identity layer; the SDK provides the agentic infrastructure.
The app also has experimental support for local OpenAI-compatible servers (Ollama, Foundry Local), though results vary depending on the model's tool calling capabilities, and your environment setup (GPU, etc).
Try It Yourself
The full source code is on GitHub. You can run it with the Cosmos DB vNext emulator — no Azure account needed — seed sample data, and start asking questions in natural language. Swap in your own model via BYOK if you want full control over the AI layer.
The Copilot SDK is open source and available for TypeScript, Python, Go, and .NET. Check out the docs to see what else you can build with it.

Top comments (0)