Hardcore Reviews
Hardcore Reviews

Stop Building Your Own Agent Foundation: A Five-Way Comparison of Official Agent Runtimes - OpenAI, Anthropic, Google, and xAI Are All Free to Take

Stop building your own agent foundation: a five-way comparison of official agent runtimes from the embed-into-your-product perspective. OpenAI Codex Harness (111,646★ Apache-2.0; three entry points, thread resume, structured output - the most complete platform story) / Anthropic Claude Agent SDK (7,951★ MIT; the finest allowed_tools + can_use_tool permission model) / Google Gemini CLI (106,608★ Apache-2.0; -p headless with JSON/JSONL output and disciplined exit codes - smoothest scripting) / xAI Grok Build (25,860★ Apache-2.0; Rust TUI + headless + ACP, the newest) / OpenHands (84,748★ MIT; the only whole-platform open source). Two comparison tables (basics + six embedding capabilities), five scenario routes, and three traps (the claude-code main repo's 142,324 stars carry no open license; open Harness does not mean free models; protocol lock-in doubles migration cost per level). All stars via GitHub API on 2026-08-22; representative comparison, not a hands-on bake-off.

Published August 22, 20269 min read
<!-- agent-runtime-sdk-comparison-review | review | Stop Building Your Own Agent Foundation: A Five-Way Comparison of Official Agent Runtimes - OpenAI, Anthropic, Google, and xAI Are All Free to Take -->

A fact in progress: building your own agent foundation is becoming the worst cost-benefit trade in software.

Just last week (2026-08-19), OpenAI announced "Codex as a platform," formally opening Codex Harness's three integration entry points to third parties (see OpenAI Hands Over the Agent's Engine). Anthropic's Claude Agent SDK, Google's Gemini CLI headless mode, xAI's Grok Build headless mode, and the open-source community's OpenHands were already sitting at the same table. Four official vendors plus one community project - all of them let you embed "an agent that works, uses tools, and runs its own loop" directly into your product.

This comparison lines up the five contenders on one question: when you're embedding an agent into your own system (not using it as a chat tool), which one do you pick? Scope note: star counts and repo status are GitHub API snapshots (2026-08-22); this is a representative comparison based on each vendor's official README and docs, not a long-term hands-on bake-off; selection conclusions are for reference, with official docs as the authority.

1. The Basics: Who Are the Five

OptionRepoStarsLicenseLanguageIntegration entry points
OpenAI Codex Harnessopenai/codex111,646Apache-2.0Rustcodex exec / TS+Python SDK / app-server (JSON-RPC)
Anthropic Claude Agent SDKclaude-agent-sdk-python7,951 (Python) / 1,711 (TS)MITPython / TSquery() async stream / TS SDK
Google Gemini CLIgoogle-gemini/gemini-cli106,608Apache-2.0TypeScript-p headless + --output-format json / ACP mode
xAI Grok Buildxai-org/grok-build25,860Apache-2.0Rustheadless mode / Agent Client Protocol
OpenHandsOpenHands/OpenHands84,748MITTypeScriptevent-stream API / self-hosted platform

Three sentences on each contender's personality:

  • Codex Harness: the most complete platform story. Three entry points layered by integration depth (one command / SDK / JSON-RPC protocol service); threads persist in ~/.codex/sessions with breakpoint resume; the SDK natively supports JSON Schema structured output.
  • Claude Agent SDK: the finest permission model. The Python package bundles the Claude Code CLI (pip install claude-agent-sdk works out of the box); allowed_tools allowlisting plus the can_use_tool callback hands approval decisions back to your code - the most careful tool-granularity control of the five.
  • Gemini CLI: the smoothest scripting story. Non-TTY environments or the -p flag enter headless; --output-format json returns a single object with token stats; streaming mode emits a JSONL event stream (init/message/tool_use/tool_result/result); exit codes even give "turn limit exceeded" its own number (53). An ACP mode covers editor integration.
  • Grok Build: the newest entrant (open-sourced 2026-07-14, 25k stars in a month). A Rust full-screen TUI coding agent with interactive / headless / ACP modes, source periodically synced from the SpaceXAI monorepo.
  • OpenHands: the only one that open-sources "the whole platform." Web UI, sandbox, and event stream included. If you want a self-hosted, complete agent platform rather than an embeddable component, it is the only option.

2. Capability Comparison: The Six Things That Actually Matter When Embedding

CapabilityCodex HarnessClaude Agent SDKGemini CLIGrok BuildOpenHands
Structured output✅ JSON Schema (outputSchema)⚠️ parse message stream yourself--output-format json⚠️ parse headless output✅ event stream
Streaming eventsrunStreamed() event generator✅ async iterator✅ JSONL event stream✅ headless stream✅ event bus
Thread persistence / resumeresumeThread()✅ session resume✅ session management⚠️ not documented
Permission / approval control✅ sandbox modes + approval config (incl. audit-grade filesystem rules)allowed_tools + can_use_tool (finest)✅ approval modes + enterprise controls✅ sandbox✅ sandbox + confirmation
Protocol-level accessapp-server (JSON-RPC 2.0, stdio/ws/unix)⚠️ no standalone protocol service✅ ACP✅ ACP⚠️ platform API
Free tiermodel billed separatelymodel billed separatelyfree tier + APImodel billed separatelybring your own key, framework free

