Introduction
Konnichiwa! Welcome to the AI Automation Dojo. Today, we are tackling the ultimate corporate paradox: wanting all the genius of cloud-based AI, while possessing a deeply ingrained, very healthy dose of cloud paranoia. We will explore how a major Lithuanian energy company managed to build a brilliant AI Agent to classify legal texts without accidentally giving the cloud the keys to the corporate kingdom or shutting down the power grid. And all of this to save their lawyers from quitting to become artisanal goat farmers.
I’m your host, Andrzej Kinastowski, one of the founders of Office Samurai, where we firmly believe that “move fast and break things” is a frankly terrifying slogan when you are responsible for the national electricity supply. So, whether you are a lawyer tired of losing an hour a day to purely mind-numbing data retrieval, or a Chief Information Security Officer who stress-eats antacids every time someone mentions “Generative AI,” you are in the right place. Now grab your favorite katana (or just the first 3,000 characters of your longest contract), and let’s get to it!
AI Agents: From hype to reality
Let me paint you a picture. We recently worked with a major Lithuanian energy company. Now, these folks are not rookies. They already have a highly skilled, fully operational RPA team that actually knows what they are doing. But, like every other corporation on the planet right now, they wanted to kickstart their journey into the world of AI Agents.
They did not call us in to build a magical black box that runs the entire company while executives play golf. They had a much more grounded ambition. They simply wanted to see if AI Agents could actually do something useful, instead of just confidently hallucinating a brand new set of corporate tax codes. Because they are an energy company, they operate heavily on-premise and are understandably cautious about throwing all their operations into the cloud. After all “move fast and break things” is a frankly terrifying slogan when you are responsible for the power grid.
So we took a more tactical approach. We did not just build the solution, hand over an invoice, and walk away. Instead, we gave their team an intensive two-day training on UiPath Agents and Maestro. Then, we stepped back into a mentoring role and guided them through the actual project. The beauty of this setup? The client built the entire thing with their own hands. It was the perfect scenario: a highly capable team, a very healthy dose of cloud paranoia, and a genuine desire to separate the AI hype from actual, measurable reality.
Why keyword-based automation fails legal teams
Let us talk about what we could call the Sisyphus of Legal Acts. Picture this. Every single morning, highly educated professionals had to sit down, take a deep breath, and manually crawl through public government websites just to find new legal acts. It is the quintessential “Nightmare Task”. You spend years studying, only to start your workday playing an incredibly boring version of hide-and-seek with a municipal server.

Naturally, they knew this was a terrible use of their time. So they did what any self-respecting corporate department does, they applied a “Macro Band-Aid”. They tried to fix the problem using basic, keyword-based macros. Let me tell you, trying to parse complex legal documents with a list of rigid keywords is like trying to perform heart surgery with a fork. It is messy, it is highly prone to error, and absolutely nobody enjoys doing it. The Lithuanian language is tricky enough, but legal Lithuanian language? If a macro is just looking for a specific term, it has absolutely no idea about the context. It cannot tell the difference between a minor procedural update and a massive compliance overhaul.
What was the real impact here? It cost the team about an hour a day of purely mind-numbing work. Now, let us be honest. Losing an hour a day is not a “company-ending” disaster. The board of directors is not going to convene an emergency midnight session over it. But that is precisely why it is such a brilliant candidate for an Office Samurai “strategic strike”. When you want to test the waters of AI Agents and actually learn the technology, you do not start by handing over the keys to the enterprise payroll system. You find a contained, incredibly annoying bottleneck, and you use it to prove the concept works. It is the perfect low-risk dojo to train your shiny new technology skills.
Hands vs. Brains: Designing the AI architecture
So, how do you actually fix this bottleneck without accidentally giving an AI the keys to the corporate kingdom? You use a classic division of labor. Think of it like a high-end restaurant. You do not want your Michelin-star executive chef out in the alley scrubbing potatoes, and you certainly do not want the dishwasher attempting a delicate, complex soufflé. You have to separate the muscle from the intelligence. To pull this off, we used UiPath to build a two-part architecture.
First, we have “The Hands”. These are your standard Unattended Robots. They are the blue-collar muscle of the operation. Their job is beautifully simple and relentlessly boring. Every day, they march out into the digital wilderness of public government websites, log in, grab the new legal links, and do all the heavy lifting of data retrieval. They do not sit around pondering the philosophical implications of municipal zoning laws. They just lift, carry, and drop the data on the desk.
Then, we have “The Brain”. This is the UiPath Agent. Instead of relying on a rigid, miserable list of keywords – which, as we established, is about as effective as trying to catch rain with a tennis racket – the Agent uses something called “semantic understanding.” It actually comprehends the context of the text.

