# Open-Source AI Agents: Frameworks and Self-Hosting Choices

Compare three distinct open-source choices by licence, model data paths, authority, persistence and the work you will operate.

Last updated: 2026-10-08

Choose LangChain when you are building an application around model calls and tools. Choose CrewAI when role-based agent work and an explicit workflow are useful parts of that application. Choose OpenCode when the immediate job is working on a codebase through a coding-agent interface. These are different starting points, not interchangeable installations of the same product.

The core repositories evaluated here all use the MIT licence. That does not make their operational responsibilities identical, or put a model provider’s service and a commercial platform under the same licence. A useful shortlist separates the code you can operate from the services, data paths and permissions that code uses.

This comparison covers LangChain’s Python framework, the CrewAI open-source framework and the OpenCode project maintained at `anomalyco/opencode`. It focuses on choosing a realistic self-hosting candidate, rather than benchmarking model quality or providing three installation manuals.

## Start with the kind of application you need

LangChain supplies application-building components and an agent harness. Its agent runtime uses LangGraph, and model integrations are installed separately. You write the surrounding application: how users authenticate, what a tool may do, where conversation state lives and how an interrupted task resumes. That is a useful fit when the agent is a component of your own service, rather than the whole user interface.

CrewAI offers Crews for collaborating, role-oriented agents and Flows for event-driven control, state and branching. Those concepts suit a workflow whose stages and delegation you want to express explicitly. They do not remove the need to define authority: a role description such as “reviewer” is not an access-control policy for the tools attached to that agent.

OpenCode is a coding agent with terminal, desktop and IDE interfaces. It starts from a developer’s project and a chosen model connection. That makes it a more direct candidate for interactive repository work, but not a substitute for designing a business application’s orchestration, identity model and customer-facing service.

| Candidate | Project type and workload fit | Evaluated licence and edition | Model and external-data paths |
| --- | --- | --- | --- |
| LangChain | Python framework for an application with model calls, tools and agent state | MIT for the `langchain-ai/langchain` core repository; commercial services are separate | Provider integration packages connect the application to selected models; tool calls create additional data paths |
| CrewAI | Framework using Crews and Flows for role-based work and controlled workflows | MIT for `crewAIInc/crewAI` core; Enterprise services are separate | Configured model integrations, memory analysis and embedding services can receive different parts of the workload |
| OpenCode | Standalone coding agent for interactive work on projects | MIT for `anomalyco/opencode`, evaluated on its v2 branch; hosted services have separate terms | Hosted or local model endpoints, enabled tools and optional conversation sharing have distinct data paths |

The table compares repository code, not the terms of every dependency or connected service. None of the three core licences requires you to buy the corresponding commercial platform merely to use that code.

## What the licence does—and does not—settle

Each evaluated MIT licence grants permission to use, copy, modify, distribute, sublicense and sell copies of the software. Each requires retaining the copyright and permission notice in copies or substantial portions, and supplies the software without warranty. Those are concrete similarities, not a reason to choose one candidate over another on a supposed core-licence restriction.

Keep the boundary at the evaluated component. LangChain’s core licence does not determine the terms of LangSmith or a model API. CrewAI’s core licence does not make an Enterprise webhook service part of an ordinary open-source installation. OpenCode’s repository licence does not include an inference subscription or turn its sharing service into private infrastructure. Assess the complete deployment as a combination of code, dependencies and explicitly selected services.

For a practical decision, record the repository and version you intend to deploy alongside its licence. Keep that record with dependency and application configuration, rather than treating “available on GitHub” or “has a free tier” as the licensing answer. The relevant licence here is the one attached to each named repository, not a similarly named project.

## Self-hosted orchestration does not mean local inference

LangChain supports model integrations through provider packages. Hosting the Python process yourself leaves the model connection as a separate choice. The application can also send data through its tools, so the model endpoint is only one part of the information flow. Give each integration the credentials and data access required for its actual purpose.

CrewAI makes this distinction particularly important for memory. Its current memory documentation describes sending memory content to the configured LLM for analysis, with an embedder configured separately. Moving the worker onto your server does not make those analysis or embedding calls local. Record the model used for task execution, the analysis connection and the embedding connection separately.

OpenCode supports hosted providers and local-model connections, including Ollama. That is an integration option, not a promise that a particular server can run any chosen model satisfactorily. Its conversation-sharing feature is another route: sharing is manual by default, and a shared conversation becomes accessible to anyone holding its link. Disable sharing for a sensitive project rather than treating a local terminal as proof that nothing leaves the machine.

A completed data-flow record therefore names the model endpoint, tool destinations, memory or embedding services, and any sharing or observation service. This makes the selection concrete: “we operate the agent process” and “all processing stays inside our environment” are different claims, requiring different designs.

## Compare authority, state and human review separately

**Candidate:** LangChain

**Tool authority and isolation:** Application-defined tools and scoped credentials; operator supplies process, filesystem and network isolation

**State and human approval:** Thread-scoped state with a checkpointer; human-in-the-loop middleware can interrupt selected tool calls

**Installation, maintenance and recovery owner:** Application team installs Python and integrations, maintains dependencies and restores application configuration plus the chosen checkpoint store

