# Put an Agent Inside Your App in 10 Minutes or Less with the GitHub Copilot SDK - Daniel Ward

## Executive summary

This talk demonstrates how to rapidly embed custom AI agents into existing applications using the GitHub Copilot SDK. The session covers agent architecture—defining an agent as an LLM augmented with tools and a looping mechanism—and provides two coding demos (in C#) showing basic functionality like weather queries, streaming responses, and creating custom tools. For build engineers, the focus is on advanced use cases such as automated incident response (generating suggested fixes and opening Pull Requests from production logs) and building comprehensive daily briefing systems that integrate multiple enterprise services (Jira, Teams, GitHub).

## Key takeaways

- Agent Architecture: An AI agent is fundamentally an LLM combined with external tools and a looping mechanism. The LLM handles the creative analysis, while the tools allow it to perform deterministic actions (e.g., fetching web data or querying APIs).
- Copilot SDK Functionality: The Copilot SDK is an open-source library that allows calling GitHub Copilot (or other LLMs like Anthropic/OpenAI) from code. It supports multiple languages (TypeScript, Python, Go, C#, etc.) and provides granular control over sessions, including event handling (`onEvent`) for streaming responses.
- Automated Incident Response: A powerful use case is connecting production errors to automated fixes. The process involves the SDK collecting logs, using Copilot to suggest a fix based on stack traces, and then programmatically opening a draft Pull Request (PR).
- Reliability vs. Prompting: For repeatable, mission-critical workflows (like daily reports), using deterministic code with the SDK is significantly more reliable than relying solely on prompt chaining, as failures in a chain compound exponentially.

## Technical details

- SDK Initialization and Session Management: To start the process, initialize a `CopilotClient` and call `startAsync()`. A conversation is managed via a `Session`, which requires setting properties like the desired model (e.g., 'claude-sonnet-46') and configuring a permission request handler.
- Tool Calling Implementation: Custom tools are implemented by decorating standard functions with attributes (e.g., `[GetWeather]`). The SDK uses the `AIFunctionFactory.Create()` method to expose these C# functions, allowing Copilot to understand their purpose and required parameters via JSON schema.
- Advanced Session Control: Developers can monitor the process using event handlers (e.g., `onEvent`) for granular control over session state changes, such as receiving message deltas or tracking tool requests. For complex workflows, sessions can be 'forked' to maintain history while exploring different strategies.
- Multi-Provider Support: The SDK supports bringing your own key (BYOK), allowing developers to use local models, Anthropic, or OpenAI APIs without direct interaction with GitHub servers. This is managed by setting the `provider` property on the session config.

## Practical implications

- Automate complex enterprise workflows (e.g., daily status reports) that require synthesizing data from multiple sources (Jira, GitHub, Outlook).
- Implement proactive maintenance by having AI agents automatically suggest and open PRs for fixes upon detecting production errors.
- Build highly reliable applications where the AI component is contained within a deterministic code structure, minimizing risks associated with pure prompt chaining.

## Topics

AI Agents, GitHub Copilot SDK, LLM Integration, Tool Calling, Software Automation, CI/CD Enhancement, Copilot GitHub Repo

Source: https://www.youtube.com/watch?v=RetgcgSVa58
