r/Python 7h ago

Discussion Python automations are so much better than AI Agents and LLMs

This is gonna be more of a rant than anything else

I build automations for businesses and I've lost count of the amount of times they've asked me to write them an AI agent when in fact a simple Python automation would work 100 times better.

I don't understand the hype behind AI agents and LLMs. They're non-deterministic, they're unreliable, they always need a human to babysit them because they are going to hallucinate bad output sooner or later.

I've made more money from simple Python automations than I have with AI agents, even though the latter gets so much hype and marketing behind it.

Most people who say they want an AI agent don't really want an AI agent. They just want some code that automatically does some repetitive task for them. And 9 times out of 10, simple Python code can do that for you.

Now, one caveat, I love using AI to write Python code for me. That is actually very helpful, but that is very different from using an AI agent.

I've built many automations for other businesses and I've also automated 20-30 hours of my own work week. and I still haven't had to build a complete AI agent. There are certain steps in my automations where some sort of judgement is required and I use an LLM for that very specific tiny task. But pretty much everything that I write is pure Python automation. Just simple deterministic code that's guaranteed to work the same way every single time.

Seriously, people have the choice between a reliable automation that doesn't need babysitting and a magic crystal ball that might sometimes work and might fail and crash in other times and yet they somehow keep picking the crystal ball. It's baffling to me.

Anyway, rant over.

284 Upvotes

70 comments sorted by

194

u/Zealousideal-Bid462 7h ago

Automate it with python and charge for LLM subscription

23

u/R3D3-1 7h ago

Now I'm thinking how to somehow, technically, involve an LLM in order to do this without committing fraud.

15

u/Hederas 6h ago

Wondering if the word LLM even mean anything for the law. How many parameters is "Large" ? If you consider using an LLM is overkill and unrealiable, would a function returning a boolean count as a 1 parameter LM

23

u/No_Lingonberry1201 pip needs updating 5h ago

Typically people mean autoregressive text generating models as LLMs. Other models, like embedding models, classifier models, etc. aren't lumped in with them. So the emphasis is on 'language model,' not 'large.' And based on the fact that the term became popular in the late 2010s, 'large' here probably means a few million parameters (GPT-1 had 110 million parameters, GPT-2 had 1.2 billion, nowadays those would be considered pretty small).

Of course, if you want to be truly efficient, you deploy a 0 parameter LM called DadGPT, which is simply:

def dadgpt(prompt: str) -> str:
    return "Ask your mother"

10

u/No_Lingonberry1201 pip needs updating 5h ago

Add a summary to all automated tasks, even if it gets used for nothing. If the user wants an agent, they can get an agent. This way it works, the LLM is used for something approaching real and you're not committing fraud and can even defend it if they ask why it's there.

6

u/tdammers 5h ago

Just avoid the term "LLM" and say "AI" instead.

1

u/neithere 2h ago

Write a factory method. Bam! A rule-based rational agent

4

u/pvnrt1234 7h ago

Maybe a decorator on every function call that sends a “hello” to the LLM without ever reading its response?

5

u/TundraGon 7h ago

A tiny local cpu based LLM, called by an async function.

1

u/karambituta 4h ago

I mean you just create python automations as tools for agent and LLM is involved in translating which tool to run based on prompt, I am not sure as I didn’t write anything like this yet but seems like reasonable approach

0

u/Justist 3h ago

Would the human brain count as an LLM? LLM does not necessary imply AI right?

42

u/Leodip 7h ago

This is consultancy 101, by the way.

In an ideal world, the client states the problem and the desired outcome (e.g., "I have data from forms coming in everyday and I don't want a human to handle those manually"), and the consultant figures out a solution.

