Building an Agent with the Cline SDK - by Alex Pliutau
SubscribeSign in
Building an Agent with the Cline SDK<br>In this article, we will build a small release notes generator that uses the Cline SDK to inspect recent git history and turn it into readable markdown.
Alex Pliutau<br>May 29, 2026
Share
Cline is an open-source AI coding agent focused on real software work. Most developers first encounter Cline as an assistant in the editor or terminal, but Cline is broader than a single interface.<br>It has both a CLI and an SDK :<br>The CLI is for running agent workflows directly from the terminal
The SDK is for embedding the same agent runtime inside your own scripts, products, CI jobs, and internal tools
That distinction matters. In the Cline SDK launch post, the team explains that the original product started inside the VS Code extension, and over time the runtime became harder to separate from the IDE around it. The SDK is the answer to that problem: the agent runtime is treated as a shared service rather than an implementation detail hidden inside one app.<br>That is also why the SDK is more interesting than a thin API wrapper, the same runtime now powers Cline across the CLI and IDE surfaces, while staying open for other teams to embed in their own products. The low-level agent loop stays reusable, and the stateful runtime around it becomes more durable, portable, and product-agnostic.<br>The SDK documentation describes Cline SDK as an open-source TypeScript framework for building agentic applications. The launch post adds a few more important ideas:<br>Cline 2.0 is built as a layered TypeScript stack
teams can start with a small surface area and add more runtime pieces later
the runtime is extensible through tools, plugins, MCP servers, skills, and hooks
provider choice is not locked to one model vendor
That makes TypeScript the natural choice for a first project.<br>In this article, we will build a small release notes generator that uses the Cline SDK to inspect recent git history and turn it into readable markdown.
Why the Cline SDK is a good fit here
This release-notes project is small, but it matches the SDK well because it uses the part of Cline that matters most: the runtime for tool-using agents.<br>We are not trying to rebuild the whole Cline product. We are only borrowing the runtime shape:<br>define a focused tool
give that tool to an agent
let the agent inspect real project state
turn the result into a useful artifact
That pattern lines up closely with how the Cline team positions the SDK in the launch post: something you can embed in scripts, internal tools, CI workflows, and other product surfaces, not just in an IDE.<br>What we are building
The project exposes one command:<br>npm run draft-release -- --since 20
It does one job well:<br>start a Cline agent
give the agent one custom tool, get_recent_commits
let the tool read recent git history from the current repository
have the agent turn that data into release notes
print the result to stdout
The interesting part is not the CLI itself. The interesting part is the architecture: our application provides a narrow, useful capability, and the Cline runtime decides how to use it.<br>That is exactly the kind of problem the SDK is meant for. As the launch post puts it, the runtime is no longer supposed to live only inside one UI surface. It is something you can pull into your own stack.<br>Project structure
cline-demo/<br>├── .env.example<br>├── package.json<br>├── tsconfig.json<br>└── src/<br>├── git.ts<br>├── index.ts<br>└── prompt.ts<br>Setup
The Cline SDK requires Node.js 22+ .<br>Install dependencies:<br>cd cline-demo<br>npm install
Create your environment file:<br>cp .env.example .env
Then fill in your OpenAI key:<br>OPENAI_API_KEY=your_openai_api_key_here<br>OPENAI_MODEL=gpt-4.1-mini
This project uses Cline’s openai-native provider.<br>Run it from inside any git repository:<br>npm run draft-release -- --since 20
How the code works
src/index.ts
This is the entry point. It does three things:<br>parses the --since argument
creates the custom get_recent_commits tool
runs a Cline Agent and prints the final result
The core shape is intentionally small:<br>const agent = new Agent({<br>providerId: "openai-native",<br>modelId: process.env.OPENAI_MODEL ?? "gpt-4.1-mini",<br>apiKey,<br>systemPrompt: buildSystemPrompt(),<br>tools: [createRecentCommitsTool()],<br>maxIterations: 6,<br>})
const result = await agent.run(buildUserPrompt(parseSince(process.argv.slice(2))))<br>process.stdout.write(`${result.outputText.trim()}\n`)
This is the mental model to remember: your app defines tools, and Cline supplies the agent runtime .<br>In other words, we are not reimplementing agent orchestration ourselves. We are reusing the same idea Cline uses internally: a runtime that can reason, call tools, and produce a final artifact.<br>src/git.ts
This file keeps the repository access logic out of the main program.<br>It uses:<br>git log to collect recent commits
git show --name-only to collect changed file paths per commit
Each commit is returned as structured...