Photo: Mikhail Nilov (Pexels)
In the IT industry, knowledge is the key to success, but let's be honest: today's internet is a giant mess. Thousands of articles are created every day, and fishing out valuable gems from this chaos borders on the miraculous. For several years, I faithfully used Feedly to aggregate content. It's a great tool, but I lacked a "brain" that would filter it all for me.
Paid plans offer AI, but I like to have control over how the model "thinks" and who it follows. So I decided to build my own Agent.
Architecture: Light, cheap, and effective
Instead of building a massive system, I opted for minimalism. My solution is a classic Cron Job on a server that triggers a PHP script.
My setup:
- Trigger: Cron job runs daily at 7:00 AM.
- Brain: Gemini API (Flash model). In January 2026, it is the absolute king of cost-effectiveness.
- Data: Configuration file with a list of URLs (my favorite sources + a list from Gemini).
- Context: Prompts kept in .txt files. Thanks to this, I don't touch the code when I want to change the summary style.
<?php
// 1. Setup & Configuration
$apiKey = getenv('GEMINI_API_KEY');
$config = loadConfig();
$taskName = $argv[1] ?? 'general';
// 2. The Core Logic: Calling Gemini
function callGemini($apiKey, $model, $prompt, $targets) {
$fullPrompt = $prompt . "\n\nSources to analyze:\n" . implode("\n", $targets);
$url = "https://generativelanguage.googleapis.com/v1beta/models/$model:generateContent?key=$apiKey";
$payload = [
"contents" => [[
"parts" => [["text" => $fullPrompt]]
]]
];
$options = [
"http" => [
"header" => "Content-Type: application/json\r\n",
"method" => "POST",
"content" => json_encode($payload)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$data = json_decode($result, true);
return $data["candidates"][0]["content"]["parts"][0]["text"] ?? "Error";
}
// 3. Execution
echo "🤖 Agent working on: $taskName...\n";
$task = $config["tasks"][$taskName];
$summary = callGemini(
$apiKey,
$config["model"],
file_get_contents($task["prompt"]),
$task["targets"]
);
// 4. Delivery (Simplified)
$headers = "Content-Type: text/html; charset=UTF-8";
mail($config["recipient_email"], "AI Digest: $taskName", nl2br($summary), $headers);
echo "✔ Email sent!\n";Why Gemini 1.5 Flash?
Because according to my calculations, one such digest costs me less than 1 penny. But this isn't just about saving money.
As engineers, we must learn to optimize model selection now. Pushing a simple text summarization task to the most powerful models (like Ultra or GPT-4/5) is a pure waste of resources. It's like ordering a semi-truck to transport a single box of matches.
Today, the art is not just using AI, but selecting a model with the right parameters for a specific task:
- Lighter models (Flash/Haiku): Ideal for quick summaries, data filtering, and simple Agents.
- Heavy models: We leave them for complex business logic, deep code analysis, or creative brainstorming.
Optimization at this level is technological maturity. Thanks to this, my script is lightning fast, cheap, and doesn't "burn" electricity where a clever tokenizer and a well-formulated prompt are enough. And if you simply prefer to click instead of code? More on that below.
What if you don't want to write code? (Low-Code)
Of course, you can click through a similar setup in tools like Zapier, Make, or n8n. This is a great alternative if you don't have your own server with PHP at hand.
- Make / n8n: You set up an "HTTP Request" module (to fetch page content or RSS), then a "Gemini/OpenAI" module (for analysis), and finally a "Gmail" or "Slack" module for sending.
- Zapier: Has a ready-made "AI Digest" module that collects data from the whole day and sends it in bulk.
Why did I choose a script? I wanted to check how it works at a "low-level". A programmer likes to know what's under the hood – how tokenization looks, how to precisely control the context window, and how to manage API costs without the overhead of third-party platforms. In PHP, I have full control over every byte sent to the model.
The whole magic lies in the Prompts
This is where real engineering happens. In .txt files, I have defined what the AI should pay attention to:
- "Ignore sponsored posts and self-promotion."
- "If talking about a new JS framework, extract only the main syntax changes."
- "Summarize this in 3 concrete points."
In the configuration, I have not only my constant sources but also a list suggested to me by Gemini – just to "expand horizons" and get out of my own bubble.
Summary
I am impressed by how technology, which serves to flood the internet with mass content, can simultaneously become the most effective filter. My Agent extracts what is most important from the chaos, and I can drink my morning coffee reading concrete information. This is not the end of the journey – my Agent will certainly evolve.