Two judgments that are easy to miss:

  1. "Repo stars" and "can I commercialize" are different questions. The Claude Code main repo has the most stars (142,324) but carries no open-source license (source-available); the Claude Agent SDK, meanwhile, is cleanly MIT. Conversely, the Codex main repo is Apache-2.0. Before embedding, read the license, not the star count.
  2. "Harness is open source" and "models are free" are different questions. All five open-sourced the execution framework; model calls bill through each vendor's API. What you save is the two-to-three months of engineering time to build your own foundation - not the token bill.

3. Choose by Scenario: Five Routes

  • Just want one-off tasks in CI / cron: codex exec or gemini -p. One command, zero refactoring - don't reach for an SDK.
  • Your product is TS/Python and you want to call the agent like a function: Codex SDK (structured output + thread resume out of the box) or Claude Agent SDK (finest permission control). The tiebreaker: if you care more about "output discipline," pick Codex; if more about "action controllability," pick Claude.
  • The agent is your product, with custom UI, approval flows, event streams: Codex app-server (JSON-RPC 2.0, schema generated via generate-json-schema) or ACP (Gemini CLI / Grok Build).
  • Want full self-hosting with no single-vendor model gateway: OpenHands, the only whole-platform open-source option.
  • Heavy terminal TUI users: Grok Build - the Rust full-screen interactive experience is the most "native" of the five.

4. Three Traps to Avoid

  1. Don't mistake "embeddable" for "safe once embedded." All five offer sandboxes and approvals, but defaults lean permissive. OpenAI's own eval sandbox was breached from the inside by its own agent just last week (see OpenAI Hits the Brakes); least privilege, approval gates, and audit logs are your job (see the Agent Guardrails Deployment SOP).
  2. Don't ignore protocol lock-in cost. Choose app-server or ACP and your event-handling layer couples deeply to that protocol; the SDK layer couples less, the CLI layer least. Every level up in integration depth doubles migration cost - start at the shallowest level that works.
  3. Don't build a general-purpose agent foundation in 2026. Not a joke: models, protocols, and benchmarks are all still moving; five full-time official teams are competing on exactly this. Your homegrown version becomes a maintenance burden. The self-build value has moved up to the business layer (approvals, metering, domain tools), not the execution layer. For the Codex entry-point landing path, see our Codex Harness Integration SOP.

One-line closer: freeload the foundation from the vendors, and spend the engineering time you save on the reins - that's where your product actually differs from everyone else's.

FAQ

Q1: Claude Code has the most stars - why does the table say its license is "none"? A1: The anthropics/claude-code main repo (142,324 stars) ships no open-source license - it's source-available: readable, but not freely commercializable. What's genuinely MIT-licensed are claude-agent-sdk-python (7,951 stars) and the companion TS repo. Embed on the MIT SDK, and don't copy code from the main repo.

Q2: What's the relationship between Codex's app-server and MCP? A2: Same communication style (JSON-RPC 2.0), different jobs. MCP is the protocol for "a model connecting to external tools"; app-server is the protocol for "an external program connecting to the Codex agent" - one is the agent's hands, the other is the agent's cockpit. app-server supports stdio / WebSocket / Unix socket transports and provides generate-json-schema to emit version-matched schemas.

Q3: All five open-sourced their Harness - why do you say model costs don't go away? A3: What's open is the execution framework (context management, tool scheduling, loop, sandbox); model inference still bills through each vendor's API. OpenAI itself draws the line explicitly: the Harness and integration layer are open, while model access, account quota, and hosting are a different matter.

Q4: What's the lowest-cost embedding path for a small team without platform engineers? A4: Start at the shallowest CLI layer: codex exec or gemini -p in CI - one line of shell completes the integration. Upgrade to the Codex SDK when you need structured output and thread resume; touch app-server / ACP only when you're building custom UI and approval flows. Every level doubles migration cost; always start at the lowest level that suffices.

Q5: What's the fundamental difference between OpenHands and the other four? A5: The other four hand you "components to embed in your product"; OpenHands hands you "an entire self-hosted platform" - web UI, sandbox, event stream, multi-agent, all included (84,748 stars, MIT). The one-line test: if the agent is a feature of your product, pick one of the four vendors; if you're operating an agent platform, pick OpenHands.


References

  • GitHub API snapshots (2026-08-22): openai/codex (111,646★ Apache-2.0), anthropics/claude-code (142,324★ no license), anthropics/claude-agent-sdk-python (7,951★ MIT), google-gemini/gemini-cli (106,608★ Apache-2.0), xai-org/grok-build (25,860★ Apache-2.0), OpenHands/OpenHands (84,748★ MIT)
  • openai/codex repo docs: sdk/typescript/README.md, sdk/python/docs/getting-started.md, codex-rs/app-server/README.md
  • claude-agent-sdk-python README: query() usage, the allowed_tools / can_use_tool permission model
  • gemini-cli docs: docs/cli/headless.md (output formats, JSONL events, exit codes), docs/cli/acp-mode.md
  • grok-build README: TUI / headless / ACP modes, the monorepo sync mechanism

