groundy
Agents & Frameworks

OpenHands SDK vs Pydantic AI Harness: What Should the Harness Own?

This analysis compares OpenHands SDK and Pydantic AI Harness boundaries, recommending explicit ownership for isolation, recovery, and telemetry based on documented evidence.

Published 6 references
On this page10 sections

Choose the boundary responsibility by responsibility, not by picking the package with the longer capability list. The OpenHands V1 architecture puts the agent loop, tools, workspace and remote server into composable packages, runs agent and tools together locally by default, and concentrates mutable session data in one conversation state object. Pydantic AI Harness instead snaps capabilities onto Pydantic AI’s typed agent loop. Those are different ownership contracts, despite the overlapping “harness” language.

The practical consequence is that an application built around either framework still needs an explicit owner for isolation, recovery, credentials, telemetry and documentation access. Where the documentation does not establish a responsibility, put it in application code or verify it before depending on it. In particular, the supplied evidence does not establish an OpenHands equivalent to Pydantic’s documentation-retrieval capability, production readiness for either side, or a sandbox guarantee merely because a framework offers workspace or sandbox-related components.

Two boundary models, not two feature checklists

OpenHands describes four Python packages that compose according to deployment needs:

  • openhands.sdk supplies the core Agent, Conversation, LLM, Tool and MCP abstractions, plus the event system.
  • openhands.tools contains concrete tool implementations.
  • openhands.workspace supplies execution environments, including Docker and a hosted API.
  • openhands.agent_server provides REST and WebSocket interfaces for remote execution.

That division, documented in the OpenHands Software Agent SDK paper, lets an application adopt the core loop without implicitly adopting a remote server or a particular execution environment.

Pydantic’s model starts with its typed agent loop and adds Harness capabilities. Its overview lists memory, guardrails, sub-agents, planning, context management, persistence and a complete coding agent. Those scope claims are Pydantic’s own description, not independent evidence that every capability has equivalent behavior to an OpenHands component.

The coding-agent example makes the composition model concrete. Pydantic shows its blocks assembled as FileSystem('.'), Shell(cwd='.'), RepoContext(), SubAgents(...), ClearToolResults(), ToolOutputLimits() and RepairToolArguments(), and says using the complete coding agent or its bundled blocks is equivalent. This is useful when an application wants to replace or omit one block. It also means the application must understand the interactions among the blocks it selects; adopting the Harness name alone does not define the resulting contract.

Pydantic Evals, Pydantic Graph and Monty, its sandboxed Python interpreter for model-written code, are documented as separate packages. Do not silently count them as responsibilities automatically owned by the core agent or Harness.

A responsibility matrix for the first design review

The final column is a recommendation inferred from the documented boundaries, not the result of a head-to-head test.

ResponsibilityOpenHands SDK: documented boundaryPydantic AI Harness: documented boundaryOwnership decision
Agent loop and tool registrationCore SDK abstractions, concrete tools package and MCP supportTyped agent loop with composable capabilitiesLet the framework register what its selected components explicitly provide; keep custom orchestration in application code
Execution environmentLocal, single-process agent and tool execution by default; workspace package supplies execution environmentsCoding-agent composition includes filesystem and shell capabilitiesChoose the workspace or shell boundary deliberately; neither product name establishes host isolation
Sandbox and tenant separationOpt-in containerization when isolation is neededMonty is a separate sandboxed interpreter; the supplied Harness evidence does not establish universal workspace isolationKeep deployment isolation and tenant policy explicit; verify the actual environment
Mutable session stateOne conversation state object; pause persists state for later resumptionPersistence is listed as a Harness capability, but equivalent recovery semantics are not established hereSpecify restart, interruption and resume behavior rather than treating “persistence” as one interchangeable feature
CredentialsPer-conversation SecretRegistry, late binding and output maskingNot established in the supplied evidenceDo not assume equivalent secret isolation or masking on the Pydantic side
ObservabilityEvent system, callbacks and direct state inspectionOpenTelemetry-native instrumentation with OTLP backendsSelect the integration point that fits the application; fill any missing telemetry in application code
Agent documentation retrievalNo equivalent established in this evidencePydanticAIDocs supplies bounded Pydantic AI documentation lookupUse the Pydantic capability where its resolution rules fit; otherwise build and test an application-owned tool
API compatibilityExact current shipped-release compatibility is not audited by the supplied architecture paperHarness is 0.x and may change APIs between minor releasesPin versions, record the contract in use and test upgrades before changing either side

The important cells are the ones marked “not established.” Filling them by analogy would turn a responsibility matrix into a parity claim the sources cannot support.

