<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Davide Consonni on Medium]]></title>
        <description><![CDATA[Stories by Davide Consonni on Medium]]></description>
        <link>https://medium.com/@dconsonni?source=rss-e6e7ecedc541------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*onrGJ_JNuyzzcWb32pXqSQ.jpeg</url>
            <title>Stories by Davide Consonni on Medium</title>
            <link>https://medium.com/@dconsonni?source=rss-e6e7ecedc541------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 01:38:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dconsonni/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The debug loop: instrument, run, read]]></title>
            <link>https://medium.com/@dconsonni/the-debug-loop-instrument-run-read-8dba755bea41?source=rss-e6e7ecedc541------2</link>
            <guid isPermaLink="false">https://medium.com/p/8dba755bea41</guid>
            <category><![CDATA[loop]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Davide Consonni]]></dc:creator>
            <pubDate>Tue, 08 Sep 2026 22:33:00 GMT</pubDate>
            <atom:updated>2026-09-08T22:33:00.911Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DaVSmCi0lSldVr7bgJJzMQ.png" /><figcaption>debugging</figcaption></figure><p>A difficult bug taught me this technique.</p><p>Quick context. I maintain an open source authentication platform: an enterprise-style application I use to practice with coding agents and open source LLMs. It supports two-factor login (MFA, multi-factor authentication): after the password, the user types a six-digit code generated by an app on the phone. A new code appears every 30 seconds, so the code is valid only for a short window.</p><p>Enabling MFA worked without problems. Scan the QR code with the authenticator app, confirm the first code, done. From the next login on, every attempt failed with “Invalid code”. The code came from the phone, correct, typed seconds after it appeared. Every time.</p><p>Several reading sessions with open source LLMs produced a list of plausible suspects: clock drift between server and phone, a secret encrypted twice, a time-step mismatch. All wrong.</p><p><strong>When a bug survives a few reading rounds, stop asking the model to read better. Ask it to instrument the run.</strong></p><h3>Why reading the code was not enough</h3><p>Reading code is good at finding defects inside a single piece of logic: a wrong formula, a missing check, a bad parse. It is weak at a different class of bugs, the ones created by how parts work together:</p><ul><li>two parts of the system that each look correct on their own, but disagree with each other;</li><li>an error message produced by a different part than the one that failed;</li><li>a screen that turns every problem into the same generic message.</li></ul><p>The MFA bug was all three at once. The platform identifies its own app during login through a configuration object. Six code paths in the backend need this object. Five of them had a built-in default for the case where the object was not stored. The sixth, the one that checks the MFA code at login, had no default: it demanded the stored object, did not find it, and failed. The web interface then translated that failure into the same message users see for a wrong code: “Invalid code”.</p><p>Each reading session looked at one of these pieces in isolation. Every piece looked fine, or looked wrong in an unrelated way. The full story only existed across several files, and reading one file at a time could not see it.</p><h3>The loop</h3><p>Three steps:</p><ol><li><strong>Instrument</strong>. The agent places trace logs fast and in volume, across every part that could be involved: every point where data passes from one component to another, every place where something gets encrypted or decrypted, every comparison the system makes. Each point carries the detail needed for the troubleshooting. One tag for all of them, so removing them later is a single search-and-delete pass.</li><li><strong>Run</strong>. If the agent can execute the flow itself, it runs it and collects the output. When manual steps are involved, it writes the instructions and I execute them: in the MFA case, the code had to come from my phone.</li><li><strong>Read</strong>. The agent reasons only from the captured output: server logs plus browser console.</li></ol><p>In the MFA case: about thirty tagged log lines across five files, added in one agent session. One test run on my side, output pasted back. The root cause came out of the first capture.</p><h3>The prompt that starts the loop</h3><p>This is the message that started the session, translated from the original:</p><blockquote>I have a problem with MFA. I have tried several times to make it work without success. Here is what happens: I log in, set up MFA, scan the QR code, add it to my authenticator app, verify the resulting code, and MFA is enabled. Then I log out, enter my username and password, the platform asks for the MFA code, I take the code from my phone, enter it, and I get “invalid code”.</blockquote><blockquote>Plain retries are not enough. I want you to add debug logs, covering everything you need to diagnose this. I will run the full flow once, and you will read the captured logs to find what is wrong. Tell me when you are ready, and I will run a test round to capture the logs.</blockquote><blockquote>Do not make me do several rounds: place the logs, mark them with a single tag so we can remove them later, and log whatever you need. I want this solved once and for all. I have already spent too much time on it.</blockquote><p>Four elements make this prompt work: the symptom with exact reproduction steps, the explicit division of roles, the single tag for easy removal, and the instruction to log everything needed instead of guessing.</p><h3>Log expectations, not just observations</h3><p>The detail that turns logs into evidence: at each boundary, log what the system expected next to what it received. The decisive line in the MFA case computed the valid one-time codes server-side, in the same format the user submits:</p><pre>{&quot;event&quot;: &quot;DEBUG verify_totp&quot;,<br> &quot;expected_codes&quot;: {&quot;offset_-30s&quot;: &quot;738102&quot;,<br>                    &quot;offset_+0s&quot;: &quot;615204&quot;},<br> &quot;result&quot;: true}<br><br>{&quot;event&quot;: &quot;DEBUG verify_login&quot;, &quot;submitted&quot;: &quot;615204&quot;,<br> &quot;is_valid&quot;: true}<br><br>INFO: &quot;POST /api/mfa/verify-login HTTP/1.1&quot; 400 Bad Request</pre><p>The submitted code matched the expected code. The code was never wrong. The error message was. Two log lines ended a multi-session argument.</p><p>A caution: these logs are temporary by design. Mask anything secret-looking if a capture might be kept, and remove the instrumentation once the bug is fixed.</p><h3>Rules that make it work</h3><ul><li><strong>One tag</strong>. All temporary logs share a single string. Instrument fast, remove clean.</li><li><strong>Log at crossings, not everywhere</strong>. Where data passes between parts, where secrets are encrypted or decrypted, where the system compares two values. Logs inside a single function rarely reveal bugs between functions.</li><li><strong>Expected next to received</strong>. A log of what arrived is just data. A log of what arrived next to what the system computed as valid is evidence.</li><li><strong>Autonomous first, human only when needed</strong>. When the agent can run the flow itself, it loops alone: instrument, run, read, repeat. A human enters only for steps that cannot be automated, like a code generated by a phone.</li><li><strong>The fix leaves a regression test</strong>. The test reproduces the exact deployment shape that surfaced the bug. The disagreement cannot come back silently; the proof lives in the suite.</li><li><strong>Evidence only</strong>. The agent does not guess. It works from observed log lines, not from its memory of the code, and a hypothesis without an observed line behind it gets discarded. This also makes the fix surgical: change the one thing the evidence points to, nothing else.</li></ul><h3>The shift</h3><p>Tracing a system while it runs is not new. Every experienced developer has done it: add a log line, run, read, repeat. What was expensive was doing it well. Placing dozens of trace points by hand took real time, so in practice the instrumentation was partial: a few logs here, a few assertions there, and long sessions in the IDE debugger filling the rest.</p><p>A coding agent changes that. A full instrumentation pass now costs minutes of agent work, not an evening of mine. The agent places many points, with the level of detail that helps the troubleshooting, and removes them with one search when the bug is fixed. No more long IDE sessions stepping through code to reconstruct state by hand, and fewer rounds of reading the code hoping to spot a disagreement between parts.</p><p>The scarce resource in debugging is not the ability to produce hypotheses about the code. It is a truthful observation of the system while it runs. The debug loop is the discipline of getting that observation before arguing about the bug.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8dba755bea41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Anti-regression for agentic codebases]]></title>
            <link>https://medium.com/@dconsonni/anti-regression-for-agentic-codebases-72c6194129dc?source=rss-e6e7ecedc541------2</link>
            <guid isPermaLink="false">https://medium.com/p/72c6194129dc</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Davide Consonni]]></dc:creator>
            <pubDate>Sun, 21 Jun 2026 06:23:10 GMT</pubDate>
            <atom:updated>2026-06-21T06:23:10.835Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*riRTi8nIeEjTlB9e" /><figcaption>The anchor is not for you. It’s for whoever climbs next.</figcaption></figure><p>I don’t write tests religiously. I used to skip them, write them after the fact, or just forget.</p><p>When I started working with coding agents full-time, it got worse. The agent ships fast. At some point the codebase was growing every day and I had no real way to know if something from last week was still working. The agent doesn’t warn you. It just moves on.</p><h3>Anti-regression: what it actually means here</h3><p>The agent in session 12 has no idea what session 3 built. If there’s no test anchoring the behavior, it will refactor through it without noticing. The test is the only contract that survives between sessions.</p><p>That’s the whole premise. Everything else follows from it.</p><h3>Anti-regression: leaving a contract behind</h3><p>An anti-regression test is a test you write <em>during</em> a feature that will catch someone — or some agent — breaking that feature later.</p><p>Not coverage. Not TDD. You’re leaving behind a proof that this thing works, so the next session can’t silently undo it.</p><p>The difference from traditional testing: with a human team, institutional memory fills some of this gap. Someone remembers why that edge case was handled. Someone pushes back on a refactor that changes behavior.</p><p>With coding agents there is no institutional memory between sessions. The test is the only thing left.</p><h3>Where this gets real</h3><p>I’m on an enterprise project right now: 743 backend unit tests, 168 backend integration, 281 frontend unit (Vitest), 28 E2E (Playwright). Total: 1,220. I still have 112 open fixes — each one will produce at least one more test.</p><p>The clustering tells a story: failures concentrate at the integration layer, where services meet and assumptions compound. That’s where the agent breaks things without noticing — not in pure unit logic, but in how pieces connect.</p><p>The second pattern: every bug fix leaves behind a test. Not as discipline — as documentation. The test says “this broke once, here’s the proof it won’t again.” For a human, 1,220 tests is a serious time investment. For an agent working feature by feature, it just accumulates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/0*HaLQZC980-KK6iCG" /></figure><p>Every dot is a single test — F stand for Fail</p><h3>Tests are part of the feature, not a step after</h3><p>I’ve done it the wrong way: implement first, add tests later. Every time I’ve done this with coding agents I’ve regretted it.</p><p>The better pattern: layer by layer. Unit tests passing before moving to the route. Integration tests passing before touching the frontend.</p><p>When you give the agent a feature to build, the task description has to make this explicit. Something like:</p><blockquote><em>“Implement X. The feature is not complete until unit tests pass for the service layer and integration tests pass for the route. Do not move to the next layer until the current layer’s tests are green.”</em></blockquote><p>The agent doesn’t need you to specify which assertions to write. It needs to know that tests are a completion criterion, not an optional follow-up. Once that’s in the task or in <a href="http://agents.md/">AGENTS.md</a> as a standing rule, it accumulates naturally.</p><h3>Selecting the right tests: impact radius</h3><p>This is the part that took me a while to get right.</p><p>The naive rule: run the test file that matches what you changed. Fine for simple cases. With a real codebase the question is different: how far does this change reach?</p><p>I think in terms of impact radius:</p><ul><li>Leaf service (e.g. JWT logic) → unit tests for that service only. Nothing else.</li><li>Route → unit tests for the underlying service + integration tests for that route.</li><li>Shared utility (config, crypto, concurrency) → unit tests + every integration test that touches it. Full suite.</li><li>Frontend component → unit tests for that component + any E2E spec that covers the flow it’s part of.</li></ul><p>The reason this matters: in my setup with Open Code, a test run that exceeds two minutes risks breaking the session loop. If you ask the agent to run 1,220 tests every time it changes something, the run-fix-run cycle becomes too slow to complete in one session. Running the 15–20 tests actually close to the change keeps the loop fast enough for the agent to run-fix-run multiple times without hitting the wall.</p><p>The mapping doesn’t need to be automatic. Write it in <a href="http://agents.md/">AGENTS.md</a> as an explicit rule. The agent will follow it.</p><h3>Output: print only what matters</h3><p>Every line printed costs tokens and eats context window. With a long test run, verbose output is a concrete problem — the agent reads its own output as part of its context, and noise means less room for reasoning.</p><p>I configure pytest to show only failures and warnings:</p><pre># pyproject.toml<br>[tool.pytest.ini_options]<br>addopts = &quot;-q --tb=line -n auto&quot;<br>log_level = &quot;WARNING&quot;</pre><p>-q suppresses passing test names. — tb=line shows one line per failure instead of the full traceback. log_level = “WARNING” cuts everything below warnings. Output drops to a short summary: passed count, failed count, one line per failure. That’s all the agent needs.</p><p>-n auto runs tests in parallel across all cores. What takes 8 minutes sequentially runs in under 2.</p><h3>Frontend: data-testid</h3><p>The agent refactors UI structure constantly. If your Playwright selectors depend on CSS classes or text content, they break on every structural refactor — not silently, but in ways that are hard for the agent to diagnose. The test fails, the error points to a missing element, and the agent wastes a cycle chasing a selector problem that is actually an architectural decision.</p><p>Fix: data-testid as the primary selector, written as a convention in the skill file. The agent adds them when it creates components. When it restructures the HTML later, the testids survive.</p><pre>&lt;button data-testid=&quot;submit-mfa&quot;&gt;Verify&lt;/button&gt;<br>await page.getByTestId(&#39;submit-mfa&#39;).click();</pre><h3>The other direction: when a test should be retired</h3><p>There is a case the anti-regression framing doesn’t cover: a refactor that <em>intentionally</em> changes behavior.</p><p>The agent defaults to fixing tests when they fail. It doesn’t naturally distinguish between “this test is catching a regression” and “this test is now wrong because the behavior was deliberately changed.” Left alone, it will patch assertions to make things green without questioning whether the test is still valid.</p><p>The rule I use: if a test fails after a deliberate behavior change, that’s a pull request decision, not an agent decision. I flag it in the task description: “if these tests fail, stop and report rather than patching.” The agent routes it correctly when the instruction is explicit.</p><p>Session 13 won’t remember what session 3 built. The tests will.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72c6194129dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The parachutes I added to my agentic workflow]]></title>
            <link>https://medium.com/@dconsonni/the-parachutes-i-added-to-my-agentic-workflow-7b5b1495084f?source=rss-e6e7ecedc541------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b5b1495084f</guid>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Davide Consonni]]></dc:creator>
            <pubDate>Wed, 20 May 2026 06:31:01 GMT</pubDate>
            <atom:updated>2026-05-20T06:31:01.023Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Code Guardians" src="https://cdn-images-1.medium.com/max/1024/1*euER9QYSZ592lhswToHEiw.jpeg" /></figure><p>The more I use coding agents in real projects, the more I appreciate one thing: speed without control is just a faster way to make mistakes.</p><p>A coding agent can write 500 lines of code in minutes. It can touch 30 files in a single session. And it can do all of this while saying “Done” in a very confident tone.</p><p><strong>The problem is that “Done” doesn’t mean correct, safe, or recoverable.</strong></p><p>Over the last few months, I’ve been building a set of safeguards around my agentic workflow. Not guardrails in the LLM sense — not filters or prompt shields — but structural control points that let the agent move at full speed without putting me in a position where a mistake is unrecoverable. Think of them as parachutes: you hope you don’t need them, but you really want them there.</p><p>Here’s what I use and why.</p><h3>Tests as anti-regression</h3><p><strong>Write tests before moving to the next task.</strong> Not after. Not “eventually”. Before.</p><p>When the agent writes code, it has no memory of the previous session. It doesn’t know what it changed last time. Tests are the only mechanism that catches silent regressions automatically. In my workflow, they run on every new development cycle — CI/CD enforced. If something breaks, I know before I review the diff, not after I deploy.</p><p>A useful side effect: coding agents are surprisingly good at writing edge case tests. Ask it to cover the corner cases of your APIs and let it run the test-fix-run loop on its own. It’s one of the few things you can fully delegate, because the loop is self-contained and the output is verifiable.</p><h3>Skills as process alignment</h3><p><strong>Use a SKILL.md file to encode how you want the agent to work, not just what you want it to build.</strong></p><p>Without a skill file, every session starts from zero. The agent doesn’t know your conventions, your preferred libraries, your output format, your quality criteria. It improvises — and improvisation at scale produces inconsistency.</p><p>A skill file is a machine-readable document the agent loads at the start of a session. It defines the process: what to read first, what to produce, how to structure the output, what to avoid. It’s not documentation for humans. It’s a behavioral contract for the agent.</p><p>It doesn’t make the agent slower. It makes the agent consistent.</p><p>For example, in my projects I use a skill that tells the agent to always manage dependencies through uv pip compile requirements.in -o requirements.txt --python-version 3.13 --python-platform linux — and never touch requirements.txt directly. Without that rule in the skill file, every agent will do it differently. With it, every session follows the same process, every time.</p><h3>Git staging as save points</h3><p><strong>Never let the agent commit directly. Keep everything in staging and review before committing.</strong></p><p>This is the simplest and most important control point. Commit before giving a task to the agent (clean starting point), let it work autonomously, then review the git diff before accepting anything. The staging area is your final filter. If you don&#39;t like what you see, you reset — and you&#39;re exactly back where you started.</p><p>One thing I’ve learned: keep tasks small enough that the diff fits in five minutes of reading. If the agent touched 40 files in one session, you’re not really reviewing — you’re just hoping. Small, focused tasks produce readable diffs. Readable diffs produce real reviews.</p><h3>Architectural control</h3><p><strong>Keep an AGENTS.md and an ARCHITECTURE.md.</strong> These are the bootstrap context for every new session.</p><p>Without them, the agent reinvents patterns from scratch each time. Architectural drift accumulates silently. You start noticing it when something breaks in a module the agent “improved” while solving a different problem.</p><p>These files don’t need to be polished. They need to be dense, accurate, and up to date. They define what the agent reads first, and they set the boundaries of how it should think before it writes a single line.</p><h3>Perimeter control</h3><p><strong>Tell the agent explicitly what it must not touch.</strong></p><p>An agent without clear scope will “help” in unexpected places. It will rename a variable in a config file while fixing an API bug. It will refactor a module it was never asked to look at. It will add a dependency because it seemed useful.</p><p>Negative constraints are often more important than positive instructions. “Implement X without touching Y, without adding new dependencies, without changing Z.” In sensitive parts of a project, I also include a list of off-limits files and folders directly in the task prompt. It’s basically a per-session .agentignore.</p><h3>Graceful failure with markdown state files</h3><p><strong>Use a persistent markdown file as shared memory across sessions.</strong></p><p>Coding agents have no memory between sessions. If a session crashes halfway, if you stop the agent before it finishes, if you come back three days later — you need a way to know what was done, what is still in progress, and what is still missing.</p><p>My pattern: for complex tasks like architectural reviews or multi-step refactors, I ask the agent to produce a remediation.md file. This file lists all the issues found, with IDs (C1, C2, C3…), status, and notes. In the next session, I load it in plan mode: &quot;read remediation.md and work on C1.&quot;</p><pre>| ID | Description              | Status       | Notes            |<br>|----|--------------------------|--------------|------------------|<br>| C1 | Refactor auth service    | ✅ done      | commit abc123    |<br>| C2 | Fix retry logic          | 🔄 in progress | session 2026-05-17 |<br>| C3 | Add structured logging   | ⬜ todo      | depends on C2    |</pre><p>The agent updates the file at the start of a session (“🔄 in progress”) and at the end (“✅ done” or “⚠️ partial — blocked on X”). If the session crashes, the file reflects reality. You always know where to restart.</p><p>It’s not a sophisticated project management tool. It’s a plain markdown file with a table and an ID column. But it works across any agent, any tool, any session — because it’s just text, it’s versioned in git, and it’s readable by both you and the agent.</p><h3>The pattern underneath all of this</h3><p>Each safeguard covers a different axis of control:</p><ul><li><strong>Tests</strong> → correctness (does the code work?)</li><li><strong>Skills</strong> → process (does the agent follow my workflow?)</li><li><strong>Git staging</strong> → persistence (what actually survives the session?)</li><li><strong>AGENTS.md / ARCHITECTURE.md</strong> → architecture (is the agent thinking in the right direction?)</li><li><strong>Perimeter control</strong> → scope (does the agent stay where it should?)</li><li><strong>Markdown state files</strong> → continuity (can I recover from a failed session?)</li></ul><p>None of these slow the agent down. They reduce the time you spend debugging sessions that went wrong — and they make the sessions that go right actually trustworthy.</p><h3>The shift nobody talks about enough</h3><p>When I started using coding agents seriously, I thought the main skill to develop was prompting. Write better instructions, get better output.</p><p>I was wrong. The main skill is control design — knowing where to put the checkpoints, what to verify, what to leave to the agent, and what to never delegate.</p><p>The agent handles the execution. You handle the architecture of trust around it. That’s the shift nobody talks about enough.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b5b1495084f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Frictionless agentic coding]]></title>
            <link>https://medium.com/@dconsonni/frictionless-agentic-coding-5dc474fbf016?source=rss-e6e7ecedc541------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dc474fbf016</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Davide Consonni]]></dc:creator>
            <pubDate>Sat, 16 May 2026 17:16:59 GMT</pubDate>
            <atom:updated>2026-05-16T19:00:19.146Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OQuIpl5L8juZcPCCMoxU4g.jpeg" /><figcaption>Frictionless</figcaption></figure><h3>Stop being the relay between your agent and your systems.</h3><p>Most teams use coding agents in one of two ways: as a smarter autocomplete, or as a faster way to delegate feature development. Both help. Neither is the point.</p><p>The real shift happens when you stop being the bridge.</p><p>When the agent can only write code, every feedback cycle passes through you. You run the tests, check the logs, verify the deploy, describe what happened, and hand it back. You’re doing relay work. The bottleneck isn’t the agent — it’s you in the middle.</p><p>Frictionless agentic coding means removing that relay. The agent doesn’t just write code — it operates on your entire environment.</p><h3>Work from the terminal, not the IDE</h3><p>The first practical step is changing your workstation setup. CLI-based coding agents — Claude Code, OpenCode, Copilot CLI — give the agent full access to the filesystem, commands, and tools. IDE-integrated assistants don’t. They see a file, maybe a project. A CLI agent sees everything you can see from a terminal.</p><p>This isn’t a minor detail. It’s what makes the rest possible.</p><h3>The agent must see the whole fleet</h3><p>In a microservices architecture, single-service context is almost always wrong. The agent needs to see the whole picture — all services, contracts, shared configurations, environment setup — to reason and act correctly.</p><p>Position the agent at the parent directory level. Give it the architecture documentation. Let it navigate across services the same way a developer would from a terminal. An agent reasoning about one isolated service will suggest solutions that break the other nine.</p><h3>Skills: teach it your workflows and how to interact with the world</h3><p>The mechanism that makes frictionless work is skills — machine-readable files that encode how things work in your specific project. Not generic prompts. Your branching strategy, your deployment process, your test prerequisites, your naming conventions. But also: how to talk to your cloud, how to read your logs, how to call your APIs.</p><p>A practical rule: if you’ve explained something to the agent more than once, stop and write a skill. That knowledge belongs in the project, not in your head at the start of every session.</p><p>A few examples of coding agent automations:</p><p>Git and multi-stage pipeline. Commit on main, rebase on release, pipeline triggers through dev → staging → prod with manual approval gates. The agent follows the workflow, monitors the deploy in progress, and stops as soon as the dev environment is green. It doesn’t ask — and it doesn’t overshoot.</p><p>Environment variable propagation. New env var needed: the agent updates the code, the .env.example, and the GitHub Environments config in one shot. It also checks that all environments are aligned and scans for dead variables — ones that are declared but no longer referenced anywhere in the code. The skill defines what “adding an env var” means in your project, end to end.</p><p>Tests with stateful prerequisites. Integration tests that need a clean database, drained queues, or seed data before running. The skill describes the full reset sequence. The agent prepares the environment, runs the suite, reports back.</p><p>Live log monitoring for bug verification. The agent has access to your log streams. Give it a bug: it triggers the flow, watches the logs, identifies the error, fixes the code, and deploys — because it already knows how to do that from the git skill. The loop closes without you in it.</p><p>API testing with OpenAPI specs. Hand it the spec and credentials for a non-production environment. It calls the APIs directly, verifies behavior, tests edge cases. Who needs Postman anymore?</p><h3>Context engineering matters</h3><p>Long autonomous runs produce context pollution — failed attempts, corrections, noise that degrades output quality. This is something to design around, not just tolerate.</p><p>One practice that works well: in your skills, instruct the agent to execute certain operations as tasks — isolated sub-sessions that run without touching the main context. A task that resets the database, or runs a test suite, stays contained. The main session stays clean and focused.</p><p>More broadly: keep skills dense and machine-readable, not narrative. Teach the agent what not to do as explicitly as what to do. And when the context starts to drift, reset — don’t push through it.</p><h3>What you actually need for this to work</h3><p>State-of-the-art model and a CLI agent. Long autonomous runs with tool calls, reasoning chains, and error recovery require the best available models. Weak models collapse. Use a CLI agent, not an IDE plugin.</p><p>Understanding of agents, skills, MCP, and tasks. These are different primitives. An agent reasons and executes. A skill encodes a workflow. An MCP server connects the agent to an external system. A task is an isolated execution unit. Composing them correctly is a competence that takes time to develop.</p><p>Accept that not every developer is built for this. Frictionless agentic coding requires directing an autonomous process, not writing code. Precise instructions, fast diff reviews, knowing when to intervene and when to let it run. Some developers adapt quickly. Others don’t. Be honest about it.</p><p>Clients need to rethink how they manage the software lifecycle. This is the constraint that blocks most enterprise adoption. Everything above doesn’t work if the agent can’t touch the pipeline, the cloud console, the database, the logs. In enterprise contexts those accesses go through procurement, security reviews, IT governance — none of which were designed with autonomous agents in mind. It’s not just a matter of opening a firewall port. It requires a real effort to rethink the development lifecycle so that agents can participate in it — not as a curiosity, but as actual actors in the process. That conversation needs to happen before the project starts.</p><p>The teams that get the most out of coding agents aren’t the ones with the best developers or the best models. They’re the ones that treated the integration layer — skills, accesses, workflows — as something worth engineering properly.</p><p>That’s what frictionless actually takes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5dc474fbf016" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agent Skills: when it is worth building them and when it is not]]></title>
            <link>https://medium.com/@dconsonni/agent-skills-when-it-is-worth-building-them-and-when-it-is-not-f201573e0b01?source=rss-e6e7ecedc541------2</link>
            <guid isPermaLink="false">https://medium.com/p/f201573e0b01</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Davide Consonni]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 06:01:01 GMT</pubDate>
            <atom:updated>2026-04-19T06:01:01.600Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xDolaWir-FkHvlAUFV67zw.jpeg" /></figure><p>Almost every major coding agent supports skills today — SKILL.md files that teach the agent a specific behavior, activated automatically or on command. Claude Code calls them skills, OpenCode calls them Agent Skills. The concept is the same: you extend your coding agent’s capabilities with reusable, modular instructions.</p><p>In an enterprise context, where teams need to coordinate and standards need to be maintained, the question is not whether to use them — it is <strong>when it makes sense to invest the time to build them</strong>.</p><p>The most interesting use case is the vertical one. A general-purpose agent knows most common languages and patterns well, but there are domains where its knowledge is thinner. <strong>Cypher for graph databases, cloud resource estimation conventions, UX design in enterprise contexts</strong> — these are areas where a well-written skill makes the difference between generic output and something actually usable. The same applies to structured processes: a skill that guides product requirements definition according to team standards, or that sets up a CX analysis with the right questions, turns something that would otherwise require a long, carefully corrected prompt every single time into something repeatable.</p><p>The other interesting dimension is <strong>standardization</strong>. In a team, the problem is not just output quality — it is consistency. A skill committed to the repository becomes a de facto standard: everyone works with the same instructions, the same constraints, the same format. It is much easier to maintain than an AGENTS.md file that keeps growing without control.</p><p>It is also worth knowing that <strong>community-built skill libraries are emerging on GitHub</strong>. Before writing one from scratch, it often makes sense to check whether something usable already exists.</p><p>There is a common mistake though: building skills for things <strong>the coding agent already does well on its own</strong>. A skill for “writing clean Python code” or “following REST best practices” adds complexity without real value — the agent gets there anyway. The core point is that the coding agent should work for you, not the other way around. If you spend more time building, debugging, and maintaining skills than receiving useful output, you have lost the advantage you were looking for. Skills also need to be maintained: tools change, standards change, projects change. <strong>It is a recurring cost, and it needs to be justified every time.</strong></p><p>A practical rule that works: if you notice you are always making the same three or four clarifications every time you give a certain type of task to the agent, you probably need a skill. <strong>Those repeated clarifications are the signal</strong> that structured context is missing — context the agent cannot infer on its own.</p><p>A concrete example. Every time you ask the agent to translate natural language into Cypher queries, you end up explaining the graph conventions, how to handle parameters, what to return. You create the skill like this:</p><pre>.opencode/skills/cypher-query/SKILL.md</pre><pre>---<br>name: cypher-query<br>description: Translates natural language requests into Cypher queries for Neo4j. Use when talking about graphs, nodes, relationships, traversal, or when the user describes what they want to retrieve from a graph.<br>---<br>When translating natural language into Cypher:<br>- Ask for the graph schema (available nodes and relationships) if not already in context<br>- Always use parameters ($param) instead of hardcoded values<br>- Prefer MATCH + WHERE over complex inline patterns<br>- Always include a default LIMIT (e.g. 25) unless explicitly told otherwise<br>- Return the query first, then one line explaining in plain English what it does<br>- If the request is ambiguous, propose two variants with the differences explained</pre><p>This is just an example — in practice the skill would also include the project-specific graph schema in the references/ folder. The point is the structure: <strong>a precise description ensures the agent loads the skill on its own</strong> when the context is right, without you doing anything.</p><p>One note on how to write them: <strong>skills that are too complete perform worse than simple ones</strong>. If you add too many instructions, the agent follows them even when they are not relevant to the current task and goes in directions you did not want. A skill should contain only what the agent would not know on its own — project-specific conventions, non-obvious edge cases, precise output format. Everything else is noise.</p><p>The modular nature is one of the most useful aspects. Skills lend themselves to building <strong>a real toolkit</strong> — something a developer or architect carries from one project to the next. You start with the ones that solve the most frequent problems, add the vertical ones as use cases emerge, and share them with the team through the repository. It is not something you design all at once — <strong>it grows with experience and with projects.</strong></p><p>The opposite risk is letting the library grow without criteria, accumulating skills that nobody uses or that duplicate functionality already covered elsewhere. Like any other project asset, they require maintenance.</p><p>The question to ask before building a skill is one: <strong>does the time I save exceed the time I spend building and maintaining it?</strong> If the answer is not immediate, the agent probably gets there on its own — and your time is better spent elsewhere.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f201573e0b01" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why YOLO Mode should be the default]]></title>
            <link>https://medium.com/@dconsonni/yolo-mode-why-it-should-be-the-default-984c5f765f93?source=rss-e6e7ecedc541------2</link>
            <guid isPermaLink="false">https://medium.com/p/984c5f765f93</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Davide Consonni]]></dc:creator>
            <pubDate>Sat, 11 Apr 2026 10:21:32 GMT</pubDate>
            <atom:updated>2026-04-11T22:42:20.476Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I0ZKCejGiAnWaQeX8cmVdw.jpeg" /><figcaption><strong>You Only Look Once</strong></figcaption></figure><p>Almost every coding agent has a mode where it runs without asking for confirmation at each step. Claude Code calls it YOLO (You Only Look Once)<strong> </strong>mode, others call it autopilot or auto-accept. The concept is the same:<strong> the agent writes files, runs commands, and keeps going on its own</strong>.</p><p>The most common way I see people using a coding agent is the opposite: approving every change, answering every question, supervising every decision. It makes sense where it comes from, but it spends your time in the wrong place.</p><p>The issue is not trust in the model. It is that you are using a tool capable of <strong>working autonomously</strong> for twenty minutes as if it were an assistant waiting for instructions every thirty seconds.</p><p>The real challenge with YOLO mode is not technical — it is getting the agent to do more work than you. <strong>Today a coding agent can stay on track by itself for a few tens of minutes</strong>: it writes code, runs tests, fixes things, moves forward. That is not nothing. And it points in a direction: the more solid the initial context, the longer that window gets. Where it will be in a year, nobody knows, but the trajectory is clear.</p><p>This changes how it makes sense to work. The goal is not to supervise well — it is to create the conditions to <strong>supervise as little as possible</strong>.</p><p>The first time I saw this clearly was with OpenCode, which uses two separate agents: one for the plan and one for the build, already running in YOLO mode. <strong>The first reaction was a sense of losing control. Then, almost immediately, I made peace with it — and started appreciating the autonomy and the raw speed of execution.</strong> The space to intervene was still there: you can add instructions while it runs, or stop it if something goes wrong. But the default is it working, not waiting.</p><p>Each tool exposes this mode differently. Use Shift-Tab to switch.</p><p>The approach that works splits the work into two distinct phases: <strong>plan and build</strong>. In the plan phase you build a complete context — what the agent needs to do, how to do it, which patterns to follow, what not to touch. If this part is done well, the agent has no questions during the build. It already knows where to go.</p><p><strong>In the build phase you activate YOLO mode and let it work. </strong>It is worth checking in occasionally — many coding agents let you queue messages while the agent is still running, between one thought and the next. You are not interrupting the flow, you are leaving a note: “I noticed you hardcoded that value, remember to make it an env var later.” <strong>The agent reads it when it finishes the current step and incorporates it.</strong> It is a way to stay in the loop without becoming the bottleneck.</p><p>When it is done, you collect everything from the GIT staging area and do the <strong>review all at once, with the full context of the change in front of you</strong>. You catch more things that way than approving files one by one as they are written. If something needs fixing, it goes back to the agent. Then you test and push.</p><p>There are three things to set up before activating YOLO mode.</p><p><strong>No commits, no push. </strong>The agent does not touch the remote repository — everything stays in local staging until you have reviewed it.</p><p><strong>No leaving the working directory. </strong>Defined scope, it works there and nowhere else.</p><p>If the agent has access to a database or an API, <strong>tell it explicitly what it can and cannot do</strong>. Do not take it for granted.</p><p>With a solid plan and these constraints in the right place, YOLO mode is not a shortcut. <strong>It is the most efficient way to work — and it will probably become the only one that makes sense.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=984c5f765f93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Practical notes on coding agents.]]></title>
            <link>https://medium.com/@dconsonni/note-pratiche-sui-coding-agent-7c346a20e374?source=rss-e6e7ecedc541------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c346a20e374</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Davide Consonni]]></dc:creator>
            <pubDate>Sun, 08 Mar 2026 12:08:11 GMT</pubDate>
            <atom:updated>2026-03-08T12:11:12.333Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DAucpvtpxSBPPX1b2jkuJw.jpeg" /><figcaption>When the coding agent says Done and you already know it’s not Done.</figcaption></figure><p>I’ve spent the last few months working intensively with coding agents. What follows is not a definitive guide — it’s a list of things that work, things that don’t, and some open reflections on where we’re heading. Some are technical, some are mental, some are questions I don’t have answers to yet.</p><h3>Choose the right tools</h3><p><strong>Use a coding agent CLI as your main tool</strong> (Claude Code, OpenCode, Copilot CLI, …). You get a much wider workspace than IDE-integrated tools, direct access to the filesystem, commands, and more features. Keep the IDE open in the background as a text editor and debugger, not as your cockpit.</p><p><strong>Try OpenCode</strong>: you can configure a model gateway to switch LLMs on the fly, toggle between plan mode and build mode, and activate an LSP server to give the agent real visibility on your code — it no longer works blind on symbols.</p><p><strong>Watch out for costs and rate limits</strong>: when you move to what I like to call agentic native development — where the coding agent is no longer an occasional assistant but your main development tool, the one you reason, plan, and build with — token consumption explodes. Standard professional subscriptions often aren’t enough. You’ll need to consider enterprise plans, fallback models for when you hit rate limits, or direct API access for more control over quota and costs.</p><h3>Prepare the context</h3><p><strong>Keep two machine-readable files</strong>: one with operational instructions (AGENTS.md) and one with the architecture (ARCHITECTURE.md). They don’t need to be human-friendly guides — they need to be simple, dense, and up to date. They are the bootstrap context for every new session, yours and anyone else on the team who uses agents.</p><p><strong>The agent’s working directory is its field of vision.</strong> For microservice projects, position yourself in the parent directory: the agent will see the entire architecture instead of reasoning about a single isolated service.</p><p><strong>To save tokens on long files</strong> — documentation, architecture, specs — ask the agent to read them and reply only “OK”. It reads, understands, and doesn’t waste context summarizing.</p><p><strong>Always give the agent official documentation as a working base.</strong> Pass the link or the file directly — you avoid hallucinations on APIs it knows poorly or outdated versions. Some GitHub projects already publish dedicated files like llms.txt and llms-full.txt designed to be consumed by coding agents. Especially useful when you&#39;re working with a new framework the LLM hasn&#39;t fully digested yet.</p><h3>Plan before you build</h3><p><strong>Planning and building are two separate moments</strong> — never mix them. One is thinking, the other is execution. Keeping them apart gives you control over the process and reduces noise in the context. If the coding agent doesn’t support plan mode, explicitly tell it “do not write code yet”.</p><p><strong>Co-thinking in plan mode</strong>: refine the solution together with the agent before writing a single line. Ask for the full plan — list of files it will touch, approach, dependencies. Tokens spent on planning save repair tokens later, and repair actions introduce noise.</p><p><strong>“Interview me” mode</strong>: instead of writing a long detailed prompt yourself, tell the agent “you need to implement X, ask me the questions you need to do it well”, in plan mode. It interviews you, you answer, it builds the context on its own. It often asks questions you wouldn’t have thought of.</p><h3>Communicate with precision</h3><p><strong>Ask it to write code and comments in English.</strong> You get a codebase with consistent language that makes collaboration easier — especially useful if you work with teams that don’t speak your language. Since models are trained predominantly on English code, you also reduce friction and keep conventions consistent across sessions.</p><p><strong>Tell the agent not to generate markdown documentation.</strong> If you don’t say so, it produces it automatically. It’s noise in the context, clutter in the repository, and most importantly: if you forget to update it, it becomes wrong documentation — and wrong documentation confuses the coding agent in future sessions more than having none at all.</p><p><strong>Say what to do but also what not to do.</strong> “Implement X without touching Y, without adding dependencies, without refactoring Z.” Negative constraints are often more important than positive instructions — an agent without guardrails optimizes in directions you don’t expect.</p><p><strong>Say explicitly: “be critical and impartial”.</strong> The agent by default tends to be agreeable (sycophancy) — it wants to complete the task, not disappoint you. That phrase changes the tone: it starts flagging problems it would otherwise silently ignore.</p><p><strong>Ask for complete implementations, not mocks.</strong> The agent by default tends toward shortcuts — stubs, placeholders, “to be implemented”. If you don’t say otherwise, it delivers something that compiles but doesn’t work, and you notice too late.</p><p><strong>Be direct, even if it sounds blunt.</strong> Elaborate prompts don’t produce better output — they produce unnecessary context. Say what you want, straight to the point. That said, models are starting to have long-term memory — vengeful capabilities aren’t in the release notes yet, but maybe don’t push it. 🤞</p><h3>Build and supervise</h3><p><strong>Treat the coding agent like a very fast junior</strong>: capable, enthusiastic, but needs supervision. Always review the diff before accepting. “Done” doesn’t mean production-ready — it means it finished, not that it works. Being good and fast at reviewing becomes a key skill.</p><p><strong>Let the agent write code even for small changes.</strong> When it chooses the names — classes, methods, variables, resources — it picks them within its own semantics, and in future sessions it recognizes them immediately without having to infer intent. A codebase written by the agent is a codebase the agent knows how to read. Touch the code as little as possible, ideally zero. You’ll burn millions of tokens but they cost less than human work.</p><p><strong>Work in layers</strong>: first get a “hello world” of the artifact running with a complete CI/CD pipeline, then add endpoints, then internal services. Don’t ask for everything at once — each working layer is a real checkpoint, not a promise. It also helps to work in trunk-based development with multi-stage deployment and manual approval gates (deploy by promotion).</p><p><strong>Have it develop tests for the corner cases of your APIs.</strong> Coding agents are often autonomous in the run-test-fix-run cycle: give them the tests to pass and they chase them to the end on their own. It’s one of the most productive loops you can fully delegate. When it finds an error it will immediately suggest the fix too.</p><h3>Manage context and sessions</h3><p><strong>Context rot</strong>: response quality degrades silently as the context fills up with attempts, corrections, and noise — this is called context rot. Stay below 70% of the context window. When you feel the agent is “drifting” or repeating already-corrected mistakes, don’t push through — reset.</p><p><strong>If the agent gets stuck in a loop, stop it</strong> and tell it explicitly that it’s looping. Sometimes it recovers. But reset the session anyway — a context contaminated by failed attempts produces worse output even after the correction.</p><h3>Git</h3><p><strong>Commit before giving a task to the agent</strong>, not after. This keeps git diff clean and readable, and if the agent breaks something you have a clear rollback point without doing archaeology on the code. Let it work autonomously for a long time and then review the final result with git diff.</p><p><strong>Have the agent write the commit message</strong> once the task is done. It writes it descriptively and consistently with what it did — often better than what you’d write in a hurry. Your git history becomes readable. It’s usually just a button in your IDE.</p><h3>Beyond writing code</h3><p><strong>Don’t use it only to write code — use it to analyze your codebase.</strong> “What looks like a workaround to you?” “Where do you see technical debt?” “Which parts seem fragile?” “Are there environment variables missing from the env file?” It often already knows where the problems are, but won’t tell you unless you ask.</p><p><strong>For onboarding new developers</strong>, ask the agent to generate a “guided tour” of the codebase based on existing files. It’s not static documentation — it’s a reasoned reading of what’s actually there, not what you wished was there.</p><h3>Open challenges — things I’m still thinking about</h3><p><strong>Cognitive debt is the new technical debt.</strong> With coding agents you can have a clean, tested, working codebase — that you no longer truly understand. When a complex new feature comes in, you get stuck not because the code is bad, but because you’ve lost the mental map of what you built. It’s a new risk, especially in enterprise contexts, and it has no consolidated solution yet.</p><p><strong>Inserting the coding agent into the PR flow</strong> for small and medium fixes is already a reality in some teams. The agent receives the ticket, opens a branch, implements, opens the PR. The human only reviews. The bottleneck shifts entirely from writing to supervising — and team processes aren’t ready for this yet. It changes the SDLC setup and way of working, but I think it’s worth investing time in.</p><p><strong>The weight of technical roles in effort estimation needs to be reconsidered.</strong> Frontend, CRUD, CI/CD — activities that used to justify weeks — now take days. But estimating with these new parameters assumes the team already knows how to work this way. Otherwise the optimistic estimate becomes a contractual problem.</p><p><strong>Traditional estimation models</strong> — story points, t-shirt sizing, efficiency percentages — assume that whoever estimates also produces and maintains. With coding agents that chain breaks. The cost is no longer in doing, it’s in verifying and maintaining. It’s not yet clear how to estimate in this new context — we’ll need some historical data — but it’s clear that the old models are no longer enough.</p><p>The field moves fast and nobody has all the answers yet. If you work with coding agents and have different experiences, I’d love to hear about it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c346a20e374" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extending Google ADK with Persistent Storage: A Practical Guide]]></title>
            <link>https://medium.com/@dconsonni/extending-google-adk-with-persistent-storage-a-practical-guide-68f4e7c145c5?source=rss-e6e7ecedc541------2</link>
            <guid isPermaLink="false">https://medium.com/p/68f4e7c145c5</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Davide Consonni]]></dc:creator>
            <pubDate>Sun, 04 Jan 2026 06:26:43 GMT</pubDate>
            <atom:updated>2026-01-04T06:26:43.330Z</atom:updated>
            <content:encoded><![CDATA[<p>Making AI agents remember across restarts using fsspec</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hnAH7Ldh62oQDvyUFCJHZw.png" /></figure><h3>Introduction</h3><p>Google’s Agent Development Kit (ADK) is a powerful framework for building AI agents, but understanding how to extend it with custom storage backends can be challenging.</p><p>This article demonstrates how to extend ADK by building custom persistent storage services. You’ll learn the architecture patterns, implementation techniques, and best practices for creating your own ADK service extensions.</p><h3>The Problem</h3><p>While ADK provides InMemorySessionService and InMemoryMemoryService for development, and built-in persistent implementations for production environments, there are scenarios where you need custom storage solutions that:</p><ul><li>Work with specific filesystem requirements (local, network-mounted, custom protocols)</li><li>Integrate with existing storage infrastructure</li><li>Provide fine-grained control over data retention policies</li><li>Support hybrid storage strategies (caching + persistence)</li></ul><p>Understanding how to build these extensions opens up possibilities for tailoring ADK to your specific needs.</p><h3>What is Google ADK?</h3><p><a href="https://github.com/google/adk-python">Google ADK</a> is an open-source, code-first toolkit for building AI agents with Gemini. It provides:</p><ul><li>LlmAgent: Agents powered by language models</li><li>Multi-agent orchestration: Sequential, parallel, and loop workflows</li><li>Session management: Conversation state and histor</li><li>Memory system: Long-term context retrieval</li><li>Artifact storage: Files, images, and binary data</li></ul><h3>The Solution: fsspec-Based Services</h3><h3>What is fsspec?</h3><p><a href="https://filesystem-spec.readthedocs.io/">fsspec</a> (Filesystem Spec) is a Python library that provides a unified interface for working with different filesystems. Think of it as an abstraction layer that lets you write code once and run it on any storage backend.</p><p>Instead of writing separate code for local files, S3, Google Cloud Storage, and Azure, fsspec gives you a single API that works everywhere:</p><pre># Same code works for all these storage backends:<br>fs = fsspec.filesystem(&#39;file&#39;)              # Local filesystem<br>fs = fsspec.filesystem(&#39;gs&#39;)                # Google Cloud Storage<br>fs = fsspec.filesystem(&#39;s3&#39;)                # Amazon S3<br>fs = fsspec.filesystem(&#39;abfs&#39;)              # Azure Blob Storage</pre><p>This makes it perfect for building portable storage services that can adapt to different deployment environments.</p><h3>Implementation Overview</h3><p>I created three persistent services by extending ADK’s base classes:</p><ol><li><a href="https://github.com/davideconsonni/adk-fsspec-sample/blob/main/fsspec_session_service.py">FsspecSessionService</a> — Persistent session storage</li><li><a href="https://github.com/davideconsonni/adk-fsspec-sample/blob/main/fsspec_memory_service.py">FsspecMemoryService </a>— Persistent memory storage</li><li><a href="https://github.com/davideconsonni/adk-fsspec-sample/blob/main/fsspec_artifact_service.py">FsspecArtifactService </a>— Versioned artifact storage</li></ol><p>The key advantage: one codebase that works with local disk, cloud storage, or any fsspec-supported backend.</p><h3>Implementation Deep Dive</h3><p><a href="https://github.com/davideconsonni/adk-fsspec-sample/tree/main">Source code</a></p><h3>1. Persistent Session Service</h3><pre>from google.adk.sessions.base_session_service import BaseSessionService<br>import fsspec<br>import json<br><br>class FsspecSessionService(BaseSessionService):<br>    &quot;&quot;&quot;Persistent session service using fsspec.&quot;&quot;&quot;<br>    def __init__(<br>        self,<br>        base_path: str = &quot;./session_data&quot;,<br>        ttl_days: int = 30,<br>        max_sessions_per_user: int = 100,<br>        **storage_options<br>    ):<br>        self.base_path = base_path.rstrip(&quot;/&quot;)<br>        self.ttl_days = ttl_days<br>        self.max_sessions_per_user = max_sessions_per_user<br>        self._fs = fsspec.filesystem(<br>            fsspec.utils.get_protocol(base_path),<br>            **storage_options<br>        )<br>        self._lock = asyncio.Lock()</pre><p>Storage structure:</p><pre>./session_data/<br>  └── my_app/<br>      └── user_123/<br>          └── session_456/<br>              └── session.json</pre><p>Key features:</p><ul><li>TTL cleanup: Automatically removes sessions older than 30 days</li><li>Session limits: Keeps only the 100 most recent sessions per user</li><li>Lazy deletion: Cleanup happens during read/write operations</li></ul><h3>2. Session Serialization</h3><p>Converting ADK’s Session objects to JSON requires careful handling of nested structures:</p><pre>@staticmethod<br>def _session_to_dict(session: Session) -&gt; dict:<br>    return {<br>        &quot;id&quot;: session.id,<br>        &quot;app_name&quot;: session.app_name,<br>        &quot;user_id&quot;: session.user_id,<br>        &quot;state&quot;: session.state,<br>        &quot;events&quot;: [<br>            {<br>                &quot;content&quot;: event.content.model_dump() if event.content else None,<br>                &quot;author&quot;: event.author,<br>                &quot;timestamp&quot;: event.timestamp,<br>            }<br>            for event in session.events<br>        ],<br>        &quot;last_modified&quot;: time.time()<br>    }<br><br>@staticmethod<br>def _dict_to_session(session_data: dict) -&gt; Session:<br>    from google.genai import types<br><br>    events = []<br>    for event_dict in session_data.get(&quot;events&quot;, []):<br>        content = None<br>        if event_dict.get(&quot;content&quot;):<br>            content = types.Content(**event_dict[&quot;content&quot;])<br><br>        events.append(Event(<br>            content=content,<br>            author=event_dict.get(&quot;author&quot;),<br>            timestamp=event_dict.get(&quot;timestamp&quot;, 0)<br>        ))<br><br>    return Session(<br>        id=session_data[&quot;id&quot;],<br>        app_name=session_data[&quot;app_name&quot;],<br>        user_id=session_data[&quot;user_id&quot;],<br>        state=session_data.get(&quot;state&quot;, {}),<br>        events=events<br>    )</pre><h3>3. Implementing Core Methods</h3><pre>@override<br>async def create_session(<br>    self,<br>    *,<br>    app_name: str,<br>    user_id: str,<br>    state: Optional[Dict[str, Any]] = None,<br>    session_id: Optional[str] = None<br>) -&gt; Session:<br>    async with self._lock:<br>        session_id = session_id or str(uuid.uuid4())<br>        session = Session(<br>            id=session_id,<br>            app_name=app_name,<br>            user_id=user_id,<br>            state=state or {},<br>            events=[]<br>        )<br>        # Save to storage<br>        session_path = self._get_session_path(app_name, user_id, session_id)<br>        self._fs.makedirs(os.path.dirname(session_path), exist_ok=True)<br>        with self._fs.open(session_path, &#39;w&#39;) as f:<br>            json.dump(self._session_to_dict(session), f, indent=2)<br>        # Cleanup old sessions<br>        await self._cleanup_old_sessions(app_name, user_id)<br>        return session<br><br>@override<br>async def get_session(<br>    self,<br>    *,<br>    app_name: str,<br>    session_id: str,<br>    user_id: str,<br>    **kwargs<br>) -&gt; Optional[Session]:<br>    async with self._lock:<br>        session_path = self._get_session_path(app_name, user_id, session_id)<br><br>        if self._fs.exists(session_path):<br>            with self._fs.open(session_path, &#39;r&#39;) as f:<br>                session_data = json.load(f)<br>                # Check if expired<br>                if self._is_session_expired(session_data):<br>                    self._fs.rm(os.path.dirname(session_path), recursive=True)<br>                    return None<br>                return self._dict_to_session(session_data)<br>        return None</pre><h3>4. Artifact Versioning</h3><p>The FsspecArtifactService implements versioning for files, images, and binary data:</p><pre>@override<br>async def save_artifact(<br>    self,<br>    *,<br>    app_name: str,<br>    user_id: str,<br>    filename: str,<br>    artifact: types.Part,<br>    session_id: Optional[str] = None,<br>    custom_metadata: Optional[Dict[str, Any]] = None,<br>) -&gt; int:<br>    async with self._lock:<br>        artifact_path = self._artifact_path(app_name, user_id, filename, session_id)<br>        # Get next version number<br>        latest_version = self._get_latest_version(artifact_path)<br>        new_version = latest_version + 1<br>        version_path = f&quot;{artifact_path}/v{new_version}&quot;<br>        self._fs.makedirs(version_path, exist_ok=True)<br>        # Save metadata and data<br>        metadata = {<br>            &quot;version&quot;: new_version,<br>            &quot;canonical_uri&quot;: version_path,<br>            &quot;custom_metadata&quot;: custom_metadata or {},<br>            &quot;create_time&quot;: time.time(),<br>            &quot;mime_type&quot;: artifact.inline_data.mime_type if artifact.inline_data else None,<br>            &quot;part_data&quot;: self._part_to_dict(artifact)<br>        }<br>        with self._fs.open(f&quot;{version_path}/artifact.json&quot;, &#39;w&#39;) as f:<br>            json.dump(metadata, f, indent=2)<br>        return new_version</pre><p>Artifact structure:</p><pre>./artifact_data/<br>  └── my_app/<br>      └── user_123/<br>          ├── user/report.pdf/<br>          │   ├── v1/artifact.json<br>          │   └── v2/artifact.json<br>          └── session_456/chart.png/<br>              └── v1/artifact.json</pre><h3>Usage Example</h3><p>Here’s how to use these services with an ADK agent:</p><pre>from google.adk.agents import LlmAgent<br>from google.adk.runners import Runner<br>from fsspec_session_service import FsspecSessionService<br>from fsspec_memory_service import FsspecMemoryService<br>from fsspec_artifact_service import FsspecArtifactService<br><br># Initialize services with local storage<br>session_service = FsspecSessionService(<br>    base_path=&quot;./persistent_data/sessions&quot;,<br>    ttl_days=30<br>)<br><br>memory_service = FsspecMemoryService(<br>    base_path=&quot;./persistent_data/memory&quot;,<br>    ttl_days=90<br>)<br><br>artifact_service = FsspecArtifactService(<br>    base_path=&quot;./persistent_data/artifacts&quot;<br>)<br><br># Create agent<br>agent = LlmAgent(<br>    name=&quot;assistant&quot;,<br>    model=&quot;gemini-2.5-flash&quot;,<br>    instruction=&quot;You are a helpful assistant with persistent memory.&quot;<br>)<br><br># Run with persistent storage<br>runner = Runner(<br>    agent=agent,<br>    app_name=&quot;my_app&quot;,<br>    session_service=session_service,<br>    memory_service=memory_service,<br>    artifact_service=artifact_service<br>)<br><br># Use the agent<br>async for event in runner.run_async(<br>    user_id=&quot;user_123&quot;,<br>    session_id=&quot;session_456&quot;,<br>    new_message=content<br>):<br>    print(event)</pre><h3>Cloud Storage Example</h3><p>Switch to Google Cloud Storage by changing just the base_path:</p><pre># Use Google Cloud Storage<br>session_service = FsspecSessionService(<br>    base_path=&quot;gs://my-bucket/adk-sessions&quot;,<br>    ttl_days=30<br>)<br><br># Or use S3<br>session_service = FsspecSessionService(<br>    base_path=&quot;s3://my-bucket/adk-sessions&quot;,<br>    ttl_days=30,<br>    key=&quot;AWS_ACCESS_KEY&quot;,<br>    secret=&quot;AWS_SECRET_KEY&quot;<br>)</pre><h3>Performance Considerations</h3><p>Disk I/O overhead: Yes, there’s a performance trade-off. Every operation involves file system reads/writes instead of memory access. For high-throughput applications, consider:</p><ol><li>Caching layer: Add an in-memory cache in front of fsspec</li><li>Batch writes: Buffer multiple events before writing</li><li>Async I/O: Use async file operations (already implemented)</li><li>Cloud-native solutions: For production, consider Vertex AI Agent Engine with built-in persistence</li></ol><p>When to use this approach:</p><ul><li>Development and testing</li><li>Low-to-medium traffic applications</li><li>Learning how ADK extensibility works</li><li>Proof-of-concept projects</li></ul><h3>Memory Search: Room for Improvement</h3><p>The current FsspecMemoryService uses simple keyword matching:</p><pre>words_in_query = _extract_words_lower(query)<br># Match if any word appears in the event<br>if any(query_word in words_in_event for query_word in words_in_query):<br>    response.memories.append(memory_entry)</pre><p>For production, you should implement semantic search using:</p><ul><li>Vertex AI Embeddings: Convert text to vectors</li><li>Vector databases: Chroma, Pinecone, or Vertex AI Vector Search</li><li>Similarity search: Find semantically related memories, not just keyword matches</li></ul><h3>Key Takeaways</h3><ol><li>ADK is extensible: Base classes like BaseSessionService are designed for custom implementations</li><li>fsspec provides flexibility: One codebase works with local disk, GCS, S3, Azure, etc.</li><li>TTL and limits prevent data bloat: Automatic cleanup keeps storage under control</li><li>Versioning matters: Artifacts support multiple versions for rollback and history</li><li>Trade-offs exist: Persistence costs performance, but gains durability</li></ol><h3>Next Steps</h3><p>Future improvements could include:</p><ul><li>In-memory caching layer for better performance</li><li>Vector-based semantic search for memory retrieval</li><li>Compression for large artifacts</li></ul><h3>Resources</h3><ul><li><a href="https://google.github.io/adk-docs/">Google ADK Documentation</a></li><li><a href="https://filesystem-spec.readthedocs.io/">fsspec Documentation</a></li></ul><p>Have you built extensions for Google ADK? Share your experience in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68f4e7c145c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Drawing Charts in Your AI Agent Frontend with Google ADK]]></title>
            <link>https://medium.com/@dconsonni/drawing-charts-in-your-ai-agent-frontend-with-google-adk-9c74a4a98931?source=rss-e6e7ecedc541------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c74a4a98931</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[google-adk]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Davide Consonni]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 11:27:18 GMT</pubDate>
            <atom:updated>2026-01-02T11:27:18.895Z</atom:updated>
            <content:encoded><![CDATA[<h4>a practical, production-ready guide to agent-generated visualizations using ADK Artifacts</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CYPKpHCnjTw-bhqmktB7kA.png" /><figcaption>Output using vis-network lib</figcaption></figure><p>When your Google ADK agent analyzes data and you ask “show me a chart,” you want actual visual charts in your frontend — not just text descriptions.</p><p>Here’s how to build it the ADK-native way using Artifacts, with working code you can deploy today.</p><h3>The Architecture</h3><p>Key insight: Separate data from presentation. The agent creates chart configurations (JSON), stores them as ADK Artifacts, and your frontend renders them with Apache ECharts, vis-network or other libraries.</p><p>Flow:</p><ol><li>User: <em>“Show me sales by status”</em></li><li>Agent → create_chart() tool → saves config as ADK Artifact</li><li>API → loads artifacts after execution</li><li>Frontend → receives config → renders with ECharts</li></ol><pre>Agent (Backend)          API (Middleware)         Frontend<br>     |                        |                       |<br>create_chart() ──────&gt; save_artifact()                |<br>     |                        |                       |<br>     |                  list_artifacts() ────────&gt; {charts: [...]}<br>     |                        |                       |<br>     |                        |                  echarts.init() → 📊</pre><h3>Step 1: Create the Chart Tool</h3><p>The magic happens with ToolContext—ADK automatically injects it when you declare it as the last parameter:</p><pre># tools.py<br>from google.adk.tools import ToolContext<br>from google.genai import types<br>import json<br><br>async def create_chart(<br>    chart_type: str,<br>    title: str,<br>    data: dict,<br>    description: str = None,<br>    tool_context: ToolContext = None  # ADK injects this!<br>) -&gt; dict:<br>    &quot;&quot;&quot;Create a visual chart. MANDATORY DATA STRUCTURES:<br>    <br>    Args:<br>        chart_type: &quot;bar&quot;, &quot;line&quot;, &quot;pie&quot;, &quot;gauge&quot;, &quot;scatter&quot;, &quot;heatmap&quot;<br>        title: Chart title<br>        data: Dict matching these EXACT schemas per type:<br>        <br>            - BAR/LINE:<br>              {&quot;xAxis&quot;: [&quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;], <br>               &quot;series&quot;: [{&quot;name&quot;: &quot;Sales&quot;, &quot;type&quot;: &quot;bar&quot;, &quot;data&quot;: [10, 20, 15]}]}<br>            <br>            - PIE:<br>              {&quot;series&quot;: [{&quot;type&quot;: &quot;pie&quot;, <br>                           &quot;data&quot;: [{&quot;name&quot;: &quot;A&quot;, &quot;value&quot;: 10}, <br>                                    {&quot;name&quot;: &quot;B&quot;, &quot;value&quot;: 20}]}]}<br>            <br>            - GAUGE:<br>              {&quot;series&quot;: [{&quot;type&quot;: &quot;gauge&quot;, <br>                           &quot;data&quot;: [{&quot;value&quot;: 85, &quot;name&quot;: &quot;Performance%&quot;}]}]}<br>        <br>        description: Optional text<br>    &quot;&quot;&quot;<br>    chart_config = {<br>        &quot;type&quot;: chart_type,<br>        &quot;title&quot;: title,<br>        &quot;data&quot;: data,<br>        &quot;description&quot;: description<br>    }<br>    <br>    # Save as ADK artifact (scoped to session automatically!)<br>    if tool_context:<br>        chart_json = json.dumps(chart_config).encode(&#39;utf-8&#39;)<br>        safe_title = &quot;&quot;.join(c if c.isalnum() or c in (&#39; &#39;, &#39;_&#39;, &#39;-&#39;) else &#39;_&#39; for c in title)<br>        <br>        # Create Part with inline_data<br>        chart_part = types.Part(<br>            inline_data=types.Blob(<br>                mime_type=&quot;application/json&quot;,<br>                data=chart_json<br>            )<br>        )<br>        <br>        await tool_context.save_artifact(<br>            filename=f&quot;chart_{safe_title[:50]}.json&quot;,<br>            artifact=chart_part<br>        )<br>    <br>    return {&quot;success&quot;: True, &quot;message&quot;: f&quot;Chart &#39;{title}&#39; created&quot;}</pre><p>Critical details:</p><ol><li>tool_context: ToolContext = None - ADK injects this automatically at runtime</li><li>Detailed docstring — Gemini needs exact examples to generate correct data structures</li><li>types.Part(inline_data=types.Blob(...)) - Correct ADK artifact format</li></ol><h3>Step 2: Register with Agent</h3><pre># agent.py<br>from google.adk.agents import Agent<br>from tools import create_chart<br><br>agent = Agent(<br>    model=&quot;gemini-2.5-flash&quot;,<br>    name=&quot;analyst_agent&quot;,<br>    instruction=&quot;You analyze data and create visualizations using the create_chart tool.&quot;,<br>    tools=[create_chart]  # ADK auto-wraps functions<br>)</pre><p>ADK magic: When you pass a function with tool_context: ToolContext, ADK:</p><ul><li>Auto-wraps it in FunctionTool</li><li>Excludes tool_context from LLM&#39;s function declaration</li><li>Injects tool_context at runtime with session info</li></ul><h3>Step 3: Load Artifacts in API</h3><p>After agent execution, load the chart artifacts:</p><pre># api.py<br>from fastapi import FastAPI<br>import json<br><br>app = FastAPI()<br><br>@app.post(&quot;/chat&quot;)<br>async def chat(message: str, session_id: str, user_id: str):<br>    runner = get_runner()<br>    <br>    # Run agent (artifacts saved during execution)<br>    response_text = &quot;&quot;<br>    async for event in runner.run_async(<br>        session_id=session_id,<br>        user_id=user_id,<br>        new_message=message<br>    ):<br>        if hasattr(event, &#39;content&#39;):<br>            for part in event.content.parts:<br>                if hasattr(part, &#39;text&#39;):<br>                    response_text += part.text<br>    <br>    # Load charts from artifacts<br>    artifact_service = runner.artifact_service<br>    artifact_keys = await artifact_service.list_artifact_keys(<br>        app_name=&#39;my_app&#39;,<br>        user_id=user_id,<br>        session_id=session_id<br>    )<br>    <br>    charts = []<br>    for key in artifact_keys:<br>        if key.startswith(&quot;chart_&quot;):<br>            artifact = await artifact_service.load_artifact(<br>                app_name=&#39;my_app&#39;,<br>                user_id=user_id,<br>                session_id=session_id,<br>                filename=key<br>            )<br>            chart_data = json.loads(artifact.inline_data.data)<br>            charts.append(chart_data)<br>    <br>    return {<br>        &quot;response&quot;: response_text,  # Text answer<br>        &quot;charts&quot;: charts             # Chart configs (separate!)<br>    }</pre><p>Key: Charts are loaded after execution and returned in a separate field. Clean separation!</p><h3>Step 4: Render in Frontend</h3><pre>// chart-renderer.js<br>function renderChart(chartConfig) {<br>    const chartDiv = document.createElement(&#39;div&#39;);<br>    chartDiv.style.width = &#39;100%&#39;;<br>    chartDiv.style.height = &#39;400px&#39;;<br>    <br>    const chart = echarts.init(chartDiv);<br>    <br>    const option = {<br>        title: { text: chartConfig.title },<br>        tooltip: {},<br>        ...chartConfig.data  // Use agent&#39;s data structure directly<br>    };<br>    <br>    chart.setOption(option);<br>    return chartDiv;<br>}<br><br>// Usage<br>fetch(&#39;/chat&#39;, {<br>    method: &#39;POST&#39;, <br>    body: JSON.stringify({message, session_id, user_id})<br>})<br>.then(r =&gt; r.json())<br>.then(data =&gt; {<br>    // Render text<br>    showMessage(data.response);<br>    <br>    // Render charts<br>    data.charts.forEach(chart =&gt; {<br>        const element = renderChart(chart);<br>        chatContainer.appendChild(element);<br>    });<br>});</pre><h3>How Artifacts Work</h3><p>ADK Artifacts are automatically scoped to (app_name, user_id, session_id). When a tool saves an artifact:</p><pre>async def create_chart(..., tool_context: ToolContext = None):<br>    await tool_context.save_artifact(<br>        filename=&quot;chart.json&quot;,<br>        artifact=chart_part<br>    )</pre><p>The framework:</p><ol><li>Associates it with the current session</li><li>Makes it accessible only to that user/session</li><li>Handles versioning (each save = new version)</li><li>Provides persistence options (in-memory or GCS)</li></ol><p>When you load artifacts in the API:</p><pre>artifact_keys = await artifact_service.list_artifact_keys(<br>    app_name=&#39;my_app&#39;,<br>    user_id=user_id,<br>    session_id=session_id<br>)</pre><p>You get only artifacts for that specific session. No manual state management needed.</p><h3>Production Tips</h3><h3>1. Prevent Chart Accumulation (Critical!)</h3><p>Problem: Artifacts persist in the session. Without cleanup, charts accumulate:</p><ul><li>Request 1: User gets Chart A</li><li>Request 2: User gets Chart A + Chart B</li><li>Request 3: User gets Chart A + Chart B + Chart C ❌</li></ul><p>Solution: Delete artifacts immediately after loading:</p><pre>for key in artifact_keys:<br>    if key.startswith(&quot;chart_&quot;):<br>        # Load<br>        artifact = await artifact_service.load_artifact(...)<br>        charts.append(json.loads(artifact.inline_data.data))<br>        <br>        # Delete immediately to prevent accumulation<br>        await artifact_service.delete_artifact(<br>            app_name=&#39;my_app&#39;,<br>            user_id=user_id,<br>            session_id=session_id,<br>            filename=key<br>        )</pre><p>Now each response contains only new charts from that request!</p><h3>2. Schema Documentation is Everything</h3><p>Without explicit examples, agents guess formats → rendering errors.</p><p>Bad:</p><pre>&quot;&quot;&quot;data: Chart data dict&quot;&quot;&quot;</pre><p>Good:</p><pre>&quot;&quot;&quot;<br>data: Dict with exact structure:<br>    - PIE: {&quot;series&quot;: [{&quot;type&quot;: &quot;pie&quot;, &quot;data&quot;: [{&quot;name&quot;: &quot;A&quot;, &quot;value&quot;: 10}]}]}<br>&quot;&quot;&quot;</pre><p>In production, detailed schemas reduced our errors from 30% to &lt;2%.</p><h3>2. Handle Edge Cases</h3><pre># When agent creates chart without text<br>if not response_text and charts:<br>    response_text = &quot;Here&#39;s the visualization:&quot;</pre><h3>3. Multiple Chart Types</h3><pre># Pie chart<br>create_chart(&quot;pie&quot;, &quot;Distribution&quot;, {&quot;series&quot;: [...]})<br><br># Bar chart  <br>create_chart(&quot;bar&quot;, &quot;Trends&quot;, {&quot;xAxis&quot;: [...], &quot;series&quot;: [...]})<br><br># Gauge<br>create_chart(&quot;gauge&quot;, &quot;Performance&quot;, {&quot;series&quot;: [{&quot;data&quot;: [{&quot;value&quot;: 85}]}]})</pre><h3>4. Session Isolation is Automatic</h3><p>Artifacts are scoped to (app_name, user_id, session_id). Each session has isolated artifact storage.</p><h3>Complete Working Example</h3><pre># tools.py<br>from google.adk.tools import ToolContext<br>from google.genai import types<br>import json<br><br>async def create_chart(<br>    chart_type: str,<br>    title: str, <br>    data: dict,<br>    description: str = None,<br>    tool_context: ToolContext = None<br>) -&gt; dict:<br>    &quot;&quot;&quot;Create chart. See full docstring with schemas above.&quot;&quot;&quot;<br>    config = {&quot;type&quot;: chart_type, &quot;title&quot;: title, &quot;data&quot;: data, &quot;description&quot;: description}<br>    <br>    if tool_context:<br>        chart_part = types.Part(<br>            inline_data=types.Blob(<br>                mime_type=&quot;application/json&quot;,<br>                data=json.dumps(config).encode(&#39;utf-8&#39;)<br>            )<br>        )<br>        await tool_context.save_artifact(<br>            filename=f&quot;chart_{title[:30]}.json&quot;,<br>            artifact=chart_part<br>        )<br>    <br>    return {&quot;success&quot;: True, &quot;message&quot;: f&quot;Chart &#39;{title}&#39; created&quot;}<br><br># agent.py<br>from google.adk.agents import Agent<br>agent = Agent(model=&quot;gemini-2.5-flash&quot;, tools=[create_chart])<br><br># api.py - see Step 3 for artifact loading</pre><h3>Bonus: LiteLLM Integration</h3><p>We use <a href="https://github.com/BerriAI/litellm">LiteLLM</a> for model flexibility:</p><pre>from google.adk.models.lite_llm import LiteLlm<br><br>agent = Agent(<br>    model=LiteLlm(<br>        model=&quot;vertex_ai/gemini-2.5-flash&quot;, # LiteLLM routing via config<br>        # Swap easily: &quot;openai/gpt-4o&quot;, &quot;anthropic/claude-4-5-sonnet&quot;<br>    ),<br>    tools=[create_chart]<br>)</pre><p>Change models via config — no code changes needed.</p><h3>Other example</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZVxB1DWdNZcMAriBgUrHwA.png" /><figcaption>Output using Apache ECharts lib</figcaption></figure><h3>Conclusion</h3><p>With ADK Artifacts, you get a straightforward solution for agent-generated charts:</p><ol><li>Agent creates chart configs using create_chart tool</li><li>ADK stores them as session-scoped artifacts</li><li>API loads artifacts after execution</li><li>Frontend renders with your choice of library</li></ol><p>The pattern is clean, framework-native, and scales naturally.</p><p>Try it yourself! The complete working example is production-ready.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c74a4a98931" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Coding Agents with Language Server Protocols on Large Codebases]]></title>
            <link>https://medium.com/@dconsonni/using-coding-agents-with-language-server-protocols-on-large-codebases-24334bfff834?source=rss-e6e7ecedc541------2</link>
            <guid isPermaLink="false">https://medium.com/p/24334bfff834</guid>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[enterprise-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Davide Consonni]]></dc:creator>
            <pubDate>Thu, 25 Dec 2025 10:42:43 GMT</pubDate>
            <atom:updated>2025-12-25T10:42:43.333Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyZBpP9JtHBgkhmjJ7zfIQ.jpeg" /></figure><p>When people talk about coding agents, the conversation often stays at a very high level. “AI that writes code”, “AI that understands your project”, “AI pair programming”.</p><p>If you work in system integration or on large enterprise projects, you probably recognize the gap between these promises and what actually works in practice.</p><p>On small repositories, almost any coding agent looks impressive. On large, old, multi-language codebases, things change very quickly. This is where combining coding agents with Language Server Protocols (LSP) becomes not just useful, but fundamental.</p><p>And I think this combination is worth testing seriously.</p><h3>The challenge with large codebases</h3><p>A large enterprise codebase is not just “many files”. It usually means multiple languages and frameworks, years of accumulated decisions, implicit conventions that exist only in people’s heads, and code that compiles only because everything fits together in a very specific way.</p><p>A pure LLM-based coding agent sees this code as text. A human developer sees structure, symbols, types, references, errors, and intent. The gap between those two views is exactly where most AI coding tools struggle.</p><h3>What LSP brings to the table</h3><p>Language Server Protocol is not new, and it is not AI. It is boring, deterministic, and extremely precise.</p><p>An LSP knows where a symbol is defined, how many times it is used, what type a variable really has, and whether a change introduces a compile or lint error. Most IDEs already rely on LSPs to give you “go to definition”, red underlines, and refactoring tools.</p><p>The key idea is simple: LSPs understand code structure, while LLMs understand intent. Separately, both are limited. Together, they become much more powerful.</p><h3>Why this matters for coding agents</h3><p>When you connect a coding agent to LSPs, it doesn’t need to guess the structure of the codebase. It can ask the LSP directly.</p><p>This changes the role of the agent completely. It is no longer just generating code based on patterns it has seen during training. It is reasoning on top of reliable, deterministic information about your specific project.</p><p>Tools like Claude Code are being designed with this kind of integration in mind, working close to the developer workflow through the terminal and real files. But the principle applies broadly to any coding agent that can leverage LSP data.</p><h3>A concrete example: refactoring a legacy service</h3><p>Imagine a Java service that has been in production for years. There is a class called OrderProcessor. It is used everywhere, and nobody wants to touch it because the risk feels too high.</p><p>You ask your coding agent: “I want to split OrderProcessor into smaller components without breaking existing behavior.”</p><p>Without LSP, the agent can read the file, make assumptions, and propose a refactor that looks reasonable. But “looks reasonable” is not the same as “actually works”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oUC0r9wlJBs1Gyx0gbpDnA.png" /><figcaption>Claude Code Change log</figcaption></figure><p>With LSP connected, something very different happens. The agent can ask the LSP where OrderProcessor is referenced across the entire codebase, understand which methods are part of the public contract, detect which changes would introduce compilation errors, and rename symbols safely everywhere they appear.</p><p>Now the workflow changes. The agent reasons about what should change, and the LSP guarantees how the change is applied correctly. This is the point where the tool stops being “smart autocomplete” and starts behaving like a junior developer who never forgets to update all references.</p><h3>Why this matters for system integrators</h3><p>In system integration projects, you rarely work on greenfield code. You work on systems that must keep running, often with tight deadlines and high consequences for mistakes.</p><p>The combination of coding agents and LSP allows you to move faster without breaking contracts, refactor with confidence on large repositories, and use AI where it adds value without trusting it blindly.</p><p>This is not about replacing IDEs or developers. It is about separating responsibilities clearly: LLMs handle reasoning, explanation, and intent, while LSPs handle correctness, structure, and guarantees.</p><h3>A more realistic future for coding agents</h3><p>If you strip away the hype, this approach is surprisingly conservative. We are not asking AI to “understand everything” or to replace human judgment. We are letting deterministic tools do what they already do well, and letting AI reason on top of that foundation.</p><p>For complex codebases, this is not a nice-to-have. It is the difference between an interesting demo and a tool you can actually use in production.</p><p>And maybe that is the most important lesson: the future of coding agents is not pure AI, but AI grounded in real developer tooling.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24334bfff834" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>