TBH I thought we needed either - configuration in ...
# proj-sdk
c
TBH I thought we needed either • configuration in agent-sdk, or • configuration in a separate “framework-y” level module, that the CLI app and server will use. It seems we didn’t yet do any. OK, maybe we could postpone this a bit, but then, as we move forward, both CLi and the server need configuration, so… they each create their own. 😢 This worries me, sorry. I believe we already know some sane defaults that the local OH can use, both in CLI and server, and, on the other hand, I really really hope we don’t create again two parallel configuration systems that will confuse both users and us. Could we start by saying: •
~/.openhands/
is the place for app configuration (
settings.json
) => Settings, with LLMSettings, etc • this is also the place for conversation storage • the server, at least (but probably also CLI), could wrap all of these paths into an abstraction that it will, later, override - e.g. ConversationPaths
Cc: @straight-sundown-84319 @quick-window-91705 @wooden-umbrella-84098
q
Yep makes sense! i’m developing with paths in a single locations file so hopefully easy to rip out once we have consensus on where configs go
❤️ 1
w
My hardest opinion here is that the SDK should not do any auto-loading of configuration
s
So how about this... • We add a config object to agent sdk (My guess is it will be similar to the ones both Rohit and I have developed) • It could contain things like defaults for the LLM, and the defaults for workspace and conversation directories. Each project uses this, but then also defines its own config for things specific to it (In my case,
session_api_key
and
cors_origins
)
w
it could have a constant like
DEFAULT_CONFIGURATION_PATH
or a method like
.load_from_default_config_path()
but the caller should need to be explicit about loading that config
I'd also suggest not adding a new
Config
class, but instead using the existing pydantic structures
c
Just to make sure I understand the concern here, why exactly is this a problem or for what?
My hardest opinion here is that the SDK should not do any auto-loading of configuration
There should be a
~/.openhands/settings.json
, and then CLI and server can load that?
Is this because the Saas will need to override it?
s
SAAS will need to override it, but I was under the impression that we were trying to keep global shared state out of the agent sdk
c
By global shared state, do you mean loading application settings (all of user-stuff like llm settings, etc)
s
Yes
As a result of this, the REST endpoints in Agent Server SDK at the moment do not really have useful defaults - to define a conversation you pass in the full LLM model.
e.g.:
Copy code
{
  "llm": {
    "model": "litellm_proxy/anthropic/claude-sonnet-4-20250514",
    "api_key": "******",
    "base_url": "https://llm-proxy.staging.all-hands.dev"
  },
  "tools": [
    {
      "name": "BashTool",
      "params": {
        "working_dir": "workspace/project"
      }
    },
    {
      "name": "FileEditorTool",
      "params": {}
    },
    {
      "name": "TaskTrackerTool",
      "params": {
        "save_dir": "workspace/project"
      }
    }
  ],
  "initial_message": {
    "role": "user",
    "content": [
      {
        "type": "text",
        "text": "Flip a coin!"
      }
    ]
  }
}
(The above is one of the tests I was using for POSTS to http://localhost:8000/docs#/default/start_conversation_conversations__post)
This works well for my use case, where we will be using the SAAS Managing server as the place for maintaining config state
But maybe other use cases are different?
w
Just to make sure I understand the concern here, why exactly is this a problem or for what?
> My hardest opinion here is that the SDK should not do any auto-loading of configuration
IMO a user of the SDK (or any python library) should be able to determine behavior of the library by looking at the code. Libraries should not depend on the environment (e.g. presence of files or env vars)
nod 2
c
OK, this global state though, only needs to mean the default locations, and we know how to override them? How about we do it “server-like”: • define a
Settings
, with no default locations, just all the things • define a
UserContext
, with this default location as an attribute • user context will be a dependency, to be recomputed/overridden by other server apps (e.g. a multiuser app)
OK, that makes sense Robert, so each interface-offering application does load explicitly
s
This is what exactly what we intend to do in the Managing SAAS server - but the agent sdk server is below the level of that. Just what is needed inside the sandbox without users or persisted config. (Aside the minimum needed to actually run the server)
c
But when the local user runs the server, they expect this applied:
settings.json
in their home directory, that’s why we seem to need to create it here, in a way you can extend
s
Or - the client code would be responsible for creating the default settings and storing it in whatever manner they see fit
c
I think we’re saying the same things, just look at a little different angle - is the “agent sdk server” the actual server application OH-server, which the users will just run?
If not, what/where is the place for doing that?
s
It is closer to the old "Action Execution Server"
(Except the agent loop also runs within it)
c
That’s a big exception lolsob
s
Yes!
c
So it’s not the runtime, it’s the server app!
s
Without config, users, billing, etc
This is also how nested runtimes work right now
c
Relatedly, where do we want to put these config definition then? I was messing around with/ server and this AgentSpec is what i eventually came up with: you can think of it as all the info you need to instantiate an agent -- maybe this is somewhat of AgentConfig class? We also add a few more fields for Conversation-specific field here in StartConversationRequest inside Server: https://github.com/All-Hands-AI/OpenHands-Server/blob/48e2724b1458cab0ec73050b8d227c766b8dcef2/openhands_server/sdk_server/models.py#L54-L74 So if it make sense to: 1. define all the required input for Conversation/Agent/Tool/Condenser etc inside agent-SDK 2. downstream application figure a way to store them properly - and use
.from_spec
from the SDK to get actual instance restored?
c
Just a quick note here:
Without config, users, billing, etc
Please note that this sentence says “users”, “billing”, which means it refers to a multiuser app, not a local app. That’s fine, but it;s not the same with OH the singleuser app, that needs to be run too :) I think both apps, CLI and server, need to load
~/.openhands
stuff. There are also conversations there, of course they already need to load things. So we are just wary of this exact thing: how to load defaults, in a way that allows you to override them.
c
👆 this, sounds to me like we can simply have one
agent_spec.json
that's dumped directly from
AgentSpec
and all downstream application can just do
Agent.from_spec
to resume the state of an agent
and we can use existing
base_state.json
(that's already handled by SDK) to handle anything related to conversation
w
Driveby comment: do we need
AgentSpec
to be separate from a pydantic
Agent
class?
s
@calm-artist-7206 Some background: When running the agent loops in the main server, we started to encounter scaling issues - a conversation run by one user could adversely affect all other users. So nested runtimes moved the agent loop into the runtime. Now each user's conversations are independent. Anything they do only affects that single container But the nested runtime is actually a full version of openhands - even though much of the functionality doesn't make sense in that context. And it also meant that a lot of the central server functions don't make sense either (Reflected in all the
unsupported_operations
in SaasNestedConversationManager) So the Agent SDK Server is designed to be somewhere between the old action execution server and the new full nested server but to remove this code smell
c
Yes - we do, i tried really hard to get rid of it, but Agent requires tools to be list[Tool] and they are not serializable
s
I imagine that users will run this server if they want simple access to OpenHands via a REST API - whether that is on a local machine or a docker container / K8 pod they spin up
We will use it inside our sandboxes, but I imagine it is something other openhands users could find useful too
c
This is kind of user experience i'm coming after w/ AgentSpec -- and it is what i want to use for our evaluation harness https://github.com/All-Hands-AI/agent-sdk/blob/a14d42a8b4850d36455dba01c4e95993006ab3ef/examples/12_api_via_docker.py#L105-L141
c
@straight-sundown-84319 you made two very different comments. The nested server, so conceptualizing OH-server as a sandboxed thing, is perfectly fine and I think we can do this by understanding, extracting, and setting defaults for the points that the sandbox will need to override. The second comment though, is a bit confusing to me: Robert was saying somewhere that 80% of OH users use the server, that is, the OH-server version that we made pretty web UI for. This is not an afterthought, it’s not just something extra for them
Just as general note, I really think the way forward here is to not embed into OH (CLI or server or SDK) any assumptions of how things work in a multiuser context. Their place is only at the edges, where we think how/what you need to override, but they should not get inside codebase in things like globals on import paths