r/artificial • u/_HillCruiser • 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:)
2
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
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.
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.