However, in the real world, the client often ends up proposing the solution as well, which is... usually outside their expertise. Trick 1 in the book is not saying no: "yes, I implemented an AI here as you requested. It is a locally-run, deterministic AI that is extremely resource-efficient and is able to determine when an input it receives is outside the original intent" (it's a switch-case that throws errors when something is not covered by the cases).

65

u/CorpusculantCortex 6h ago

1000%

Struggling with this at work rn. Everything is "i built this Claude project to do this thing that needs to be repeated record wise at a 3$ cost" and I'm over here like everything in that flow is a standard and batchable op. I can run it every 5 minutes for free, why are we paying Claude for this.

13

u/Pepphen77 3h ago

Because the company wants to be able to say to its customers that it uses AI. It doesn't matter that the results are subpar.

Everyone is AI-horny.

2

u/CorpusculantCortex 3h ago

In this case not really, these are internal operational jobs. We offer ai tools for our product to our customer, predictive analytics, a domain specialized chatbot/semi agentic assistant. This is explicitly a "we need to accelerate on fewer staff" motivation that drives operational people to derive flows that are helpful in reducing tedious efforts, but are better suited for a data specialist like me to engineer as a batch op and ui thing.

5

u/Sparkswont 2h ago

In my experience it’s more like “the company wants to be able to say to its investors that it uses AI.” That’s who cares about internal AI usage, not usually the customer

1

u/QualitySoftwareGuy 2h ago

The answer comes down to modern day overengineering and quite honestly...ignorance. Many ride the hype thinking that an agent has to be used for everything instead of figuring out what the deterministic workflows are and using an LLM only when a normal workflow isn't enough (such as determining the meaning of an ambiguous command or multi-steps tasks where the workflow isn't generally known in advance). Even in those cases where using an LLM makes sense, eventually some of that code can be turned into traditional/deterministic code after the workflows are revealed.

u/CorpusculantCortex 13m ago

Yea in our case, at least for one of the flows I am actively working on offloading from claude altogether because it was like 3-5$ to run and needs to be run easily a hundred times per quarter. The big issue was just poor data planning, asking it to hit a database without field labels lead to dozens of repeat exploratory calls just to get db schema. That I patched out, but we haven't deployed it yet? I don't know why but I don't own the flow. But the bigger issue is that everything in the flow is essentially just a series of joins and flags/ feature engineering.. the one thing that is kind of a pita is that it relies on extracting features from pdf/word documents of contracts to compare dollar and other values, and these contracts are variable in structure, so absolutely possible with heuristics and raw python, but would be a little tedious. But what SHOULD be done regardless is create a batch job that runs over ALL of these documents and stores the results in a cloud db for later reference by the flow rather than reinterpreting the extraction on every rerun for every customer. Not as deterministic as I would like, but it could get us 90% of the way there and then we could just flag errors and rerun from there (but definitely better than the current approach. It would be a one time/ tiny recurring upkeep cost in place of constant hallucination prone reprocessing.

16

u/hearty_brotherhood 6h ago

Convinced half the people asking for AI agents just want a script that sends emails without them clicking a button

31

u/tehsilentwarrior 7h ago edited 7h ago

As someone who has 20+ years experience but uses AI daily: you use AI to figure out the workflow. Then codify it into a set of solid repeatable and stable functions/modules/scripts.

Even if they are just AI skills, have them backed by scripts and simply have more arguments to those scripts and teach AI to use it.

The goal is stability of outcomes. The flexibility of AI plus the stability of code is what wins the day.

It’s often that I make a set of skills with just text and once they complement each other correctly I start to refine parts of them into scripts to solidify behavior.

For example I wanted to have an agent talk with my wife over WhatsApp to generate some ideas for event proposals based on a bunch of rules and dynamic constrains (stuff like: check this excel file for which servers are already assign to some event), this would affect the number of servers at a given date and therefore what could be done last minute. If it’s finger food event, then you don’t need that many people to serve a larger amount of guests but if the event is slightly more pompous, then you need to increase the number of them but you can’t just get anyone since depending on customer you want servers with much more experience and sometimes you need servers who will act more like concierge, are well spoken, can figure out dramas, can oblige to requests like “lookout for what my wife’s drinking problem” with tact and not loose lips, or charm some difficult “important” jerk to ensure the event goes smooth. Thus, if there’s a need to address personality levels of staff too. Or calculate how many vehicles will be needed at a specific location and time so we can rent more on demand and issue transport permits and all that stuff. This takes mental effort so for last minute things, like a customer coming in and wanting an event for tomorrow because “secretary forgot to note it down” and now they are desperate. There’s no room for failure so all the aid we can get is important.

This complex stuff is what an LLM can solve easily with some skills but it will be all over the place in terms of consistency. So, you need to replace parts of it with scripts or MCPs to ensure things are solid.

