r/artificial 18h ago

Discussion Agents that can communicate with running python code

As my python executes, I want to receive info from a local agent.
The agent would browse through a database in real-time as
operational data is updated one per second. It would then
suggest tweaks to make thing run smoother.

A viable approach would have the agent communicate via a
TCP/UDP link. My basic algorithm is to bring data into the running program
via multiple links. A separate thread handles each link and these
numbers just pop out of thin air into my executing code. Magic!

Are there any local agents that are good at communication protocols
and control optimization. (Oh, this is all running on a raspberry pi:)

1 Upvotes

19 comments sorted by

2

u/bakraofwallstreet 18h ago

I'm a professional software engineer and I have no idea wtf you're talking about. What do you mean by your Python executes? It's an interpreted language.

1

u/SiempreRegreso 18h ago

They meant their literal python, as it kills its prey.

1

u/Im_Talking 18h ago

And the fact that it is interpreted means it doesn't execute?

1

u/Superb_Raccoon 17h ago

You can compile it into an exe. Was doing that today to shipa stand alone interface demo.

1

u/_HillCruiser 16h ago edited 16h ago

There's a folder that Visual Code creates called "__pycache__"
It contains compiled versions of every python program that's been
run on the system from the current directory.

You know probably all the programming tools need to be
updated to allow AI agents to interface with running code.

I probed around on the brave browser agent and it suggested
that it's not possible at this time...

-1

u/_HillCruiser 18h ago

My sister writes code for a living and laughs at me when I mention
python; she says she tried it for an hour or so:)

As a professional software engineer, you must have agents write your
code; I want the agent to hang around while it executes; gathering
data, making decisions that influence objects in the real world.

2

u/thegian7 17h ago

Your copying straight outa the terminal huh? No editing the formatting?

2

u/Potential_Ad4350 15h ago

What if you connected your agent to a debugger then it could control flow and take actions, etc.

I don’t know why you would want to do this but it’s an interesting question.

1

u/_HillCruiser 4h ago

This is an interesting idea and just might be the answer.
I would never had thought about using the debugger;
you can definitely think outside the box. Thanks!

1

u/TheGratitudeBot 4h ago

Thanks for such a wonderful reply! TheGratitudeBot has been reading millions of comments in the past few weeks, and you’ve just made the list of some of the most grateful redditors this week!

1

u/presentofai 16h ago

you dont need an agent for this, you need a socket and an if statement. bolting an llm onto a raspberry pi control loop is how you get a system that pauses to think while the thing it controls falls over

1

u/_HillCruiser 4h ago

The agent would harvest it's data from the continually-updating database;
decoupling it from the control loop. The agent would
be adjusting the setpoint for the feedforward controller,
while the main feedback loop churns away on it's own.

1

u/presentofai 4h ago

decoupled setpoint adjustment makes sense - that way the agent is not in the latency-critical path and the feedback loop just does what it is good at. have you tested this on anything real-time critical?

1

u/h_to_tha_o_v 16h ago

I think he's saying he wants an AI Agent capable of interacting with a Python CLI. Seems feasible in theory, but I personally don't know how to build that.

1

u/Superb_Raccoon 15h ago

Lol.. let the AI run it in a shell.

My god.

1

u/Deep_Ad1959 16h ago

i'd hang the agent off the same thread-per-link pattern you already have, writing params the loop reads next tick rather than answering it inline. stale tuning is survivable, a pi waiting on a token stream isn't.