The sandbox boundary needs a failure policy

OpenHands V1 unifies agent and tool execution in one process by default, aligning with MCP’s assumptions, and says the same stack can be containerized transparently when isolation is needed. The paper’s explanation of the V0 redesign is more useful than a generic sandbox feature checkmark because it records why the earlier boundary caused trouble.

In V0, universal sandboxing separated lifecycles that could fail independently. The tool sandbox could crash while the agent continued, or the agent could fail while the sandbox remained, producing corrupted sessions. In multi-tenant deployments, one user’s resource-heavy actions could exhaust container resources and crash other agents sharing the application. V1’s opt-in model addresses those architectural problems by changing the default execution relationship; it does not, by itself, prove that every deployment is isolated or safe.

Independent execution-environment research clarifies what the local default leaves to the operator: Docker containers and macOS VMs provide separate filesystems, while bare macOS has no built-in file isolation between agent sessions. Running everything locally can therefore simplify process coordination while leaving cross-session file access unisolated.

I would make the decision from the workload’s failure cost. A disposable development run may reasonably start with local execution. A service hosting mutually untrusted users needs an explicit isolation boundary, resource limits and a policy for partial failure. Pydantic’s FileSystem and Shell capabilities should receive the same scrutiny: their presence describes available tools, not a demonstrated tenant-isolation guarantee. Monty’s sandboxed interpretation of model-written Python likewise should not be generalized into isolation for every tool, workspace or agent process.

The design review should answer three questions before implementation:

  1. Which process can fail independently of the agent?
  2. What happens to session state when that process dies?
  3. Which filesystem, compute and credential boundaries separate one session or tenant from another?

Those questions remain necessary whether isolation is opt-in, supplied by another package or implemented by the application.

State ownership is more than a persistence checkbox

OpenHands gives state an unusually explicit boundary. According to the V1 paper, agents, tools and LLMs are immutable and validated at construction, while a single conversation state object records mutable context. A conversation is initialized with Conversation(agent, workspace), receives input through send_message(), and executes through run().

Calling pause() automatically persists state and emits a PauseEvent; a later run() resumes execution. Results can be inspected through event callbacks or the .state attribute. This gives an application concrete operations around which to design interruption and recovery.

It does not establish every failure case. A graceful pause is not the same test as killing a process during a tool call, restoring into a different deployment or upgrading between a persisted session and its resumed execution. Those scenarios need application-level acceptance tests before recovery becomes a promise to users.

Pydantic lists persistence among its Harness capabilities, but the supplied overview does not establish equivalence with OpenHands’s single-state-object and pause/resume behavior. If recovery is decisive, compare the actual persistence API and failure semantics at the pinned versions rather than mapping the word “persistence” directly onto Conversation.pause().

Credentials deserve a separate row for the same reason. OpenHands documents one SecretRegistry per conversation, late-bound and remotely manageable credentials, and masking of secret values in outputs; its Bash-tool example replaces occurrences with <secret-hidden>. That is a concrete session-isolation and output-handling contract. The supplied Pydantic material does not establish a corresponding contract, so an application that needs one must locate further documentation or own the gap.

Observability: event callbacks versus OTLP

The two documented integration points serve different operational shapes. OpenHands exposes an event system, callbacks and direct conversation-state inspection. Those fit application logic that reacts to agent progress or records framework-specific events. The supplied evidence does not establish its wider telemetry options.

Pydantic AI’s instrumentation is OpenTelemetry-native and works with OTLP backends. Its documented setup runs uvx logfire-cli wizard --task pydantic-ai once, after which model and tool calls are visible. For a system already standardizing traces through OpenTelemetry, that is a documented integration path, not merely a promise that observability exists.

The choice is not “events or traces” as an absolute framework property. Decide which signals must cross the boundary into application monitoring: model calls, tool calls, pauses, failures, secret-handling events and restoration attempts. Then verify that the selected version emits them with the correlation and retention the application needs.

PydanticAIDocs is a useful boundary example, not parity evidence

Documentation access is worth assigning explicitly because an agent using an SDK often needs version-appropriate API information. The difficulty is not hypothetical as a general documentation concern: research on API documentation comprehension cites Robillard et al.’s finding that the most severe API learning obstacles relate to API documentation.

PydanticAIDocs has a narrow, inspectable contract. It gives the agent one tool, read_pyai_docs(topic), which returns a full Pydantic AI documentation page. It does not preload the documentation into context.