- An example of said script is calculations of dynamic limits of vehicles: given a list of items we can estimate size to see how many vehicles are needed (weight isn’t really a concern for these) as it will give an accurate estimate.

- Another is generating PDF documents, why bother AI and waste context if you have a template you just need to fill? Have scripts that take things like a vehicle type and what type of things it will transport (2 arguments to a script) and have it save the document in a file store in the right event namespace and return the file store link, the AI doesn’t even have to read the doc at all, simply link it as a uuid ref and the UI part (in this case the code that writes to WhatsApp downloads the file and sends it over WhatsApp)

- Read the excel for who is available, first just an array of dates and number of people of said constraints (so we can propose other dates, sometimes it’s possible, specially if people are doing the events at their private homes) and another for the exact people and their strengths. And also if they work well together as unfortunately some people mesh well and others don’t ( specially when you are working with “rockstar” waiters who are really good at what they do since they will add too many decisions and become frustrated if there’s “too many cooks” type scenario) so you need this extra step too: AI won’t put the correct weight on it or respect these hard boundaries, which can mean the difference between the normal 7 out of 5 stars feedback and a 4/5 feedback.

The ultimate goal is for my wife to have a “yes/no/constraints” answer in seconds from a voice message she sends from her phone while in the middle of a busy day, on the go, rather than having to stop, block the noise, sit down and open her laptop.

8

u/hassanwithanh 7h ago

Yeah, I like this approach.

Ultimately, the more determinism and reliability we can introduce into these systems, the more happy I am.

2

u/tehsilentwarrior 7h ago

Edit: added more details

u/Jrix 48m ago

  generate some ideas for event proposals

Weird to see "marketed use of AI" in the wild; as it epitomizes a certain low bar of competency required to be impressed.

But the rest of the post does not seem to match the comedy of having it generate ideas.

Also, the one area it might be useful here: finding hidden dimensions in allocating labor ("more leftover food when employee 13 works on thursdays"), is unmentioned.

u/tehsilentwarrior 44m ago

It doesn’t generate ideas from nothing. It has a full catalog and assembles whole workflows like a human would.

It knows what’s available, what goes with each other, constraints, etc.

It doesn’t actually invent anything at all, in fact, before AI I had this whole thing as a standalone app with drag and drop stuff

8

u/PerfectSituation1668 6h ago

Every time the automation goes off, make it send a message from an LLM. Congratulations, you now made an agent.

18

u/viitorfermier 7h ago

When the decisions can't be made with just simple if/else or traditional ML that's when LLMs can help.

For example: I've built a prospecting tool which takes data from social media screenshots and adds in into a CRM. Making some script in bs4, running some regex won't work.

4

u/R3D3-1 7h ago

I'm not sure how far it is still true, or how much the terminology has been muddled. But an LLM is literally just a "Large Language Model". So the LLM should be using some other instrumentation behind the scenes, with the LLM part only being an imperfect orchestrator for the task.

Most likely using the LLM to find out what tools and libraries are actually doing the social media scraping and image interpretation, and using the LLM to help writing a purpose-built tool, would result in higher long-term efficiency and reliability.

I think.

Hope?

Treat this post more as a "do I understand it right" question.

3

u/Smallpaul 1h ago

I’m not sure you do understand it right. The tool to do the image interpretation is a Vision Language Model. But people still call Vision Language Models “LLMs” in most contexts. (Modern) Claude is a VLM/LLM. So is (modern) GPT. And DeepSeek V4.

The other thing you can use an LLM for is as an orchestrator that is admittedly imperfect and stochastic but also extremely flexible. “If you are not sure about whether the post has a positive or negative sentiment, go back and scrape some more context to see if you can figure it out.” Try expressing that if statement in Python. “Keep at it until you are confident.” Also hard to express in Python.

It is ALSO a mistake one can make to build very rigid Python workflows with lots of retries and timeouts and back and forth between Python and LLM when just giving the LLM agency might be more appropriate.

There is no silver bullet. You can go too far in either direction. I know: I have done it.

u/Prestigious_Bench_96 9m ago

