Use when an LLM feature must choose between a fixed workflow, one agent or several, call tools or external APIs, talk to a model provider or gateway, or add plugins and adapters; also for wrong tool calls, malformed provider requests, model routing, shared rate limits and quota across replicas, retries and 429 handling, and cost-saving levers such as smaller models, caching or batching.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Agent Harness Model And Tools?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/lehoanganhtai13-agent-harness-model-and-tools)
---
name: agent-harness-model-and-tools
description: "Use when an LLM feature must choose between a fixed workflow, one agent or several, call tools or external APIs, talk to a model provider or gateway, or add plugins and adapters; also for wrong tool calls, malformed provider requests, model routing, shared rate limits and quota across replicas, retries and 429 handling, and cost-saving levers such as smaller models, caching or batching."
---
# Agent framework design
Use this skill to design the decision loop and its two immediate boundaries. The agent engine / harness selects the next step and determines whether work is complete; the model boundary translates a request and response faithfully; the action and tool boundary validates and executes an authorized proposal and reports what actually happened. These are logical responsibilities, not required services. Start with the smallest mechanism that satisfies the admitted task, authority, failure and evidence requirements. Read the system-wide [architecture](../agent-system-engineering/references/architecture.md), [flows](../agent-system-engineering/references/system-flows.md) and [engineering process](../agent-system-engineering/references/engineering-process.md) when the question crosses components.
**Scope.** Use this skill to design, build, debug or review the agent system named by the current task. Component rules describe that target system; reading routes and engineering procedures guide your work on it. This separates product requirements from session instructions: actions remain governed by the current task and permissions, including when your own agent or harness is the target.
## Behavior-steering instinct map
Choose the smallest carrier that reaches the decision with the right authority and lifetime; compare its token, cache and adherence costs rather than adding every layer.
For capability design or problem-solving with a human counterpart, first use supported research or established practice to describe effective human performance, connect it to an option/check, and test transfer against agent differences; carry over only applicable human limits and label unsupported explanations as hypotheses; skip routine use and purely technical mechanisms without a counterpart ([design rule](../agent-system-engineering/references/engineering-process.md#design)).
| Need | Lever and trade-off | Build it as |
|---|---|---|
| Rules and definitions hold for every call | **Standing instructions** make enduring guidance available, but consume prefix space and volatile edits break later reuse; keep them sufficient and stable, with changing facts elsewhere. Capability plugins preserve isolation, removability and parallel development through an explicit contribution contract, declared ordering and a core-owned common module. [Standing instructions](../agent-context-and-state/references/context-carriers-and-composition.md#composition-contract-and-request-path) | Core-owned base instructions plus plugin-owned prompt contributions, composed before model calls. |
| The agent must select and call the right operation | **Stable tool declarations** expose purpose and argument semantics at a recurring schema cost; start directly, then justify discovery or filtering by selection/size pressure and qualify cache loss and extra calls. Capability plugins preserve isolation, removability and parallel development through an explicit contribution contract, declared ordering and a core-owned common module. [Declaration choices](../agent-context-and-state/references/context-carriers-and-composition.md#responsibility-and-decision) | Plugin-owned tool function with stable name, description and argument schema; executor eligibility check. |
| The agent must understand what an operation returned or did | **A bounded correlated result** reduces ambiguity without another lookup, but excess output grows replay and an unknown outcome stays unknown; report the observed effect, partial result or useful validation failure first. Capability plugins preserve isolation, removability and parallel development through an explicit contribution contract, declared ordering and a core-owned common module. [Result contract](references/action-and-tool-boundary.md#minimal-mechanism-declaration-to-result) | Plugin-owned tool result payload keyed to the call identifier, with typed outcome and omissions. |
| Relevant working facts must stay visible across steps | **Selected committed-state echoes** give immediate evidence but duplicated full values inflate context; echo only after commit, then justify any later projection separately from durable persistence. Capability plugins preserve isolation, removability and parallel development through an explicit contribution contract, declared ordering and a core-owned common module. [Committed-state echo](../agent-context-and-state/references/context-carriers-and-composition.md#composition-contract-and-request-path) | Plugin-owned post-tool state handler with a reducer or merge rule; result decorator selecting committed fields. |
| This outcome should change the next action | **Result-specific guidance** keeps policy beside its trigger but costs tokens and can duplicate adequate tool guidance; use the owned result contract first, adding only independently needed trusted policy. Capability plugins preserve isolation, removability and parallel development through an explicit contribution contract, declared ordering and a core-owned common module. [Outcome guidance](../agent-context-and-state/references/context-carriers-and-composition.md#composition-contract-and-request-path) | Plugin-owned outcome-specific tool result builder; trusted post-tool decorator only for additional policy. |
| An event needs control without an operation result | **A short transient reminder** buys proximity without permanent replay, but spends current tokens and can alter prefix reuse; use after result carriers are unavailable, tied to the event rather than every call. Capability plugins preserve isolation, removability and parallel development through an explicit contribution contract, declared ordering and a core-owned common module. [Reminder](../agent-context-and-state/references/context-carriers-and-composition.md#composition-contract-and-request-path) | Plugin-owned middleware after a model call or tool event, appending a bounded request-only reminder before the next call. |
| Changing facts or background must qualify this execution | **A scoped snapshot** preserves a dated capture and eligible replay but can become stale and accumulate tokens; select needed facts, use later results for updates and replay only under the owned history/trust contract. Capability plugins preserve isolation, removability and parallel development through an explicit contribution contract, declared ordering and a core-owned common module. [Snapshot](../agent-context-and-state/references/context-carriers-and-composition.md#composition-contract-and-request-path) | Plugin-owned run-start context hook and snapshot renderer, after contributing producers and before the model call. |
These model-visible levers do not grant action authority or prove an external effect. Preserve each contribution's source, scope and lifetime, retain enforcement at the responsible boundary, and verify a lever by inspecting the actual outbound request after all composition. Fit each lever to the agent's target model(s); when choosing prompting or tool-use practices, consult current provider guidance for the exact generation rather than assuming another model's results transfer.
## Select the instructional home
| Question or symptom | Read | Why |
|---|---|---|
| How does the loop select a step, stop, bound work, validate an executable definition or compose capabilities? | [Agent engine and harness](references/agent-engine-and-harness.md) | Owns decision and construction contracts, including limits, hooks and feature compatibility. |
| Should this be a fixed workflow, one agent, a specialist or an isolated child? How should child work be bounded and returned? | [Orchestration and delegation](references/orchestration-and-delegation.md) | Opens only when a workflow or another execution is under consideration; links to the canonical delegation flow. |
| What request, response, tool call, stream, limit and usage actually crosses a provider route? | [Model boundary](references/model-boundary.md) | Owns adapter fidelity and route-specific semantics, including unset versus explicit zero. |
| When do shared routing, retry, timeout, credential custody or resilience justify more than an adapter? | [Model gateway and reliability](references/model-gateway-and-reliability.md) | Conditional gateway and reliability decisions; multiple providers alone do not require a gateway. |
| Who validates a model-proposed action, authorizes it, executes it and reports an actual or uncertain effect? | [Action and tool boundary](references/action-and-tool-boundary.md) | Owns schemas, execution, effect semantics and truthful results. |
| When should tools be remote, discovered or offered through a catalog? | [Remote tools and catalogs](references/remote-tools-and-catalogs.md) | Conditional discovery, registration and remote tool contracts. |
A reader can open each chapter directly from this router. A leaf addresses a conditional decision seam and does not turn its implementation into a default. If a linked chapter is absent, record the missing owner and stop any dependent conclusion that requires it while continuing independent work.
## Route the task
1. **Design or plan:** write the outcome, actors, authority, workload, failure tolerance and observable acceptance evidence. Compare a single call, coded workflow and bounded agent; add a capability for a named behavior as an independent plugin, realized as middleware owning its needed tools, state, hooks, prompt contribution and configuration flag; add delegation or a gateway only for a named pressure, and defer registry/discovery machinery until independently authored or multiple deployable extensions require it. State which component owns each hand-off and the simplest acceptable failure response.
2. **Build a capability:** specify its purpose, activation, eligibility, typed inputs, dependencies, contributions, state ownership, ordering, failure behavior and checks. Resolve and validate the definition and backend requirements before constructing the executable. Trace the added action through authorization and its actual result; a model instruction is not enforcement.
3. **Debug a loop or false completion:** identify the actual execution, effective definition, model request, observed tool calls and terminal status. Distinguish model steps, physical calls, retries and resumed attempts. Locate the first divergence, then inspect the responsible boundary; a limit, timeout, unknown effect or empty answer is not success.
4. **Change models or clients:** inspect the effective adapter request and response, stream and tool-call forms, limits and usage. Preserve raw data needed for integrity and compare actual effective requests for cache claims. Qualify provider and client behavior on the selected route; examples from another route are not guarantees.
5. **Add tools or delegation:** define the target, input, principal, resource, operation, version, permitted effects, cancellation and result evidence. A child receives a self-contained bounded brief and no authority from model-authored text. Treat a pending or timed-out child as potentially running until its authoritative state is known.
6. **Optimize:** identify the measured bottleneck and freeze the comparison, safety constraints, costs, uncertainty and stopping rules before an experiment. Compare outcomes and losses by case as well as aggregate metrics. A smaller prompt, fewer graph steps or an apparent cache hit is not proof of an improved user outcome.
7. **Review:** follow each proposal to its enforcing executor and each completion to its supporting evidence. Check failure, cancellation, stale state, ambiguous outcomes and counterfactuals for the selected premises. Separate source inspection, local checks, deployment and observed runtime evidence.
## Boundaries and omissions
The [task and interaction boundary](../agent-runtime-and-interaction/references/task-and-interaction-boundary.md) admits calls and carries the desired outcome and caller authority; the [execution host](../agent-runtime-and-interaction/references/execution-host-and-lifecycle.md) schedules and keeps work live. The [context owner](../agent-context-and-state/references/context-and-state-management.md) decides information and state semantics; the [evidence owner](../agent-evidence-and-knowledge/references/evidence-and-knowledge-access.md) supplies visible and version-qualified external information. The [policy owner](../agent-configuration-and-delivery/references/policy-and-configuration.md) validates effective settings, while [trust and privacy](../agent-trust-and-privacy/references/trust-and-privacy.md) crosses every boundary. [Diagnostics and resource control](../agent-diagnostics-evaluation-and-resource-control/references/diagnostics-evaluation-and-resource-control.md) records what happened and what it cost; [delivery and operations](../agent-configuration-and-delivery/references/delivery-and-activation-evidence.md) connects changes to observed runs when deployment applies.
For a short in-process task, a bounded function can implement several of these responsibilities without a queue, distributed worker, plugin registry or durable memory; any capability added to it still keeps its plugin independence boundary and may be wired by a direct contribution list. When work must survive interruption, consult the host and context contracts before claiming recovery. Preserve a stable logical-turn identity across attempts and reconcile uncertain external effects before retry; verified idempotent replay is permitted for the same operation and body, otherwise stop for manual reconciliation. A model-facing example, proposed fix or historical observation is evidence only within its stated premise and scope.