Resolution happens in this order:

  1. Look in the configured checkout inside the run workspace, using {path}/{topic}.md or {path}/capabilities/overview.md.
  2. If that fails, fetch from GitHub at the installed pydantic_ai release tag. The documentation’s example tag is v2.69.0; setting remote_ref='main' requests the latest documentation instead.
  3. If neither source resolves, return a descriptive error naming the local path and URL attempted.

The remote fallback requires network access. The capability never runs Git, so the developer remains responsible for keeping the local checkout current. With the default cache=True, returned documents are memoized for one agent run, and caches are isolated between runs so content from one workspace is not reused in another.

This is a good example of why ownership details matter. The Harness owns topic resolution, retrieval and per-run caching. The application still owns checkout freshness, network policy and the decision to use installed-release documentation or main. Those choices directly affect whether the answer matches the code being run.

Registration also has explicit conflict behavior. The default capability ID is pydantic_ai_docs. Two instances with that ID become one documentation source when they agree, but differing instances raise UserError when the agent is built. Keeping both requires distinct IDs wrapped in PrefixTools, because each registers read_pyai_docs. The capability can also be declared through Pydantic AI’s YAML or JSON agent-spec support under the serialization name PydanticAIDocs.

None of this establishes an OpenHands documentation tool, a general multi-SDK retrieval system or equivalence between the frameworks. It establishes one Pydantic AI documentation capability with useful, bounded behavior.

Pin the contract before migrating around it

Pydantic states that while the Harness is on 0.x releases, its API may change between minor releases, with deprecation warnings and release-note migration guidance describing upgrades. Version pinning is therefore part of owning the boundary, not routine housekeeping.

Independent evidence supports treating upgrades as a testable migration rather than assuming an agent can repair itself from current documentation. In a study of API drift in generated quantum code, covering 17 models and 450 generated samples, documentation-guided repair succeeded for 0.19–0.59 of attempts overall. That is a different SDK domain, so it does not predict failure rates for OpenHands or Pydantic. It does show why documentation access and version alignment are not interchangeable safeguards.

Before building or migrating, record and test the following:

  • Pinned versions and capability list: include framework packages, selected Harness blocks, workspace implementation and remote-ref policy.
  • Registration conflicts: construct the agent with the real capability set, including duplicate IDs and tool-name prefixes where relevant.
  • Execution failure: stop the tool or execution process independently and record what the agent and application observe.
  • Isolation: test filesystem and resource separation in the actual deployment environment, not from a package name.
  • Recovery: exercise graceful pause, process termination and resume against the persisted state contract the application intends to support.
  • Documentation failures: test a missing local topic, unavailable network and stale checkout; confirm which release the remote fallback serves.
  • Telemetry and secrets: verify that required events reach the application’s backend and that sensitive output follows the documented masking behavior.
  • Upgrade rehearsal: change one pinned version at a time and run the same acceptance cases before preserving or replacing application-owned adapters.

My recommendation is to adopt OpenHands where its documented package boundaries, opt-in execution model and conversation-state lifecycle fit the application. Adopt Pydantic AI Harness where composing capabilities onto its typed loop is the better boundary, especially if its documented OpenTelemetry path or PydanticAIDocs behavior solves a concrete need. Keep undocumented responsibilities in application code until their contracts are established.

That recommendation remains deliberately narrower than a production-readiness verdict. The OpenHands evidence is an architecture paper by the project’s authors, describing V1 design intent rather than auditing shipped releases or the current documentation site. The Pydantic evidence is vendor documentation, with detailed support for one documentation capability and broader self-described scope elsewhere. No supplied source compares the frameworks directly, and nothing here was independently tested. The matrix is useful precisely because it leaves those gaps visible instead of converting them into feature checkmarks.

Frequently Asked Questions

How does OpenHands V1 handle sandboxing by default?

OpenHands V1 unifies agent and tool execution in one process by default, aligning with MCP’s assumptions, and says the same stack can be containerized transparently when isolation is needed.

What is the API stability status of Pydantic AI Harness?

Pydantic states that while the Harness is on 0.x releases, its API may change between minor releases, with deprecation warnings and release-note migration guidance describing upgrades.

References

Follow the links in the article for context. The supporting material is collected here for further reading.

  1. OpenHands V1 architecturearxiv.orgAccessed
  2. Pydantic AI Harness overviewpydantic.devAccessed
  3. Execution-environment researcharxiv.orgAccessed
  4. Research on API documentation comprehensionarxiv.orgAccessed
  5. PydanticAIDocspydantic.devAccessed
  6. Study of API drift in generated quantum codearxiv.orgAccessed

Join the discussion

Share a useful perspective or ask a question about this article.

Discussion guidelinesComments privacy