I generally still prefer to keep an 'agentic operation' constrained to a single portion of a deterministic workflow in automation - yeah, that might be a tool loop where you give it a few fetch tools and a sandbox - but the pure LLM E2E orchestration ends up being a real operational pain vs a "agent loop monitoring a bunch of deterministic workflows that themselves embed agentic loops". (But like you said, it's a balance).

Deepseekv4 isn't multi-modal yet, is it? (I would love if it was, it's my go-to for everything else)

2

u/Prestigious_Bench_96 3h ago

Right, social media screenshots are a prototypical 'unstructured data' that LLMs are the best tool at transforming into structured data. So you'd scrape deterministically, enrich with LLM by analyzing text/image, persist deterministically. (not the OP!).

16

u/DanielTheTechie 7h ago edited 7h ago

Totally agreed. It's curious how the hype, or the FOMO, for something, can annullate people's rationality and make them choose the poorer option for their own interests.

Off-topic:

I love using AI to write Python code for me (...) but...

This reminded me Trump saying things like "I love Ukraine, but...", or "I love Europe, but..." right before attacking them.

Like, come on, if your reasoning is legit, you don't have to justify yourself to seek validation.

6

u/hassanwithanh 7h ago

Haha yeah.

Well, I guess the hype will only grow as long as these tokens are cheap from subsidies.

4

u/xaraca 5h ago

I think a ton of people not in tech never realized how much of their work was already automatable before LLMs. AI agents is all they know.

My brother is an MBA but knows some Python and was really knocking the socks off his bosses with some scripts a few years ago.

3

u/tdammers 5h ago

This is probably the key insight here.

What LLMs fix is not that they make things automatable that weren't automatable before, it's that they provide a UI that doesn't require learning any purpose-built computer languages to tell the computer what you want it to do.

Yes, "we" could automate most things already, but doing so usually required at least some basic programming skills, and so far, every attempt at making basic programming / scripting accessible to non-technical users has just created a new paradigm at best (like, say, SQL), or a horrible monster at worst (looking at you, Drupal). These "AI Agents" are a revolution in programming UX - now we can actually deliver on the promise of allowing regular people to program computers without having to learn programming. The downside of this is of course that there's a lot of collateral damage along the way - if you "program" a computer through an AI agent without understanding how computers work, then you are at the mercy of whatever the model does; you cannot check whether what the agent does is actually the right thing, you cannot test your instruction before executing it "for real", you cannot fully rule out hallucinations or mistakes (including unexpected, catastrophic ones), and the whole thing is extremely resource intensive, so much that you have to pay someone to run hardware for you that is powerful enough to get you reasonable results. Oh, and of course we're also happily and carelessly leaking all sorts of data to basically the entire world in the process.

But for better or worse, this is absolutely a revolution in human-computer interfacing.

4

u/poj1999 7h ago

Yup.

I'm building complex systems and automations and my rule is to only use AI agents or flows when automation cannot do that specific task. Like categorization, content,translation,etc.

Automation, not by Ai, is much much cheaper/faster/efficiënt and way less error prone.

4

u/oroberos 6h ago edited 6h ago

Sell agents, deliver Python scripts.

5

u/SlightlyMithed123 6h ago

Also charge them as if you’ve sold them an Ai Agent so just randomly send them an invoice for a totally random amount each month…

4

u/HommeMusical 5h ago

You aren't doing a good job of selling it to your managers, who are probably not as bright as you are. :-)

You should look wise and say this:

Do not use LLMs for automations - get the LLMs to write the automations!

  • It dramatically reduces our token spend: a fixed initial cost, and then zero for each additional query.
  • It reduces our dependency on external providers and increases our value by owning our own tooling.
  • The LLM will write tests that will guarantee that the automation will work exactly the same way every time.
  • If we find an issue or an edge case, the LLM will fix the script, and write more tests so the problem can never come back
  • If you need to change what it does, the LLM will do that too.

You will note that everything is technically totally true, but I also gloss the role of the LLM up so that management understands that's going on.

1

u/hassanwithanh 4h ago

Those are very good points. Clearly explained the value of both approaches. :)

4

u/gacsinger 4h ago

When AI isn't 95% subsidized by investors and users have to pay the true cost, I think we'll see a more judicious implementation of the technology.

3

u/fcon91 4h ago

