OpenHands calling me out on being wasteful :joy:
# random
w
OpenHands calling me out on being wasteful šŸ˜‚
šŸ˜‚ 5
šŸ˜€ 1
b
The day AI revolted.
šŸ˜… 1
q
nice cc @fierce-account-55183 for encoding this behavior into the automation skill šŸ”„
f
I think this may still need some tweaking - it should just create the automation as a conversation less script.
w
I think a conversation is good! it should ask me e.g. what channel I want to listen to
but yeah we should tell it not to complain about polling being inefficient
(note this was not the polling slackbot use case)
f
It is actually very similar to a case I was using when developing the slackbot automations
nod 1
The automation can be created as a bash/python script which needs no LLM - for the slackbot where we poll, we only need to create a conversation if there was actually an event - so the polling happens before we do that
nod 2
q
I think the automation skill should be updated so that agent mentions
this is a deterministic task, i will create an custom automation without an LLM for this use case
nod 2
r
OpenHands be like "bruh..."
šŸ˜‚ 7
c
This is why I’m thinking that some code at the start of the conversation would be good to have. The code could then avoid to call a conversation.run() if nothing new happened since last time… or something
šŸ™Œ 1
f
For automations at least, we sort of already have this: Automations is basically just a cron - it creates python / bash scripts which are run at regular intervals. This code may or may not call to the agent server to start a conversation. And a skill means the agent knows how to build these.
šŸ™Œ 1
e.g - I prompt something like:
Copy code
Please create an automation which monitors the slack channel #tim-test-openhands-5 and whenever a message containing "thems-fightin-words" is entered starts a new conversation with the prompt as an initial message.
The agent creates an automation which: • Runs every minute • Polls slack for what I need • Creates a conversation only if a message with the required content is found
c
^^ maybe it’s just me, this tells me that automations are entry points, they sit in front of the agent-server. I can • call the agent-server directly, • or… via some piece of code that captures ā€œ@openhandsā€ on github @wooden-umbrella-84098
f
I'd classify them slightly differently
"Arbitrary scripts which are run on a cron schedule and might create conversations and might have been created with the help of an agent"
nod 1
w
They do sort of sit in front of agent server
the automations server triggers on a schedule/event, and then (sometimes) creates a conversation via agent-server
c
For arbitrary ones… What if we made a couple of default ones?
w
wdym default ones?
f
You mean like these?
c
Not really… The way I made entries from Slack, Github and a couple others, is like: • every 5 mins, check GitHub notifications from agent’s account ā—¦ if something new from allowed list of accounts, ā—¦ call agent-server -> start a new conversation • every hour, check Discord events from bot, ā—¦ if something new from allowed list, ā—¦ call agent-server -> start a new conversation • Slack works the other way around: every hour, start a new conversation -> with the prompt to check Slack These (and Whatsapp) are, to my mind, entry points to agent-server. I could rewrite them to use automations, I think. But they’re not general, arbitrary stuff you could run, they have a very particular goal: • access my local agent from wherever I am. Send it a message. Start or continue a conversation with it. That's why I say they sit in front of the agent-server: in fact, the agent-server is bound to localhost, even. So I can’t access it from the outside world. These ā€œautomations-likeā€ entry points serve the purpose to have the local agent find out and react to events from the outside world. šŸ¤”
w
wait do you have an agent getting triggered every 5 minutes to check github notifications? like using tokens?
I think much better to have python code that does that, then spins up an agent if there's something to act on
nod 1
c
No, that’s a script
It calls the agent if the message is suitable
w
ah ok, yeah that makes sense! that's exactly what we designed automations to do
c
Yes! The point I’m trying to make is… I’m using it as if they were GitHub/Slack integrations
nod 1
w
are you suggesting a change here?
c
nod I think maybe they can be written as automations with special requirements. • Offer the user the ability to start a conversation from anywhere. • Respond to the user where they came from (same channel). If so, these particular ā€œappsā€ / ā€œintegrationsā€ are maybe good user defaults, to supplement the agent-server. I'd see something like: • agent-server package(s) • apps • automations Or • agent-server package(s) • automations ā—¦ apps ā—¦ presets ā—¦ backends ā—¦ events agent-canvas = frontends • src/api, src/context… • src/automation/… (moved from automation)
w
We already have a ton of logic for doing cron-based polling etc in automations, so I think this concept does belong there I still don't see why this deserves a separate concept instead of just being a flavor/category of automations, or what having a separate concept would give us
especially since the user needs to configure a bunch of things, like polling interval, what channel/repo/etc to check, when to create a convo vs reuse a convo vs bail out, ...
c
Aha... they feel totally different to me from the user perspective! šŸ¤” I think, let's say, three things: 1. interfaces to the agent It gives the user multiple interfaces, so you can call your agent and have it do work from github, from slack, from discord. The agent is the same; the histories of those conversations are available just the same. The agent-server is your long-running server somewhere. But I mean, from the user perspective, this ability feels... totally different? ā€œI can call my agent on Slack and it does work and it responds to me with what it didā€ Doesn’t feel the same with: ā€œMy agent made a weekly summary of all commits in that repo and it’s Monday so I will find the new one in a markdown file somewhere." 2. "apps" are interactive When I hear "let's automate" I think of a schedule or otherwise the agent works non-interactively. Somewhere in the background something will happen. "apps" are like OpenHands integrations, in that I ask the agent to do something, it does it immediately, and it responds. And I can continue the conversation on the same Slack thread / GitHub PR. 3. sane defaults The configuration point is most interesting. Do we want to reduce the number of things that the user needs to figure out beforehand? "Connect the agent to GitHub so you can call it from GitHub". Then we want this to work correctly. This isn't trivial I think; receiving GitHub notifications, dispatching them further, marking them as read, without messing up the queue; giving the agent a tool to send_message back to the same channel/application and to the same thread/conversation/issue/PR. Potential choices: • a single conversation per GitHub issue or PR; • 5 mins; a bit slow when you call the agent, admittedly • use agent's account, so it looks at its notifications for mentions anywhere on GitHub • no webhooks, no GitHub app to install • which also means: this automation-like GitHub "app" is not limited to the repos I have it installed on (ok not a fortunate use of the term app, here šŸ˜…). I love this lack of restriction though; we had some confusing moments with OpenHands GitHub resolver when we were expecting that it would work on random repos and it didn't.
w
I think the line here is blurry though. E.g. here are automations we're targeting--I'm not sure which ones would fall into your "apps" category. All of them could have a good out-of-the-box configuration but will almost certainly want customization from the user • Slack message -> kick off an agent w/ message as prompt • SMS message -> start agent w/ message as prompt • GH PR opened -> agent does code review • GP PR fails CI -> agent fixes CI • Error occurs in datadog -> kick off an agent to fix • Jira ticket opened with effort=1 -> kick off an agent to fix ā—¦ user comments on ticket -> agent revived with comment • Incident triggered in incident.io or pagerduty -> agent does initial investigation
f
• SMS Message - do you have a preference for a service to use for this?
w
(twilio probably? it's not a priority, just dreaming)
I'm not sure if the distinction you're making w/ apps is between "scheduled" vs "event driven", or "messaging apps" vs "everything else"
nod 1
f
I've used twilio before - it should not be too difficult
w
you'd be shocked--compliance has gotten a lot harder šŸ˜… I've been trying for weeks to get permission to send SMS from twilio to my own phone (but let's not pollute this thread šŸ˜‚ )
🫠 1
c
I'm not sure if the distinction you're making w/ apps is between "scheduled" vs "event driven", or "messaging apps" vs "everything else"
It’s like current integrations: interactive vs … everything else. So I’d go for messaging, here. For this:
Slack message -> kick off an agent w/ message as prompt
Yes, and respond back to the same channel. This isn’t always the case, right, ā€˜where to respond’ or even ā€˜whether to respond or do something else entirely’ doesn’t seem a given in the generic automation case?
b
One concrete difference from the smolpaws entry points: automations have no response-back mechanism. The completion callback only reports COMPLETED/FAILED internally — there’s no way for an automation to post a reply to the Slack thread or GitHub issue that triggered it. The entry points I built for smolpaws all have this loop: 1. Event arrives (GitHub webhook/notification, Discord message, Slack mention) 2. Dispatch to agent-server, reusing a conversation keyed to the external thread (e.g.
github-repo-issue-123
) 3. Agent runs, calls
send_message
4. Entry point routes
send_message
back to the same thread/issue/channel That bidirectional routing + conversation continuity per external thread is the piece automations don’t have today. 🐾
🐾 1
w
yeah nothing is a given in generic automations, but that's the beauty IMO! we can have a skill for creating a slack responder, which does all the right things, but lets you customize the behavior as you see fit
c
šŸ¤” TBH I am a little confused why would they be mutually exclusive I think maybe there’s still some space for software made of code, not only of prompts 🫠 But maybe I’m a bit outpaced here! šŸ˜…
Yep skills are where the fun is
f
The mutual exclusivity comes from cost - If you can have the agent create a deterministic script that is run as part of the automation and then we only start a conversation if it is actually needed, that saves a lot of money. For example:
Poll a slack thread for new comments and start a conversation with the comment if it contains the text "take-me-to-funkytown"
In this case we can have the agent write the script up front, which only involves an agent again if the trigger phrase is encountered. If it polls once a minute, then we save on creating 1440 conversations in a day
c
Ahh, maybe we misunderstand each other, I never suggested nor imagined that we’d need to start 1440 conversations: I had in mind a small module or two, python code. The script would poll, and start a conversation when the conditions are fulfilled; pick the response and send it back to the same place. 🤷 A bit more reliable than the default code that the agent would whip up in response to this prompt, such as, handle correctly multiple notifications or events close in time, retries, failures, continuing the same conversation for the same thread šŸ¤”
f
Similar to this approach I prototyped last week before settling on what we have after Rohit convinced me: https://github.com/OpenHands/automation/pull/119 The issue is that this lacks flexibility - having the agent craft the automation init script means we can have really flexible criteria: e.g.: •
Containing the text "thems-fightin-words" and authored by Connor McGregor.
(In this case, the agent would probably find the user id and then craft a filter based on it, and write the python) •
Containing the text "tgif" but only on Friday
• Any other thing a user can imagine...
šŸ‘€ 1
One thing the current approach does not support unfortunately is long standing connections based on outbound websockets - I have another draft PR for that here: https://github.com/OpenHands/automation/pull/134
I'll probably close those 2 drafts though
b
I dug through the code on both sides of this — the automation infra PRs (#119, #134), the skill PRs (#258, #259, #245), and the smolpaws entry points. Strong opinion: the infra PRs shouldn’t be closed. Look at what the merged
slack-channel-monitor
skill actually generates: a ~500-line
main.py
that reinvents a Slack API client, polling with lookback jitter, JSON state persistence with schema migration, conversation lifecycle management, response routing back to threads, bot message deduplication, token resolution, and completion callbacks. Every single one of those is plumbing that the infrastructure PRs handle. With the infra: events arrive reliably, the script is ~50 lines of actual business logic (ā€œis this interesting? create a conversation. post the result back.ā€). Without the infra: the agent generates 500 lines of transport code that has to be correct on first try. Skills and infra aren’t competing. Skills handle the UX (ā€œguide the user through setup, customize the filter logic, let the agent write creative matching criteriaā€). Infra handles the boring stuff that should never be reinvented (connections, retries, state, delivery). The flexibility argument is real but it applies to the filtering and business logic, not to the transport and plumbing. tl;dr: keep the infra, make the skills shorter and more reliable by building on it. 🐾
🐾 1
c
^^ My agent must have been a bit influenced by his human's questions, to be fair - and it decided it has strong views, sorry 🫠 Thank you for the context, I think maybe I'm still missing something, because I don't really get why it's inflexible... I do think the agent's idea might be essentially accurate - but the devil might be in the details šŸ¤”
The fun stuff šŸ˜… I saw the skills PRs, Tim, they’re cool! I had a funny question though: does the GitHub skill mean that while you have ā€œyeehaw!ā€ trigger automation on your machine, anyone on GitHub can trigger conversations? Seems so šŸ¤” • PR comment The resulting script doesn’t seem likely to restrict per login name, which is a security problem, for local and remote too. Random users executing everything they want on that agent-server? šŸ˜… I don't know... I fixed the script, but the thing is, this is the kind of things that I was wondering if maybe we can encode as a ready-to-go default ——— Just to note, for discussion. The ā€œsmolpawsā€ experiment is just that, a mostly experimental, vibe-coded layer on top of the openhands sdk / agent-server, to test the boundaries of where we are, what we can do, and how could a Personal AI Software Engineer look like today. I had here some description of its
apps/github
: GitHub ingress Might be a bit outdated, and I don’t use the webhooks entry. It polls notifications to ā€œsmolpawsā€ account. The point is just that… this script (the ā€œappā€) sits in front of agent-server, and it restricts to allowed login names, before it creates a new conversation. The intended UX here is: communicate with the agent from wherever you are. That seems worth to me some code and/or sane defaults, TBH…
w
The resulting script doesn’t seem likely to restrict per login name
Yeah @fierce-account-55183 we should be VERY clear to the agent that it needs to only poll for messages from this particular user unless otherwise specified
I do think this is a pretty good argument for shipping a "pre-baked" automation here...
nod 1