**Candidate:** CrewAI

**Tool authority and isolation:** Assigned tools and limits; code-executing tools require a deliberate isolation design, not reliance on deprecated execution flags

**State and human approval:** Flow persistence and memory are distinct; task final-answer feedback differs from Flow review and Enterprise webhook approval

**Installation, maintenance and recovery owner:** Application team maintains the project environment, enabled Flow persistence, memory storage, configuration and credentials

**Candidate:** OpenCode

**Tool authority and isolation:** Configurable allow/ask/deny permissions; the project explicitly says the agent is not sandboxed

**State and human approval:** Local session and application data; permission prompts govern selected requests but are not an operating-system boundary

**Installation, maintenance and recovery owner:** Operator maintains the installed client, project files, configuration and protected application state; server exposure requires separate access controls

These are separate dimensions. An agent can remember its conversation while still lacking a safe approval boundary. A tool prompt can ask a person for permission while the process still has broad access to its host.

### LangChain: persistence and interruption are application choices

LangChain’s short-term memory uses thread-scoped state. A checkpointer stores that state; the documentation’s in-memory example is not a durable production database. For a persistent service, use an appropriate database-backed checkpointer and include its contents in the application’s recovery design.

Human-in-the-loop middleware can pause execution for selected tool calls and preserve the state needed to resume. Its decisions include approval, editing, rejection and supplying a response. Your application still has to configure the policy and provide a trustworthy review path. Apply the policy before the consequential tool action, not merely to the text the agent writes afterwards.

### CrewAI: do not collapse three kinds of state and review

CrewAI Flow persistence can be applied through `@persist`, with SQLiteFlowPersistence as the default backend. Its current unified memory uses LanceDB and a configured storage location. Flow state and memory are not interchangeable backups: a deployment using both needs to preserve both, together with the configuration that tells the application how to read them.

The `human_input` task option requests feedback before a final answer. That alone does not establish approval before every tool side effect. Flow human feedback provides a different review mechanism, and the current documentation distinguishes the open-source local/console approach from the Enterprise webhook approach. Choose the mechanism for the actual action boundary you need.

There is also a version-sensitive trap in older code-execution examples. Current CrewAI documentation deprecates the older execution flags and identifies the removal of CodeInterpreterTool from `crewai-tools`. Do not treat an old “safe” execution setting as evidence that current tool code is contained. Provide an explicit isolation boundary for executable tools.

### OpenCode: permissions are not a sandbox

OpenCode supports allow, ask and deny rules for tools and patterns, including agent-specific settings. Its documented defaults are permissive for most operations. Configure a deliberately restricted project policy before using it on sensitive work; the existence of a permission system is not evidence that every action starts blocked.

The project’s security policy expressly separates permission prompts from security isolation. Use a container or virtual machine when you need an operating-system boundary, and expose only the intended project and credentials. Approval to execute a command does not reduce the host privileges with which that command runs.

## What operating each choice actually involves

LangChain’s documented Python installation requires Python 3.10 or newer, with the selected provider integrations installed separately. CrewAI’s current installation guidance requires Python 3.10 or newer but below 3.14, and distinguishes the CLI installation from the project environment. Updating a global command is not the same maintenance action as updating the dependencies used by a deployed project.

With either framework, keep the application revision, dependencies, configuration and state-store format together as a release record. Before a change, preserve a recoverable copy of the current state. Exercise recovery in an isolated application instance with consequential tools disabled, then compare a known saved item and the intended access restrictions. This is a proposed acceptance procedure, not a claim that an upgrade or restore has been performed here.

For OpenCode on Linux or macOS, application data is stored under `~/.local/share/opencode/`, while global configuration and the project working tree are separate. The application-data directory includes sensitive authentication and session material. Protect it accordingly; a repository backup alone is not a complete recovery copy of your coding-agent environment.

OpenCode also offers a headless HTTP server. The documented default binds to loopback, and `OPENCODE_SERVER_PASSWORD` enables Basic authentication. A server exposed beyond the local machine needs deliberately controlled network access and transport protection. A local client/server architecture is not, by itself, an authenticated multi-user service ready for public exposure.

## A completed shortlist, not an open-ended directory

For a custom application with your own interface and selected tools, shortlist **LangChain** first. The decisive work is building the application’s identity, tool-policy and persistent-state boundaries. For an application organised around roles, delegation and an explicit event-driven flow, shortlist **CrewAI** first, keeping Flow state, memory and review mechanisms distinct. For a developer who primarily needs to inspect and change a repository interactively, shortlist **OpenCode** first, with restricted permissions and a separate host-isolation decision.

Start that evaluation locally when it is a supervised developer exercise. Move to a service only when the task requires persistent operation, remote access or integration with other systems, and carry the corresponding identity, state, update and recovery responsibilities with it. This is a deployment decision about the work you are prepared to operate—not a claim that one project automatically becomes production-ready on a VPS.

Our [AI Agent VPS](<https://virtarix.com/solutions/ai-agent-hosting/>) category provides a route to self-managed infrastructure for compatible agent applications.

You install and operate the software, permissions, credentials, data and recovery processes. Choose the candidate whose application model matches the job first; then host the resulting system with those responsibilities made explicit.
