The world’s first unified interface for agent harnessesOpen Source4.6kPowered by UHP

TutorialsDec 2, 20268 min read

AI Agent Integration: Models, Tools and Harnesses

How to integrate AI agents into production: connection patterns, security boundaries, multi-model routing, coding agents, and how one API for harnesses cuts the work.

A separate application connects to a modular harness core inside a managed execution enclosure.
One product API connects to a separately managed harness configuration. Modules are a conceptual metaphor for supported configurations, not universal compatibility.

AI agent integration is the work of connecting an agent to the models that reason, the tools and data it acts on, and the runtime that executes it safely. Most teams underestimate the last part. The harness (the loop that wraps a model, calls tools and manages state) differs per agent, and each one ships its own session format, file handling, plugin system and sandbox assumptions. We built HarnessRouter so that a team integrates once through a single API and treats supported harness, model, tool, memory and sandbox configurations as modules, subject to compatibility, instead of writing a new adapter for every agent it wants to run.

TL;DR

  • An integration has four layers: model access, tool and data connections, the harness that runs the loop, and an isolated runtime. Decide each one separately.
  • Tool definitions only describe capabilities. Authorization and argument validation belong in your execution layer, outside the model.
  • Standards such as MCP (tools and data) and the open Unified Harness Protocol (UHP, the harness layer) support swapping compatible implementations within their respective layers.
  • HarnessRouter exposes 30 available harnesses, including coding agents, behind one API, with a free plan at $0 per month and a self-hosted Community Edition.

What agent integration involves

An agent is not a single API call. It is a loop: the model reads context, decides on an action, a tool executes it, and the result returns to the model. Integration means wiring every element of that loop into your product.

LayerWhat you connectTypical failure
ModelsOne or more LLM providers, with API keys and rate limitsProvider-specific request formats leak into application code
Tools and dataREST APIs, databases, queues, file storage, MCP serversOver-broad credentials, unvalidated arguments
HarnessThe agent loop, session state, plugins, skillsEach agent can have its own interface, so switching can require adapter changes
RuntimeSandbox, file system, environment provisioning, lifecycleAgents run with more access than the task needs

Our AI agent architecture guide covers how these components fit together in more detail. The sections below take each layer in the order you would build it.

Connecting agents to systems and data

There are three direct ways an agent reaches a business system. WorkOS describes REST APIs through function calling, where the model emits a structured call to a registered endpoint; direct database access, such as PostgreSQL, MySQL or SQLite through async connection pools; and message queues or event-driven triggers, such as reacting to a new file upload, which suit asynchronous multi-agent workflows.

A fourth option has become common: the Model Context Protocol, an open-source standard for connecting AI applications to data sources, tools and workflows. Its documentation compares it to a USB-C port for AI applications: a server exposes a capability once and any compatible client can use it.

How to choose between them:

  1. Function calling over REST fits a small, fixed set of internal endpoints that you already own.
  2. Database access fits read-heavy analytics agents, provided you use a read-only role scoped to specific tables.
  3. Queues and webhooks fit long-running work where nobody waits on a response.
  4. MCP fits a growing set of third-party tools, because you write the connection once instead of per agent.

For agent-to-agent delegation, see our explanation of the A2A protocol, and for how MCP, A2A and UHP divide the stack, our protocols overview.

Keep policy outside the model

The model proposes; your code decides. Ory's integration guidance makes the point that tool definitions describe capabilities, while the execution layer must validate arguments and independently verify authorization. A model can be talked into requesting an action the user has no right to perform, so the check cannot live in the prompt.

In practice this means:

  • Issue the agent short-lived credentials scoped to the acting user, never a shared admin key.
  • Validate every tool argument against a schema before executing it.
  • Log the call, redacted argument metadata and the decision, so that you can reconstruct what happened without exposing credentials or sensitive data.
  • Require explicit approval for destructive or irreversible actions.

The same principle applies to any application where role-based access controls data, as in this AI application architect walkthrough: permissions are enforced by the system holding the data, not by the component that asks for it.

Integrating multiple AI models

Teams rarely stay on one model. A cheap model handles classification and summarization, a stronger one handles planning, and a provider outage should not take the product down. Without an abstraction, each provider adds its own request shape, error codes, rate limits and billing.

The integration pattern that holds up is a routing layer with one interface in front of many models. Per task, it picks a model by one of three objectives:

  • Quality: the strongest model for reasoning-heavy steps.
  • Latency: the fastest model where a user is waiting.
  • Cost: the cheapest model that clears your quality bar.

HarnessRouter applies this to the whole agent, not only the model: teams can configure, compare and select supported harness, model and module combinations for each task by quality, latency or cost. Our multi-model agents guide walks through the architecture, routing and cost logic. If you already hold provider contracts, BYOK (bring your own API key) is supported, and the BYOK routing fee is 0% up to $25,000 per month of model usage valued at listed prices; above that volume a separate 5% routing fee applies, and platform usage charges still apply.

Integrating coding agents

Coding agents such as Codex and Claude Code are harnesses with their own loop, tools and session model. Integrating one into a development workflow means answering the same questions each time:

  1. Where does it run? Give it an isolated sandbox with only the repository and credentials the task needs.
  2. How do you start and resume sessions? You need session management that survives restarts.
  3. How do files move in and out? Patches, logs and artifacts need a defined path.
  4. Which plugins and skills load? Each harness configures these differently.
  5. How do you compare agents? Run the same task across harnesses and measure quality, latency and cost.