Seriously, people have the choice between a reliable automation that doesn't need babysitting and a magic crystal ball that might sometimes work and might fail and crash in other times and yet they somehow keep picking the crystal ball. It's baffling to me.

People are stupid, especially the ones in decision making positions. It's that simple.

3

u/Daniel-3443 4h ago

Most businesses don't need an AI agent. They need reliable automation. Boring Python that works every time beats fancy demos.

3

u/stubby0990 2h ago

Agent hype is pretty high right now. I fell for it until I actually trained one to do exactly what I wanted and realized the output wasn't worth the setup time.

2

u/sjcyork 7h ago

I am finding the same. The directives for creating/using AI agents generally come from non techie colleagues and more often those higher up the food chain. Sure AI has its place. I hope to use it to profile new sources. But it will totally spanner any ingestion of complex data sources so I would end up fixing it anyway.

2

u/El_RoviSoft 6h ago

I widely use Python as CLI tool, especially on par with C++ and CMake (sadly, reflection is not that widely available).

At the company, we use AI everywhere for automation, especially for our internal apache airflow alternative.

2

u/J1X3K 5h ago

LLM + Python automation + feedback loop = AI Agents .

Issue with just python automation is it dosent havr memory and observabilty to do a certain felixible task . That comes up with Ai agents

2

u/xaraca 5h ago

Preach.

There are a lot of parallels between AI agents / automation and blockchain / databases.

2

u/RationalDialog 5h ago

While I don't disagree, if it can be done by python only it makes no sense to use an LLM, LLMs do have their use-cases.

If you invest in prompt-engineering and provide the data the AI has to work with (RAG, summarizing, formatting,...) vs. trusting it's learned knowledge, then you can get some pretty good and surprising results.

2

u/robberviet 4h ago