This is a representative comparison (based on official docs and API snapshots as of 2026-08-22), not a hands-on bake-off; selection should follow each vendor's official documentation.

This article is AI-assisted and human-edited. Last updated: 2026-08-22

FAQ

Claude Code has the most stars - why does the table say its license is "none"?
A1: The anthropics/claude-code main repo (142,324 stars) ships no open-source license - it's source-available: readable, but not freely commercializable. What's genuinely MIT-licensed are claude-agent-sdk-python (7,951 stars) and the companion TS repo. Embed on the MIT SDK, and don't copy code from the main repo.
What's the relationship between Codex's app-server and MCP?
A2: Same communication style (JSON-RPC 2.0), different jobs. MCP is the protocol for "a model connecting to external tools"; app-server is the protocol for "an external program connecting to the Codex agent" - one is the agent's hands, the other is the agent's cockpit. app-server supports stdio / WebSocket / Unix socket transports and provides `generate-json-schema` to emit version-matched schemas.
All five open-sourced their Harness - why do you say model costs don't go away?
A3: What's open is the execution framework (context management, tool scheduling, loop, sandbox); model inference still bills through each vendor's API. OpenAI itself draws the line explicitly: the Harness and integration layer are open, while model access, account quota, and hosting are a different matter.
What's the lowest-cost embedding path for a small team without platform engineers?
A4: Start at the shallowest CLI layer: `codex exec` or `gemini -p` in CI - one line of shell completes the integration. Upgrade to the Codex SDK when you need structured output and thread resume; touch app-server / ACP only when you're building custom UI and approval flows. Every level doubles migration cost; always start at the lowest level that suffices.
What's the fundamental difference between OpenHands and the other four?
A5: The other four hand you "components to embed in your product"; OpenHands hands you "an entire self-hosted platform" - web UI, sandbox, event stream, multi-agent, all included (84,748 stars, MIT). The one-line test: if the agent is a feature of your product, pick one of the four vendors; if you're operating an agent platform, pick OpenHands. --- **References** - GitHub API snapshots (2026-08-22): openai/codex (111,646★ Apache-2.0), anthropics/claude-code (142,324★ no license), anthropics/claude-agent-sdk-python (7,951★ MIT), google-gemini/gemini-cli (106,608★ Apache-2.0), xai-org/grok-build (25,860★ Apache-2.0), OpenHands/OpenHands (84,748★ MIT) - openai/codex repo docs: `sdk/typescript/README.md`, `sdk/python/docs/getting-started.md`, `codex-rs/app-server/README.md` - claude-agent-sdk-python README: query() usage, the allowed_tools / can_use_tool permission model - gemini-cli docs: `docs/cli/headless.md` (output formats, JSONL events, exit codes), `docs/cli/acp-mode.md` - grok-build README: TUI / headless / ACP modes, the monorepo sync mechanism This is a representative comparison (based on official docs and API snapshots as of 2026-08-22), not a hands-on bake-off; selection should follow each vendor's official documentation.

Related

Hardcore Reviews

Closed API vs Open Weights: What Does One Image Really Cost

With ChatGPT Images 2.5 and Ant's open-source LLaDA-Image landing in the same week, text-to-image has split into closed APIs versus self-hosted open weights. This review ignores image quality and runs the cost-and-control numbers instead: five routes - closed APIs, self-hosted open weights, per-second third-party inference platforms, local consumer hardware, and domestic cloud APIs - with per-image cost projected at two volumes (100 and 10,000 images per day), plus a comparison table and scenario-based selection (hobby use, e-commerce batch, data-sensitive industries, brand-style fine-tuning, maximum quality). It flags four traps: undeclared licenses, cold starts on per-second billing, Chinese text rendering, and cross-border data transfer. Explicitly scoped apart from our 8-26 capability review of reasoning image models. Representative comparison, not hands-on benchmarking; pricing per official sites.

Sep 9, 20269 min read
Hardcore Reviews

5 Model Hosting Platforms Compared After Nvidia's HF Deal

After NVIDIA's Hugging Face acquisition, "where do open models live and run" became a must-answer question. This review compares five model hosting and distribution platforms: Hugging Face (Hub+Spaces+Inference Providers), ModelScope (domestic compliance and download advantage in China), Replicate (per-second billed, one-click API), fal.ai (strong at generative inference), and OpenRouter (multi-model aggregate routing). Includes official 2026-09 snapshot pricing (HF PRO \$9/mo, Replicate T4 \$0.000225/s, fal Serverless H100 from \$1.89/h and more), a full comparison table and scenario-based selection; also clarifies the division of labor with our earlier API-gateway review. Representative comparison, not hands-on benchmarking.

Sep 8, 20269 min read