26.09.2026 15:00
18

From a neuron to an AI agent: an interactive guide

I put together an interactive presentation about neural networks and AI agents. It starts with a single neuron and ends with an agent system. It's mainly for people without a technical background, though there are things to play with if you already use LLMs, too.

You can go through the slides or switch to reading mode, which adds explanations alongside the diagrams. Both Russian and English are available. If the main site doesn't load, there's a GitHub Pages mirror.

I decided to bring one of the examples into this post. Neural networks are often explained using diagrams full of circles and lines. Let's build something we can check with just four combinations of inputs.

What one neuron computes

Take two inputs, x₁ and x₂. Each can be 0 or 1. The neuron multiplies the inputs by their weights, adds the results and adds one more number, called the bias:

z = x₁ × w₁ + x₂ × w₂ + bias

Then we apply an “activation function”: if the sum is zero or positive, the output is 1. Otherwise it's 0. That's a threshold function. More complex networks use other activation functions, but this step function is enough for our example.

Suppose both weights are 1 and the bias is −1.5. With only one input switched on, the sum is −0.5, so the neuron outputs 0. With both inputs on, we get 0.5 and an output of 1. We've made an AND gate: the result is true when both inputs are true.

Here's the example from the presentation. Choose AND, OR or NOT, click the inputs and watch the sum and output change. Then switch to XOR: the network gets a little more interesting.

Logic gates built from neurons

Choose a gate and toggle the inputs between 0 and 1.

Truth table
x₁x₂ANDORNOT x₁XOR
000010
010111
100101
111100

The weights here are set by hand. This block doesn't train anything or send data anywhere. It just recalculates a few numbers in your browser.

Why this XOR network has three neurons

XOR outputs 1 when the inputs differ: 0, 1 or 1, 0. If they're the same, the result is 0. A single threshold neuron using a weighted sum of these two inputs can't do that. Plot the four input combinations on a plane and you can't separate the two positive cases from the two negative ones with a single straight line.

Let's add a hidden layer. One neuron computes OR: is at least one input on? Another computes AND: are both on? The output neuron receives those two results:

h₁ = OR(x₁, x₂)
h₂ = AND(x₁, x₂)
z = h₁ − 2 × h₂ − 0.5

With exactly one input on, h₁ = 1 and h₂ = 0, so the output sum is 0.5. We get 1. With both inputs on, the second neuron also activates and subtracts two from that sum. We get −1.5 and an output of 0. And with two zero inputs, the first neuron doesn't activate at all.

This is already a small network with three neurons, but all the calculations are logical and easy to follow.

Where the weights come from

Let's take another example. Here, we already know the numbers we need. But setting the weights between pixels and outputs by hand is inefficient, even if it is possible.

During training, a network is shown examples with known answers. Backpropagation computes how the weights affect the error, and an optimisation algorithm makes small adjustments. This process repeats across the dataset many times.

The next example in the presentation recognises digits on a 3×5 grid. You can change the pixels and watch the scores for all ten digits change. That network has 634 trainable parameters: 600 weights and 34 biases. For comparison, large language models can have hundreds of billions of parameters. DeepSeek-V3, for example, has 671 billion, with 37 billion activated for each token. The rest are also part of the network; they just are not used at every step.

The network recognises an eight on a 3×5 grid

15 input pixels and ten possible outputs. Try it in the presentation.

How this leads to an agent

The presentation then moves from numbers to text. Text is split into tokens, and tokens are turned into numerical representations. A Transformer uses attention to account for relationships between positions in the context. During generation, a language model computes a distribution for the next token, one option is selected, and the process repeats.

An attention matrix with token connections and masked future positions

Cell brightness shows a connection weight in one operation. Open the slide.

That alone doesn't run a terminal or edit files. It needs a surrounding program, called a harness. The harness sends the task and available tools to the model, executes the requested tool calls, returns their results and supports the next step. This gives us an agent that can read a project, make a change, run a test and see an error.

The Harness slide: a language model and the program around it

The program around the model. The harness slide.

There are separate sections on that loop, context, tools and my own workflow. The bonus section looks inside a Transformer, including the equations. It's there if you want to go deeper; you won't need it to play with the three neurons above.

The full presentation is here. I'd start with the XOR inputs: switch both on and see which neuron turns the result off.

Tags: AI
More exclusive content and real-time updates in my Telegram channel