m memory structures, or multi-agent patterns that exceed the capabilities of standard harness orchestration.
Step 2: Implement the Control Plane
Scenario A: Framework Implementation (Developer-Controlled Loop)
When using a framework, you must explicitly define the loop, tool routing, and governance middleware. The following TypeScript example demonstrates a custom orchestration pipeline with built-in governance checks.
// Core Agent Node Interface
interface AgentNode {
id: string;
execute(context: AgentContext): Promise<AgentResult>;
}
// Governance Middleware for Frameworks
class GovernanceMiddleware {
private budgetTracker: BudgetTracker;
private toolRegistry: ToolRegistry;
constructor(budgetLimit: number, allowedTools: string[]) {
this.budgetTracker = new BudgetTracker(budgetLimit);
this.toolRegistry = new ToolRegistry(allowedTools);
}
async validateToolCall(call: ToolCall): Promise<void> {
if (!this.toolRegistry.isAllowed(call.toolName)) {
throw new PolicyViolationError(`Tool ${call.toolName} is not permitted.`);
}
if (this.budgetTracker.isExceeded()) {
throw new BudgetExceededError("Agent budget cap reached.");
}
}
async executeWithSandbox(call: ToolCall): Promise<ToolResult> {
// Integration with sandbox environment (e.g., E2B, Daytona)
return SandboxExecutor.run(call);
}
}
// Orchestration Pipeline
class AgenticPipeline {
private nodes: Map<string, AgentNode>;
private edges: Map<string, string[]>;
private governance: GovernanceMiddleware;
constructor(governance: GovernanceMiddleware) {
this.nodes = new Map();
this.edges = new Map();
this.governance = governance;
}
registerNode(node: AgentNode): void {
this.nodes.set(node.id, node);
}
addEdge(from: string, to: string): void {
const targets = this.edges.get(from) || [];
targets.push(to);
this.edges.set(from, targets);
}
async run(initialContext: AgentContext): Promise<AgentResult> {
let currentId = 'start';
const executionLog: string[] = [];
while (currentId) {
const node = this.nodes.get(currentId);
if (!node) break;
executionLog.push(`Executing node: ${currentId}`);
const result = await node.execute(initialContext);
// Apply governance to tool calls within result
if (result.toolCalls) {
for (const call of result.toolCalls) {
await this.governance.validateToolCall(call);
call.result = await this.governance.executeWithSandbox(call);
}
}
// Route to next node
const nextIds = this.edges.get(currentId);
currentId = nextIds?.[0] || null;
}
return { log: executionLog, status: 'completed' };
}
}
Architecture Rationale:
- Explicit Loop: The
run method defines the execution flow, allowing for custom routing logic and state management.
- Governance Middleware: Safety checks are injected via
GovernanceMiddleware, ensuring tool allowlists and budget caps are enforced regardless of the agent logic.
- Sandbox Integration: Tool execution is routed through a sandbox executor, isolating agent actions from the host environment.
Scenario B: Harness Configuration (Platform-Controlled Loop)
When using a harness, you declare the agent's capabilities and constraints declaratively. The platform manages the loop, tool execution, and governance.
# Agent Harness Configuration
agent_definition:
name: "data-analyst-harness"
model: "claude-sonnet-4-2026"
governance:
max_tool_calls: 50
budget_limit_usd: 10.00
allowed_tools: ["read_database", "generate_chart"]
denied_tools: ["write_database", "delete_record"]
audit_logging: true
tools:
- name: "read_database"
integration: "lambda_function"
arn: "arn:aws:lambda:us-east-1:123456789:function:ReadDB"
parameters:
schema: "query_string"
- name: "generate_chart"
integration: "api_gateway"
endpoint: "https://api.example.com/charts"
memory:
type: "session_vector"
retention_days: 30
knowledge_base: "arn:aws:bedrock:us-east-1:123456789:knowledge-base/KB123"
orchestration:
type: "step_functions"
workflow_arn: "arn:aws:states:us-east-1:123456789:stateMachine:AnalysisWorkflow"
Architecture Rationale:
- Declarative Governance: Constraints like
max_tool_calls and budget_limit_usd are enforced by the platform runtime.
- IAM Integration: Tool access is controlled via IAM roles and ARNs, leveraging existing cloud security policies.
- Managed Orchestration: Complex workflows can be delegated to services like Step Functions, allowing the harness to coordinate multi-step processes without custom code.
Step 3: Evaluate Multi-Agent Patterns
- Harnesses: Multi-agent capabilities vary. GitHub Copilot supports multi-agent patterns via CLI task delegation and background agents. Bedrock Agents use Step Functions for orchestration. Vertex AI uses sub-agent routing via flows. Evaluate whether the harness supports the required coordination pattern (e.g., handoffs, swarm, hierarchical).
- Frameworks: Multi-agent is native. LangGraph supports graph-based routing. CrewAI uses role-based crews. AutoGen supports conversational groups. Frameworks offer greater flexibility for custom multi-agent topologies.
Pitfall Guide
1. The "Framework vs. Harness" Category Error
Explanation: Comparing an open-source framework like LangChain directly against a managed harness like Bedrock Agents. These operate at different layers; frameworks provide building blocks, while harnesses provide a managed runtime.
Fix: Classify tools by loop ownership first. Compare frameworks to frameworks and harnesses to harnesses. Evaluate based on whether you need to build the loop or consume a managed loop.
2. Governance Blind Spots in Frameworks
Explanation: When using a framework, developers often focus on agent logic and neglect to implement governance controls like budget caps, tool allowlists, or audit trails. This can lead to unbounded costs or security violations.
Fix: Implement governance middleware early. Treat safety controls as first-class components of the architecture, not afterthoughts. Use sandboxing for all tool executions.
3. SDK Vendor Lock-in
Explanation: Agent SDKs bind your code to a vendor's runtime. If the vendor changes the API or discontinues the service, migration can be costly.
Fix: Abstract SDK usage behind internal interfaces. Design your application to interact with a generic agent interface, allowing you to swap underlying SDKs if necessary.
4. Sandbox Neglect
Explanation: Frameworks typically run in the developer's environment. Without proper sandboxing, agents can access sensitive files, execute malicious code, or interact with production systems unintentionally.
Fix: Always run agent tool executions in isolated environments. Use dedicated sandbox services like E2B or Daytona, or containerize tool execution with strict resource limits.
5. Multi-Agent Orchestration Complexity
Explanation: Harnesses often have limited multi-agent capabilities compared to frameworks. Relying on a harness for complex multi-agent workflows may require workarounds or external orchestration services.
Fix: Assess multi-agent requirements early. If your workflow requires complex graph logic or custom coordination, a framework may be more suitable. If multi-agent needs are simple, a harness with external orchestration may suffice.
6. Context Engineering in CLI Harnesses
Explanation: CLI-based harnesses like GitHub Copilot require careful context engineering to manage multi-agent patterns. Poor context management can lead to agents losing state or duplicating work.
Fix: Invest in context engineering strategies. Use structured prompts, explicit state passing, and background agents to manage complexity. Test multi-agent patterns thoroughly in isolated environments.
7. Memory Strategy Mismatch
Explanation: Different control planes offer different memory mechanisms. Harnesses may provide session-based memory, while frameworks allow custom memory structures like vector stores or graph databases.
Fix: Align memory strategy with application requirements. If you need persistent, queryable memory across sessions, ensure your chosen control plane supports the required memory type or allows integration with external memory services.
Production Bundle
Action Checklist
Decision Matrix
| Scenario | Recommended Control Plane | Why | Cost Impact |
|---|
| Enterprise Compliance Required | Agent Harness | Built-in IAM, audit logs, and guardrails reduce compliance overhead. | Higher base cost, lower dev cost. |
| Complex Custom Workflow | Agent Framework | Graph logic and custom nodes enable complex orchestration. | Lower base cost, higher dev cost. |
| Rapid Prototyping | Agent SDK | Thin client allows fast integration with vendor models. | Pay-per-use, limited control. |
| IDE-Local Development | IDE Agent | Context awareness and dev flow integration accelerate coding. | Per-seat licensing. |
| Autonomous Cloud Agent | Autonomous Agent | Self-directed agent with cloud environment for full autonomy. | High usage cost, minimal setup. |
Configuration Template
Use the following template to define your control plane selection criteria and governance requirements.
# Control Plane Selection Template
project:
name: "Agentic System"
requirements:
governance_level: "high" # low, medium, high
flexibility_level: "medium" # low, medium, high
compliance_needed: true
multi_agent_complexity: "simple" # simple, moderate, complex
control_plane:
type: "harness" # harness, framework, sdk
rationale: "High governance and compliance requirements favor a managed harness."
governance:
budget_limit_usd: 50.00
max_tool_calls: 100
allowed_tools: ["read_data", "write_report"]
denied_tools: ["delete_data", "execute_script"]
audit_logging: true
tools:
- name: "read_data"
integration: "api"
endpoint: "https://api.example.com/data"
- name: "write_report"
integration: "lambda"
arn: "arn:aws:lambda:us-east-1:123456789:function:WriteReport"
memory:
type: "session_vector"
retention_days: 90
observability:
provider: "langsmith" # or vendor-specific
tracing: true
metrics: true
Quick Start Guide
- Audit Requirements: Evaluate your project's governance, flexibility, and compliance needs. Determine loop ownership requirements.
- Select Control Plane: Use the Decision Matrix to choose between a harness, framework, or SDK.
- Define Governance: Configure budget caps, tool allowlists, and audit logging. Implement governance middleware if using a framework.
- Implement Loop: Build the execution loop using your chosen control plane. Integrate tools and memory mechanisms.
- Deploy and Monitor: Deploy your agent system. Monitor observability metrics and adjust governance controls as needed.