A Practical Guide to Building a Thin Harness for Composable Agent Frameworks
A thin harness provides the minimal control plane for an agent runtime: it routes models and tools, gates high-risk actions, and maintains structured task plans. This guide explains how to design the harness, organize model, tool, memory, sandbox, and agent plugins, connect search and specialized data sources, and establish security, budget, observability, and rollout practices.
A Practical Guide to Building a Thin Harness for Composable Agent Frameworks
1. Why Build a Thin Harness?
Early agent systems often place model calls, tool execution, context assembly, memory access, permission checks, and task workflows inside one large framework. This approach may accelerate initial development, but the framework quickly becomes difficult to maintain as the number of tools grows, models change, new teams integrate with the system, or security requirements increase.
Adding a data source may require changes to core code. Replacing a model may require changes across the invocation chain. Adding approval workflows may force business logic into the framework.
A better approach is to keep the harness thin. The harness should not be a collection of business capabilities. It should serve as the agent runtime’s minimal control plane and focus on three responsibilities:
- Scheduling models and tools: Select model capabilities based on the task plan, build context, invoke tools, and process results.
- Requesting approval for high-risk actions: Require human confirmation or policy checks before writing files, executing commands, sending network requests, or modifying external systems.
- Maintaining task plans: Break goals into verifiable steps and record status, dependencies, failure reasons, and recovery points.
Together, these responsibilities form the agent’s control skeleton. Models, tools, memory, sandboxes, and agents should exist as composable, replaceable, and extensible plugins.
The thinner the harness, the clearer the plugin contracts and the easier the system is to evolve. A centralized control plane also provides consistent entry points for approval, auditing, and budget governance.
2. Three Core Responsibilities of a Thin Harness
2.1 Model and Tool Scheduling
Scheduling is more than passing user input to a model. It is a process of routing capabilities.
Model plugins should declare capability tags such as text reasoning, image generation, video generation, embeddings, long-context processing, and structured output. Tool plugins should declare their input and output schemas, permission scopes, timeout settings, and retry policies.
The harness selects the appropriate capabilities for each task step and normalizes tool results into a common message format.
The scheduling layer should also define failure semantics:
- Should a model timeout trigger a retry?
- Should an empty tool result cause the system to try another source?
- Should a structured-output parsing failure fall back to human review?
These policies should be configurable rather than scattered across business code.
2.2 Approval for High-Risk Actions
Approval is essential when agents move into production environments. Actions can be classified by risk:
- Read-only queries can be approved automatically.
- File writes within a workspace can be allowed with audit logging.
- Command execution, outbound network requests, and modifications to external systems can require human confirmation.
- Sensitive data operations or bulk actions can require a second review.
Approval gates should work together with sandboxes:
- The sandbox limits what the agent can do.
- Approval determines whether the action is allowed.
- Audit logs record what the agent did.
2.3 Task Plan Management
A task plan is not simply a prompt. It is a structured state machine. Each step should include, at minimum:
- Goal
- Inputs
- Dependencies
- Status
- Output
- Failure reason
- Recovery point
After each step, the harness updates the plan and allows the task to be paused, retried, skipped, or escalated for human intervention.
Once plans are observable, agents become easier to debug. Developers can determine why a particular tool was called, where execution failed, and whether the agent deviated from its goal.
3. Five Types of Pluggable Components
3.1 Model Plugins: Registering Multimodal Capabilities
Model plugins should connect through a unified registry and be selected by capability rather than brand.
Text models can handle reasoning and planning. Image and video models can handle generation. Embedding models can support retrieval. Multimodal tasks can combine several models through the harness.
Each model plugin should declare:
- Context-window limits
- Input and output formats
- Cost dimensions
- Rate-limit policies
This information supports budget management and fallback routing. Credentials should be managed through secure configuration and should never be placed in prompts or source repositories.
3.2 Tool Plugins: Standardizing External Capabilities
Tool plugins can provide search, database queries, file operations, code execution, and business-system APIs.
The key factor is not the number of tools but the quality of their contracts. A tool contract should define:
- Input and output schemas
- Permission scope
- Timeout behavior
- Error codes
- Idempotency
- Result confidence
Tool results should include their source, timestamp, and confidence information. This helps prevent the model from treating outdated or low-confidence content as fact.
3.3 Memory Plugins: Cross-Session Context
A memory system can use a “virtual file system plus semantic retrieval” approach. Memories, resources, and skills can be represented as files or entries that support path-based access, hierarchical loading, and on-demand retrieval.
The write path needs explicit policies, including:
- Explicit memory requests
- Automatic summarization
- Deduplication and merging
- Expiration and cleanup
- Permission isolation
The retrieval path can combine semantic similarity, path scope, time decay, and source confidence.
More memory is not always better. Unmanaged memory can pollute the context. The system should support namespaces to prevent memory from leaking between users or agents.
3.4 Sandbox Plugins: Isolated Execution Environments
A sandbox isolates code execution, command execution, and file access. It can restrict network policies, file-mount scopes, and resource quotas.
Sandbox output should be captured and returned in a structured format.
The sandbox provides a safety boundary for approval workflows. Even when an action is approved, execution should still occur within controlled limits. For untrusted code or external input, use least privilege by default, read-only mounts, and denied network access. Permissions can then be expanded only when required.
3.5 Agent Plugins: Role-Based Composition
Agent plugins combine models, tools, memory, and sandboxes into specialized roles, such as a research assistant, data analysis assistant, or code repair assistant.
Each agent should declare:
- Tool allowlists
- Memory namespaces
- Model routing rules
- Budget limits
Delegation to sub-agents should have a maximum depth to prevent uncontrolled recursion. Parent and child contexts should remain isolated, with only the necessary summaries passed between them.
4. Integrating Search and Specialized Data
General-purpose search is useful for finding current facts and verifying sources. It should support authoritative-source filtering, time-range filtering, and query rewriting.
Specialized datasets are better suited to structured questions that general search cannot cover effectively, such as financial reports, company records, legal risk data, academic papers, and macroeconomic indicators.
The implementation should use domain-specific routing:
- Identify the intent of the query.
- Select the appropriate data source.
- Normalize results into a common structure.
- Attach the source and last-updated time.
High-value queries may also benefit from caching and result validation. However, cached content should not be treated as the source of truth.
5. Security, Budget, and Observability Governance
Security governance should cover:
- Least-privilege tool access
- Approval rules
- Sandbox isolation
- Prompt-injection protection
- Output validation
- Audit logging
Budget governance can set quotas by task, tenant, and plugin. When a quota is exceeded, the system can downgrade capabilities, queue the task, or request approval.
Observability should cover at least:
- Traces
- Tool invocation records
- Task-plan status
- Approval records
- Cost details
Useful evaluation metrics may include:
- Task success rate
- Human intervention rate
- Tool-call accuracy
- Memory hit rate
- Average number of steps
- Latency
- Cost
Do not optimize for a single metric. Throughput, security, and explainability must be balanced.
6. Example Configuration
# Structural example, not a real interfaceharness:planner:store: task_plan_storemax_steps: <limit>approval:rules:- action: shell_execmode: require_human- action: file_writescope: workspace_onlyplugins:model:- id: text_reasonercapability: [text, reasoning]- id: image_gencapability: [image]tool:- id: web_searchcapability: [fresh_info]- id: vertical_datacapability: [finance, public_record]memory:- id: context_fsretrieval: [semantic, path]sandbox:- id: isolated_runnerlimits: {cpu: <limit>, memory: <limit>, network: deny}
7. Recommended Implementation Path
Start with the smallest complete loop:
- One thin harness
- One model plugin
- One read-only search tool
- One task-plan store
Then add approval and sandbox controls. Next, integrate memory and specialized data sources. Finally, introduce multi-agent composition and budget governance.
Whenever a new plugin category is added, define its contract and evaluation cases before implementing replacement tests. This approach produces an agent system that does not depend on one fixed product combination. Instead, it can continue evolving through a clear runtime control plane and a replaceable plugin ecosystem.
