mech.app

The mech.app newsletter

Agentic AI, minus the noise.

Get practical field notes on AI agents, automation, developer tools and security delivered to your inbox.

No spam. Unsubscribe anytime.

AI Agents

Duco's 90% Context Cut: How MCP Skills Architecture Rebuilt Financial Reconciliation Agents for Multi-Tenant Banks

How a tier-one banking data platform used MCP skills and per-tenant isolation to cut context overhead 90% and deployment time 10x in production.

Source: aws.amazon.com
Duco's 90% Context Cut: How MCP Skills Architecture Rebuilt Financial Reconciliation Agents for Multi-Tenant Banks

Duco, a data automation platform serving tier-one banks, rebuilt its agentic AI stack on Amazon Bedrock and Amazon Bedrock AgentCore. The result: 90% reduction in context overhead, 10x faster reconciliation deployment, and 70% lower onboarding costs. This is not a prototype. It is a production system handling financial reconciliation workflows under regulatory scrutiny, with strict per-tenant isolation and audit trail requirements.

The architecture choices here matter because financial reconciliation is a high-stakes, high-volume workflow. Banks need to match transactions across systems, flag discrepancies, and maintain deterministic rollback paths. Agents must operate within data boundaries that prevent cross-tenant leakage, and every decision must be traceable.

The Context Overhead Problem

Before the rebuild, Duco’s agents carried heavy context payloads. Each reconciliation task required the agent to understand the entire data schema, transformation rules, and business logic for a given tenant. This bloated token counts, slowed inference, and made debugging opaque.

The 90% reduction came from adopting an MCP (Model Context Protocol) skills architecture. Instead of loading all possible tools and schemas into every agent invocation, Duco decomposed capabilities into discrete, callable skills. Each skill exposes a narrow interface: input schema, output schema, and execution logic. The agent orchestrator selects skills dynamically based on the task, loading only what it needs.

What was removed:

  • Redundant schema definitions repeated across tasks
  • Unused transformation logic for other tenants
  • Static tool descriptions that never applied to the current reconciliation

What stayed:

  • Task-specific schemas
  • Active tenant configuration
  • Execution history for the current workflow

This is not just a token optimization. It changes the failure surface. Smaller context windows mean fewer opportunities for the model to hallucinate irrelevant transformations or cross-wire tenant logic.

Per-Tenant Isolation in a Multi-Model Architecture

Duco serves multiple tier-one banks. Each bank has its own data formats, reconciliation rules, and compliance requirements. The platform cannot allow one tenant’s agent to access another tenant’s data or logic.

The isolation strategy:

  • Tenant-scoped skill registries: Each tenant gets a dedicated skill catalog. When an agent initializes, it receives only the skills registered for that tenant.
  • Credential vaulting: API keys, database credentials, and service tokens are stored in AWS Secrets Manager with IAM policies scoped to tenant namespaces.
  • Execution sandboxing: Agent workflows run in isolated Lambda functions or ECS tasks, with network policies that prevent cross-tenant communication.
  • Audit logging: Every skill invocation, model call, and state transition is logged to CloudWatch with tenant ID tags. This supports both debugging and regulatory audits.

The multi-model strategy adds another layer. Duco does not rely on a single LLM. Different reconciliation tasks route to different models on Amazon Bedrock based on cost, latency, and accuracy trade-offs. For example:

  • Claude 3.5 Sonnet: Complex schema transformations and multi-step reasoning
  • Claude 3 Haiku: High-volume, low-latency classification tasks
  • Amazon Titan: Embedding generation for similarity matching

Each model is invoked through Bedrock’s unified API, but the orchestrator tracks which model handled which task. If a reconciliation fails, the audit log shows the exact model version, input context, and skill chain.

Reconciliation Workflow Plumbing

A typical reconciliation workflow in Duco looks like this:

  1. Ingestion: Raw transaction files arrive via S3. An EventBridge rule triggers a Lambda function that validates the schema and queues the job.
  2. Agent initialization: The orchestrator spins up an agent with the tenant’s skill registry and model routing rules.
  3. Skill selection: The agent analyzes the transaction types and selects skills for normalization, matching, and exception handling.
  4. Execution: Each skill runs as a separate function call. The agent maintains state in DynamoDB, tracking which records have been processed and which are pending.
  5. Exception handling: If a match fails, the agent invokes a human-in-the-loop skill that routes the discrepancy to a review queue.
  6. Audit trail: Every state transition is written to CloudWatch Logs and S3 for compliance.