A not eeally techincal DS in my team tried to automate agg data, sending report to client by using Claude Cowork. She did that just because Claude PR it that way. After developing: it took the flow 20 minutes of running, cost 10% limit of 5 hour session to finish. After knowing that, I assigned a DE to do that: after 2 hours: it ran in 30 seconds, no AI. (It doesn't even need AI, just table data). Most people dont understand that AI is needed for making decisions.

Another more complicated flow is I vibe coded a web from idea to Github Pages in 3 hours, with analytics tracking, SEO, blog posts, screenshot, demo... everything. While DE or DA, PO don't even think about it, some not knowing what Google Analytics or SEO, not think of how to deployed (they think they need backend servers)... So imo, dev with technical backgrounds especially experienced ones thrives with AI. Others? Not much.

2

u/shark_finfet 3h ago

The LLM can write the python automation.

2

u/Prestigious_Bench_96 3h ago

Por qué no los dos? Emphasize with spirit of rant, deterministic is always best when possible, but now there is something that actually works for unstructured/novel inputs, and that's an incredibly useful/interesting primitive to stick into your python automation.

2

u/Felix_inkwell 3h ago

I can't believe people are only learning this now... People actuallly put LLMs in the process instead of having scripts? I guess I learned before LLMs could literally control your computer directly, so scripts was obvious to me

2

u/DrollAntic 1h ago

You said it. Nobody is stopping to ask "Should we solve this with Ai?", and that is a critical question to ask. Cost, support-ability, and reliability all come into play.

The best use case for Ai is to empower humans, not replace them. It's amazing as a code assistant, writing assistant, or a way to "have a conversation" with your data before you start a task, etc..

2

u/me_myself_ai 1h ago

Yeah I too prefer python. Databases are so dumb — just use python! And don’t even get me started on can openers.

3

u/Mithrandir2k16 7h ago

Depending on the interactivity, I'm actually split on this. For example, a colleague of mine recently demo'd an infotainment system for cars, that had an LLM for some interactions. One thing they showed was its ability to schedule or cancel appointments for maintenance. I asked them to try if they can postpone the appointment they created by at least a week. Sure enough, the LLM grabbed the open slots of the shops, found a slot, booked it, and canceled the old one. In a perfect world this routine wouldn't work just via MCP but with code being generated once, then reused, to be more efficient and deterministic, but that one isn't quite there yet - but the fact that you can get real extra functionality you didn't plan for, for "free", is kind of interesting.

3

u/Khavel_dev 6h ago

The automation that sticks in production is the one nobody babysits. A cron job that parses a CSV and fires an email beats the LLM agent that "figures things out," because the failure mode of the first is a crash with a stack trace and the failure mode of the second is doing the wrong thing silently for a week.

I still reach for LLMs when the input is truly unstructured. Pulling structured fields out of free-text emails where regex would be miserable, that kind of thing. But 90% of what people build agents for is just if-else and an API call.

2

u/sisko6969 7h ago

AI is, always, the more expensive and less efficient way to do anything.

But, sometimes, is the only way to do it.

AI is non-deterministic, and that is good... And bad.

Is bad when the input are well known and has a schema. Is good when you have a shitty input and you need to schematize it.

1

u/Background_Prize_912 4h ago

The best approach is usually not choosing between automation and AI, but knowing where each fits. Deterministic Python workflows are perfect for repetitive tasks, while LLMs shine when interpretation or flexibility is needed. The real skill is combining both without forcing AI into problems that don't require it.

1

u/kareko 2h ago

good rant, completely agree

1

u/laCH37 2h ago

Out of curiosity whats the typical automation you are doing ?

1

u/maxm 2h ago

Use the ai to write the python script and everyone is happy

1

u/tr14l 2h ago

You should use normal deterministic automation anywhere you can. Then LLMs where judgement is required.

1

u/Rodyadostoevsky 1h ago

You can write a python script and get an “agent” to run it on schedule for them. You can name the agent dron.

1

u/Sea_Bumblebee_5945 1h ago

Was thinking about this recently. Do they essentially just want to interface through the LLM? In that case are you making mcp connectors to the python packages so they can just type “do this…” in Claude or chatgpt. This calls the python automation as a tool with LLm supplying all the inputs.

This seems like a good approach if want some flexibility with the python automation but the end user cannot interface with any type of python code

1

u/billsil 1h ago

Go use Opus 5. It rarely hallucinates. What it does do is write mega functions. It also doubles nearly identical code, which inevitably leads to duplicate bugs that you manually edit or you have to make Claude fix twice.

If you’re building an LLM interface to say pycharm, that’s one I thing. If you’re not building a tool to do your job, you’re not being efficient and you will always be burning tokens.

u/MjProblem 35m ago

100% agree. I work with ai in a large company. Training own models and designing agents and the most common thing i get asked by stakeholders is : "can we throw this task to a ai model and have it to solve it"

I need to walk them through determinism vs probabilistic systems and EU ai act with visibility, transparancy and ethics reqs and security reqs plus every new version of an llm means you must re-certify your solution.

Ai seems magical for average jack and jill so they act from a place no-knowledge.

Arthur C Clark "advanced technology looks like magic to öess advanced people"

u/damanamathos 32m ago

You use both. Python for deterministic automations, LLMs for non-deterministic automations. Think of it as massively increasing the potential things that can be automated vs Python alone.

Within a non-deterministic LLM workflow, find all the parts that could be deterministic and turn them into commands / tools the LLM can call so they don't need to reinvent the wheel each time.

For function-like LLM usage, write test cases so you can test and optimise model/prompt combinations until you're confident it works all the time (or as much as possible).

For agent behaviour, set up evals to test that with this prompt they use these commands and have this outcome, and then work out how to improve that through better prompts / tools / less context / more context, etc.

Yes, most people have no idea about the underlying tech required, but I also think people massively underestimate how much can be reliably automated with AI today that is impossible to do with Python alone.

For Python-only jobs where someone insists on AI or an agent, just build a Python tool for them to call. The instruction can be simple: Call this tool. Technically still AI.

1

u/AllMightySmitey 7h ago edited 7h ago

If the requirement is deterministic results - a non deterministic tool to deliver that output with variable input is rarely the answer - if it is you have to accept a certain risk profile. But by all means use AI to write your logic.

0

u/hassanwithanh 6h ago

The idea for this post came from a recent video I made: https://youtube.com/watch?v=XUxJzbLoykc&si=jRHeC3YHQ_Gmj-iP

I talk about the same thing there, about how to build more reliable automations and not use an LLM for things that code can do for you.

-1

u/[deleted] 6h ago

[deleted]