HarnessRouter handles these through one API: agent session management, file handling, plugin support, environment provisioning, benchmarking tools and serverless agent runtime lifecycle features. Adding another supported harness, such as OpenCode or Qwen Code, becomes a configuration choice. For a worked example of a single harness, see the Hermes agent integration guide.

The runtime: sandboxes, plugins and orchestration

An agent that executes code or shell commands needs a boundary. An isolated sandbox limits what a mistaken or manipulated action can touch. Building one yourself involves provisioning, lifecycle, networking and cleanup; our sandboxing guide compares building it with getting it bundled. HarnessRouter runs each task in an isolated sandbox as part of the same call.

An enclosed harness connects to an outside records repository through a single controlled adapter boundary.
Isolation limits runtime access; approved external operations still pass through application-enforced authorization. The gate is conceptual, not a security guarantee.

Plugins extend what an agent can do, and each one widens the attack surface. Our agent plugins guide covers architecture, setup and security. When tasks run in the cloud at scale, queueing, retries and cost control become the real work, which our cloud agent orchestration guide describes.

Step by step: a first integration

  1. Define the task and the success metric. Name the output, the acceptable latency and the cost ceiling per task.
  2. List the systems the agent may touch. For each, decide the access method (API, database, queue or MCP) and the narrowest credential that works.
  3. Choose a harness and model. Start with one, but keep the choice behind an interface so you can change it.
  4. Run it in a sandbox. Mount only what the task needs.
  5. Enforce policy in your own code. Validate arguments and check authorization at execution.
  6. Trace and benchmark. Record each run, then compare harness and model combinations on your own tasks.
  7. Promote to production. Add retries, budgets and alerting.

Steps 3, 4 and 6 are where per-harness adapters accumulate. With one API for harnesses, supported harness and runtime choices share an integration, with benchmarking available through evaluation tools. Our guide to the AI agent API for product features shows how this looks inside a product.

Why a standard for the harness layer matters

MCP standardizes how agents reach tools. It does not standardize how you talk to the agent itself. That is the gap the open Unified Harness Protocol addresses, and HarnessRouter initiated it. The practical consequence is portability: supported harness, model or sandbox configurations can change through the same product API, subject to their capabilities and compatibility. We lay out the difference in UHP vs MCP, and our comparison of agent SDKs, managed agents and CLIs shows where each fits.

Pricing for an integration project

HarnessRouter's published pricing is built for the path from prototype to production:

PlanPrice
Free$0 per month
Developer$20 per month
Production$200 per month
Scale$1,000 per month
EnterpriseCustom, see the pricing page

The published pricing lists tracing as a $50-per-month beta add-on on other plans and includes it with Scale. Short-term agent memory (Beta) is $0.0000840 per GB-hour on Free and top-up credit, with lower listed rates on paid plans; long-term memory has separate per-operation pricing. Top-up credit has a 5.5% processing fee with a $0.80 minimum. Teams that prefer to run everything themselves can use the open-source Community Edition.

Where HarnessRouter fits

If you are building an agent-powered product, HarnessRouter gives you one API across 30 available harnesses and supported model and sandbox configurations, with benchmarking to pick the combination for each task. Start on the Free plan, bring your own API keys with no routing fee up to $25,000 per month of model usage at listed prices (a separate 5% fee applies above that volume, and platform usage charges still apply), and move to Developer at $20 per month when you need more capacity.

HarnessRouter

The full plan list is on the pricing page.

Our perspective

We think the harness layer should be open infrastructure, not a lock-in point. Supported models can already share a common interface, subject to capabilities and compatibility. The agent loop around them, with its sessions, plugins, memory and sandbox, is where teams still lose weeks to bespoke adapters.

Our approach is to treat every part of an agent system as a building block: harness, model, provider, skill, tool, plugin, memory and sandbox. For each task teams can select a supported combination by quality, latency or cost and run it in an isolated sandbox. That is how we aim to cut agent costs by over 90%.

Policy stays yours. You define who may do what, and the execution layer enforces it. Everything else, we want to be a configuration choice.

Sources

FAQ

FAQ

What is the difference between AI agent integration and AI integration?
AI integration usually means calling a model from an application. Agent integration adds a loop in which the model chooses actions, calls tools, and keeps state across steps. That requires tool connections, session management, a runtime and access controls on top of model access.
How do I integrate AI agents with existing APIs?
Register each endpoint as a typed tool definition, let the model emit structured calls, and execute them in your own code after validating arguments and checking authorization. For many third-party tools, an MCP server lets you write the connection once for every compatible agent.
Can I integrate several coding agents at once?
Yes. Each coding agent is a harness with its own loop and session format. Through HarnessRouter's single API you can run Codex, Claude Code and others in isolated sandboxes, then benchmark them on identical tasks.
Do I need to bring my own model keys?
Not necessarily, but you can. HarnessRouter supports BYOK with no routing fee up to $25,000 per month of model usage valued at listed prices; above that volume a separate 5% fee applies, and platform usage charges still apply. Existing provider accounts and negotiated rates stay in place.

→Next

Where HarnessRouter fits

HarnessRouter connects supported harness, model, tool, memory and sandbox configurations through a unified interface, subject to compatibility.