The key architectural choice is stateful orchestration. The agent does not retry the entire workflow on failure. It resumes from the last committed state in DynamoDB. This is critical for financial workflows where partial reconciliation is worse than no reconciliation.

Code Snippet: MCP Skill Invocation

Here is a simplified example of how Duco’s orchestrator invokes an MCP skill:

import boto3
import json

bedrock_runtime = boto3.client('bedrock-runtime')
dynamodb = boto3.resource('dynamodb')

def invoke_skill(tenant_id, skill_name, input_data):
    # Load tenant-scoped skill definition
    skills_table = dynamodb.Table('tenant-skills')
    skill = skills_table.get_item(
        Key={'tenant_id': tenant_id, 'skill_name': skill_name}
    )['Item']
    
    # Build model request with minimal context
    prompt = f"""
You are executing the {skill_name} skill.
Input schema: {skill['input_schema']}
Output schema: {skill['output_schema']}
Data: {json.dumps(input_data)}

Execute the skill and return only the output.
"""
    
    response = bedrock_runtime.invoke_model(
        modelId=skill['model_id'],
        body=json.dumps({
            'prompt': prompt,
            'max_tokens': 500,
            'temperature': 0.0
        })
    )
    
    result = json.loads(response['body'].read())
    
    # Log invocation for audit
    log_skill_invocation(tenant_id, skill_name, input_data, result)
    
    return result

This pattern keeps context tight. The agent does not see the entire skill catalog or other tenants’ schemas. It receives only the input and output contracts for the current skill.

Deployment Shape and Observability

Duco’s deployment runs on AWS with the following components:

  • Amazon Bedrock: Model inference and agent runtime
  • Amazon Bedrock AgentCore: Orchestration and skill management
  • AWS Lambda: Skill execution and event handlers
  • Amazon DynamoDB: State management and workflow checkpoints
  • Amazon S3: Raw data ingestion and audit log storage
  • Amazon CloudWatch: Logs, metrics, and alarms
  • AWS Secrets Manager: Credential vaulting

Observability is built around three metrics:

  1. Skill latency: Time from skill invocation to result. Tracked per skill, per tenant, per model.
  2. Context token count: Measured at each agent invocation. Alerts fire if context exceeds thresholds.
  3. Reconciliation accuracy: Percentage of transactions matched without human intervention.

The 10x deployment speedup comes from skill reusability. When onboarding a new tenant, Duco does not rebuild the entire agent. It registers tenant-specific skills in the catalog and configures model routing rules. The orchestrator handles the rest.

Trade-Offs and Failure Modes

DimensionTrade-OffRisk
Context reductionSmaller context = faster inference, lower costAgent may lack information for edge cases
Per-tenant isolationStrong security boundariesOverhead in credential management and skill duplication
Multi-model routingOptimized cost and latencyComplexity in model version tracking and debugging
Stateful orchestrationReliable resume on failureDynamoDB becomes a single point of failure
MCP skills architectureReusable, composable capabilitiesSkill interface changes require careful versioning

Likely failure modes:

  • Skill version drift: If a skill’s input schema changes, older workflows may break. Duco mitigates this with semantic versioning and backward compatibility tests.
  • DynamoDB throttling: High-volume reconciliation can exhaust DynamoDB write capacity. Auto-scaling and provisioned throughput help, but spikes still cause delays.
  • Model hallucination: Even with tight context, models can generate invalid outputs. Duco validates all skill results against output schemas before committing state.
  • Cross-tenant leakage: A misconfigured IAM policy or skill registry could expose one tenant’s data to another. Automated policy audits and integration tests guard against this.

Technical Verdict

Use this architecture when:

  • You need multi-tenant agent deployments with strict data isolation
  • Reconciliation or data transformation workflows require audit trails and deterministic rollback
  • Context overhead is a cost or latency bottleneck
  • You want to optimize model selection per task without rewriting orchestration logic

Avoid this architecture when:

  • Your workflows are simple enough that a single-model, stateless agent suffices
  • You cannot tolerate the operational complexity of managing skill registries and per-tenant configurations
  • Your team lacks experience with AWS IAM policies and multi-account security boundaries
  • You need real-time, sub-second latency (the state management and skill invocation overhead adds 100-300ms per task)

The 90% context reduction and 10x deployment speedup are real, but they come from careful decomposition of capabilities and disciplined state management. This is not a drop-in solution. It is a blueprint for teams building production-grade, multi-tenant agentic systems in regulated industries.