It takes those messy, complicated legal documents brought in by the Hands and compares them against a predefined list of categories stored in a vector database, or what the tech world dramatically calls “the Index”. The Agent reads the document, figures out what the law is actually about, and categorizes it with genuine intelligence.
But here is the absolute best part, the reason your Chief Information Security Officer can finally stop stress-eating antacids. The Unattended Robot also acts as a strict guardrail. It sits right there as a classical logic layer between the highly creative AI and your delicate internal systems. The AI gets to do the smart thinking, but it does not have the clearance to touch the actual controls. So, even if the Agent suddenly decides it wants to confidently hallucinate an entirely new branch of corporate law, it has absolutely no way to push that hallucination directly into your systems. You get all the incredible cognitive benefits of AI, safely locked behind a highly effective digital bouncer.
GenAI Web Reader vs. Classic Scraping
So now we have this brilliant, heavily-guarded AI Agent ready to work. But there is a very practical question – how does it actually read the law? You cannot exactly slide a piece of paper under the server room door. We had a classic architectural showdown between two approaches: the “Web Reader” and good old-fashioned “Scraping”. Let us call it The Duel.
In the left corner, we have the GenAI Web Reader.

Think of this as the luxury, chauffeur-driven option. It is incredibly convenient. You just point the Agent at a URL, and it figures out how to extract the meaning, even if the government website looks like it was designed in 1997 by someone who was fiercely passionate about drop-down menus. It handles the structural mess for you. But it costs additional money, or rather Platform Units, per read. Depending on a scale of the process, it may become the corporate equivalent of letting your entire department order premium room service every single day. Eventually, the CFO is going to notice the bill and start asking uncomfortable questions.
In the right corner, we have the Scraping approach. This is your standard, blue-collar RPA robot doing what it has done beautifully for years. If the text on the page is relatively easy to find and consistently formatted, the robot just goes in, scrapes the text directly, and hands it to the Agent via an HTTP request. No fancy GenAI reader required. It is the digital equivalent of bringing a homemade sandwich to work. It is cheap, it is highly efficient, and it does not burn through your premium AI budget just to read a paragraph about municipal tax codes.
The winner of this duel? It entirely depends on the battlefield. If the website is a chaotic, unreadable disaster, you sigh, open the corporate wallet, and use the Web Reader. But if the site is clean and predictable, like in this particular case, you send in the scraping robot to do the extraction. You save your AI Units for the actual cognitive work – the thinking. Because here at Office Samurai, we believe you should use the right tool for the job, rather than just throwing expensive AI at every single problem until your IT budget spontaneously catches fire.
Security & the 10,000 character limit
Let us take a brief detour into what you could call “The Nerd Stuff”. Because it is one thing to have a brilliant, frictionless AI idea on a whiteboard, and it is an entirely different thing to actually make corporate IT infrastructure cooperate without triggering a company-wide panic.
Here was the primary technical hurdle. Our client is an energy company. Because they essentially keep the lights on for a living, their RPA robots live strictly on-premise. They are locked down tighter than a submarine. But the shiny new AI Agent? That has to live in the Cloud Orchestrator. So, you have a highly secure, local robot that needs to ask a cloud-based AI for advice, but they are absolutely not allowed to be in the same room. How do they communicate? Through the ancient, mystical art of HTTP requests. It is the digital equivalent of passing carefully folded notes under a heavy steel door while the Chief Information Security Officer paces the hallway.
But this brings us to the next problem: The “10,000 Character” Trap. If you have ever looked at a legal act, you know they are not exactly known for their brevity. They are dense, sprawling, and usually longer than a CVS receipt. However, when you are passing notes via HTTP requests, you hit a hard wall. The system limits the extracted text you can send to the Agent to a maximum of 10,000 characters. If you try to shove an entire 40-page municipal zoning law into that request, the system just chokes. You simply cannot do it.
So, what did the team do? They tested different lengths and realized something beautiful – lawyers front-load their documents.

