Files
gemini-cli/packages/sdk
mkorwel 31ebfb496a feat(core): implement tool preselection to reduce context size
- Created ToolPreselectionService using the classifier model to select only relevant tools for a given prompt.
- Integrated pre-selection into LocalAgentExecutor and GeminiClient to automatically filter the tool registry.
- Added `general.toolPreselection` toggle in configuration (enabled by default).
- Added comprehensive unit tests and an E2E scenario confirming accurate tool reduction without loss of function.
- Fixes #17113
2026-02-19 14:27:18 -06:00
..

@google/gemini-cli-sdk

The Gemini CLI SDK provides a programmatic interface to interact with Gemini models and tools.

Installation

npm install @google/gemini-cli-sdk

Usage

import { GeminiCliAgent } from '@google/gemini-cli-sdk';

async function main() {
  const agent = new GeminiCliAgent({
    instructions: 'You are a helpful assistant.',
  });

  const controller = new AbortController();
  const signal = controller.signal;

  // Stream responses from the agent
  const stream = agent.sendStream('Why is the sky blue?', signal);

  for await (const chunk of stream) {
    if (chunk.type === 'content') {
      process.stdout.write(chunk.value.text || '');
    }
  }
}

main().catch(console.error);