Skip to content
saad.works
← Selected work
Personal project/2026

GeminiAgentKit

A .NET framework that turns ordinary C# methods into tools an LLM can call, handling schema generation and the function-calling loop.

  • .NET 10
  • C#
  • Gemini API
  • JSON Schema

The problem

Wiring C# code up as callable tools for Google's Gemini API means hand-writing JSON schemas and managing a multi-turn function-calling loop, all boilerplate that gets copied between projects.

Approach

  • Tools are plain methods marked with a [GeminiFunction] attribute and discovered automatically.
  • JSON schemas are generated recursively from C# types: primitives, enums, collections, nullables and nested objects.
  • The client owns conversation state via a caller-supplied ChatHistory, so one stateless client can run many independent conversations.
  • Typed responses are deserialized back into C# objects.

Outcome

  • Adding a tool is writing a method and an attribute: no schema by hand, no loop to manage.

Links

Working on something similar? Get in touch.