They discovered that if you just send the first 3,000 characters, the Agent gets all the context it needs to figure out the correct category. The rest is just legal filler. By chopping the text down, the Agent processed it faster and categorized it with the exact same accuracy.
Finally, let us talk about the Security Dance, or how to handle the inevitable “Cloud Panic”. As an energy company, they are understandably terrified of sending any sensitive internal data into the cloud. So, they performed a masterclass in data minimization. The local, on-premise robots go out to the public internet, scrape the public legal text, and send only that heavily trimmed public text up to the Cloud Agent. The Agent sits in its cloud tower, reads the public law, says, “Ah, this is a tax law,” and sends that single category back down. The cloud never sees a single internal email address. It never touches a private SharePoint file. The local robot takes the Agent’s answer and securely handles the internal email distribution to the designated lawyers. You get all the incredible brainpower of the cloud, without actually giving the cloud the keys to your house.
Case Study results: 93% accuracy
Let us talk about the actual payoff, what we like to call the ROI of Sanity. Because at the end of the day, you can build the most elegant, heavily guarded AI architecture in the world, but if it does not actually work, you have just created a very expensive, highly complicated digital paperweight. Well, in this case, I am happy to report that the Orchestrator grass is indeed green. From a purely technical standpoint, the process deployment was a 100% success. It runs, it fetches, it thinks, and it emails – all without triggering a single corporate fire alarm.
But what about the actual brainpower? The AI Agent hit an accuracy rate of 93%. Think about that for a second. That is a solid “A” in any university. More importantly, in several documented instances, the Agent actually categorized these highly dense legal acts better than an experienced human operator. And honestly, can you blame the human? If you are on your fortieth page of Lithuanian municipal tax updates before your morning coffee, your brain is going to inevitably miscategorize something. The AI Agent, on the other hand, never gets bored, never needs a double espresso, and never questions its life choices while staring at a spreadsheet.
This brings us to exactly why this was the absolute perfect Proof of Concept. It comes down to a brilliant little safety net we call the “Low Cost of Error.” When you are testing out a brand new, highly hyped technology in a corporate environment, you do not want your first mistake to result in a multi-million dollar compliance fine. You definitely do not want it to accidentally shut off the power grid. You want low stakes. In this process, what happens if the Agent gets momentarily confused and puts a “Type A” real estate law into “Type B’s” corporate tax folder? A lawyer opens an email, realizes it is not for their department, sighs mildly, and hits “forward.” That is it. The world keeps spinning. The stakes are incredibly low, but the organizational learning is astronomically high. You get to play with the shiny new AI toys without the risk of accidentally burning down the entire playground.
Summary: Stop automating, start fixing
So, what is the grand, final takeaway from our adventure in Baltic legal acts? It is this – you have to stop looking for “things to automate” and start looking for “things worth fixing.” Saving one hour of human life every single day might not sound like it is going to fundamentally change the world. It is probably not going to make the cover of Forbes magazine. But it absolutely keeps your best, most highly educated people from throwing their hands up in despair and quitting to become artisanal goat farmers.
If you want to actually succeed with AI technologies, you cannot rely on a project pipeline full of “Excel Trap” garbage, where everyone just writes down their impossible pipe dreams and expects the automation department to magically build them. And you certainly cannot base your enterprise AI strategy on a Slack channel filled with random tech articles and wishful thinking. You need a real plan. So, if you are ready to stop playing around and start building AI solutions that actually deliver, go download the Office Samurai AI Playbook – we’ll put the link below. It will save your time, it will protect your budget, and most importantly, it might just save your sanity.




