Just to level set on architecture here (CC <@U07EZ...
# proj-sdk
w
Just to level set on architecture here (CC @straight-sundown-84319 and @calm-artist-7206) • We are planning to have two servers ◦ An app server ▪︎ manages things like users, auth, API keys ▪︎ maintains long-term state (postgres or filestore) ▪︎ does not run any agent loops ▪︎ can be run in HA mode ◦ An agent server ▪︎ manages agent loops ▪︎ agent loops all run locally wrt the agent server--i.e. we just use the raw SDK ▪︎ does not have long-term persistence (but has some disk storage for stability) ▪︎ is ephemeral ▪︎ is not HA The app server will create and manage agent servers. The conversation UI connects directly to the agent server for status, sending messages, etc. For a sandboxed architecture (which IMO is still our target), this works really well. We can run as many SDK servers as we want, and don't have a bunch of threads running on the main server. For a non-sandboxed architecture (i.e. running OpenHands web UI against your local disk/shell) it's slightly complicated, because now you need two servers. But I think this is a reasonable cost.
Let me know if this does not reflect your understanding and we can discuss further
c
Good call, because indeed it doesn’t reflect my understanding. Sorry, but I will have to say, this intention, to force the user to go through more hoops, was definitely not clear to me. I know you didn’t intend to, but now I hear you saying that I’d better grasp the full implications right now, and respond within an hour or two, otherwise OpenHands-V1 will be built on the basis of globals on import paths. Because that’s where this leads today: excluding configuration from the agent server, excluding extensibility, building it directly as MU/HA needs means it needs configuration anyway, and apparently compatible with the way the Saas does things today, so we‘re starting to build a V1 on globals on import path. (!) (I will admit upfront this is a tad frustrating. I thought out some parts of how things could work without such things, with extensibility for MU uses too, and posted them out, and responses seem to say that we agree, but actually I’m not so sure.) I’m sure to miss something, but I disagree that two servers is a reasonable cost. All over reddit/HN and such, people find OH cumbersome, there are endless issues with docker when it’s one runtime, and what we want is suddenly to embed MU/HA assumptions into the very structure of what they run, thus, it seems to me, making it more cumbersome?
Could we, for the moment, leave out compatibility with how the remote runtime works today, meaning do not do those env vars on import path, so we can figure this out?
Ah, I see you merged it already. I contend that this is not the right way to do it, and to the contrary, this is exactly what was the root of some CI issues https://github.com/All-Hands-AI/OpenHands-Server/pull/21
s
I merged for the sake of getting something usable on the table which fulfills my current needs - please create a PR with alternative suggestions
c
Tim, could you elaborate why you needed the globals? Really, I mean, we’re at an early stage with agent-sdk/ events etc, it’s not like you could right now deploy such server?
s
My mandate is to get a wersoin of the AgentSDK working with the main openhands server by Friday. This is a minimal first pass refactor. My current game plan is: • Finalize the webhook functionality in the Agent Server. • Create a Dockerfile for the agent server and build a docker image for it • Jump back over to /OpenHands and create new webhook endpoints - these will simply save data to a local file store (or Google Cloud in SAAS) • Create an implementation of ConversationManager that starts a runtime using the new image. • Pass the PR to Stephan / Frontend so they can start using the new events. (This will be a large portion of work) After Friday: While frontend are working with the new event stream structure, I will go back and start looking at the previous refactors we talked about - User Context, SandboxSpec, Sandbox. It is likely we can refine much of our existing API
I'll also need to update the event REST endpoints to accommodate the new structure
(In OpenHands)
w
Sorry Engel--that was my direction specifically. We are under a lot of time pressure to get something working with v1 by the end of this week
I am definitely open to better ways of organizing the code, as is Tim
The main goal here is to decouple two unrelated groups of logic: • logic for running agent loops, which is thread/memory-heavy and does not scale well • logic for more traditional app APIs and storage Both of these need to sit behind an HTTP interface for our app to work. But having them in the same server has caused a ton of problems. E.g. app endpoints end up hanging because an agent thread is hogging resources Splitting these up is going to be a huge relief on our codebase
@calm-artist-7206 I'd love to see a PR that gets rid of these global imports in favor of a better configuration setup
c
Robert, ok, but getting rid of those first implies configuration is reality in the agent server at least; and of course in CLI app too.
w
sorry not sure I understand the comment here--can you say more?