So far, the Kladde has asked language models for narrowly defined tasks: assess a tender, answer a question from the help pages. Every request had a fixed flow that your code determined. In this module, the Kladde gets an agent: a model that decides for itself which step to take next and may use tools of the Kladde to do so. By the end of the module, this agent drafts quotes for public tenders. It is only allowed to send them once a person has approved.

The module has six lessons and an exam:

  1. The first agent (this lesson): what an agent is, and the project Kladde.Agents.
  2. Tools and function calling: the agent reads contacts, tenders and day rates.
  3. Approvals: the agent drafts quotes, and sending needs a person's approval.
  4. Workflows: fixed steps, with the model only where it's needed.
  5. Memory: what the agent remembers beyond a session, and how it gets deleted again.
  6. Multiple agents: when a second agent helps and what it costs.

The examples in this module ran with these packages:

Package Version
Microsoft.Agents.AI 1.28.0
Microsoft.Agents.AI.Workflows (from lesson 4) 1.28.0
Microsoft.Extensions.AI, Microsoft.Extensions.AI.OpenAI 10.11.0
OpenAI 2.15.0
Microsoft.Extensions.Hosting, Microsoft.Extensions.Configuration, Microsoft.Extensions.DependencyInjection 10.0.14
xunit.v3.mtp-v2 4.0.2

What an agent is

An agent consists of four parts: a language model, instructions, tools and a loop. The loop sends the question to the model. If the model answers with a request to call a tool, the loop runs the tool and sends the result back. This goes on until the model writes an answer for the person. Which tool comes next, and in which order, is decided by the model, not by your code.

That is exactly the strength and the risk. An agent can handle questions nobody thought of while programming. But it can also choose a path nobody wanted: call a tool too often, call one with wrong values, or call one it doesn't need at all. Besides, every step of the loop is a model call and costs time and, in the cloud, tokens. So the first question isn't "How do I build an agent?" but "Do I need one here?"