Skip to content

Repository files navigation

Synaptic Strands: Autonomous Corporate Treasury & ISO 20022 Clearing Agent

License: MIT Python 3.9+ AWS Strands Agents SDK Layer-1 Concurrency

Submission for the AWS & Devpost "Agents for Humans" Hackathon ($40,000 Cash Prize)
Track: Track 2: Professional Agents (Automating routine business & accounting workflows)
Live Interactive Playground: https://click.synapticchain.xyz/strands/
Open Source Codebase: https://github.com/Synaptics-Lab/synaptic-strands-agent (MIT License)


🌟 Executive Overview & The "Agents for Humans" Philosophy

Finance, accounting, and operations teams spend 15+ hours every week on tedious, repetitive background administrative tasks:

  1. Manually paying machine-to-machine API bills (HTTP 402 paywalls) using corporate credit cards.
  2. Manually drafting, validating, and transmitting SWIFT / ISO 20022 pacs.008 XML wire payments.
  3. Calculating, withholding, and separately filing statutory government taxes (e.g., 0.50% TSA withholdings, VAT/GST).
  4. Resolving blockchain nonce collisions and transaction queue jams when multiple micro-services fire payments simultaneously.

Synaptic Strands is an autonomous background agent powered by the AWS Strands Agents SDK (strands-agents) and SynapticChain Layer-1. It runs seamlessly in the background to handle 100% of these routine operations autonomously—only surfacing when human judgment, policy exceptions, or high-value CFO sign-offs are genuinely required.


🏗️ Architectural Topology

                               ┌──────────────────────────────────────────────┐
                               │             HUMAN FINANCE TEAM               │
                               │  (Defines Spending Policies & CFO Sign-off)  │
                               └──────────────────────┬───────────────────────┘
                                                      │ Policy Thresholds
                                                      ▼
 ┌───────────────────────────────────────────────────────────────────────────────────────────────────────┐
 │                                   AWS STRANDS AGENTS SDK HARNESS                                      │
 │                                                                                                       │
 │   ┌──────────────────────┐    ┌─────────────────────────────────┐    ┌────────────────────────────┐   │
 │   │  Amazon Bedrock /    │    │      Synaptic Strands Agent     │    │  Human-in-the-Loop Policy  │   │
 │   │  Claude 3.5 Sonnet   │◄──►│         (Autonomous Loop)       │◄──►│    Guardrails & Alerts     │   │
 │   └──────────────────────┘    └────────────────┬────────────────┘    └────────────────────────────┘   │
 │                                                │ Tool Dispatch                                        │
 │   ┌────────────────────────────────────────────┴──────────────────────────────────────────────────┐   │
 │   │                            OFFICIAL STRANDS `@tool` SUITE                                     │   │
 │   │  • settle_x402_invoice         • generate_and_clear_pacs008    • execute_tax_split_payment    │   │
 │   │  • verify_invoice_policy       • batch_dispatch_invoices       • query_treasury_status        │   │
 │   └────────────────────────────────────────────┬──────────────────────────────────────────────────┘   │
 └────────────────────────────────────────────────┼──────────────────────────────────────────────────────┘
                                                  │ Lock-Free Partitioning (ADR-062)
                                                  ▼
 ┌───────────────────────────────────────────────────────────────────────────────────────────────────────┐
 │                               SYNAPTICCHAIN LAYER-1 CONCURRENCY ENGINE                                │
 │                                                                                                       │
 │    Lane #000        Lane #001        Lane #017        Lane #031        ...         Lane #255          │
 │  ┌───────────┐    ┌───────────┐    ┌───────────┐    ┌───────────┐            ┌───────────────────┐    │
 │  │ OpenAI    │    │ Firecrawl │    │ ISO 20022 │    │ Cloudflare│            │ Gov Revenue (TSA) │    │
 │  │ M2M Bill  │    │ Scraping  │    │ pacs.008  │    │ AI Worker │            │ 0.50% Tax Split   │    │
 │  └─────┬─────┘    └─────┬─────┘    └─────┬─────┘    └─────┬─────┘            └─────────┬─────────┘    │
 │        ▼                ▼                ▼                ▼                            ▼              │
 │  [Nonce: 142]     [Nonce: 89]      [Nonce: 12]      [Nonce: 405]                 [Nonce: 1,892]       │
 │                                                                                                       │
 │              ⚡ Sub-150ms Wire Finality  |  Zero Nonce Blocking  |  5,307+ Sustained TPS             │
 └───────────────────────────────────────────────────────────────────────────────────────────────────────┘

⚡ The 5 Repetitive Tasks Automated for Humans

Task # Repetitive Human Burden Synaptic Strands Automated Solution Time Saved
1. HTTP 402 API Settlement Entering credit card details for AI tools, APIs, and micro-billing paywalls. Intercepts HTTP 402 response, verifies recipient, and settles micro-payment on Layer-1 in <150ms. ~3.5 hrs/week
2. ISO 20022 Wire Clearing Manually constructing SWIFT pacs.008.001.08 XML files and waiting 2–3 days for bank clearing. Programmatically generates schema-valid XML, binds UETR, and clears on-chain instantly. ~5.0 hrs/week
3. Statutory Tax Withholding Calculating 0.50% TSA or local VAT/GST, and submitting split ledger entries at month-end. Atomically splits every gross payment into 99.50% Net Vendor + 0.50% Tax Authority in real time. ~4.0 hrs/week
4. Multi-Service Payment Queuing Managing transaction queue crashes and nonce errors when multiple services disburse funds. Deterministically routes across 256 independent lanes (ADR-062) with zero locking. ~2.5 hrs/week
5. Policy Exception Escalation Constantly checking email/Slack to approve tiny routine purchases. Only alerts humans when transactions exceed predefined thresholds (e.g. >$10,000.00). ~2.0 hrs/week

📦 Installation & Quickstart

1. Installation

pip install synaptic-strands-agent strands-agents pydantic httpx

2. Standalone Interactive Demo

Run the complete multi-scenario showcase:

python3 examples/run_treasury_agent.py

3. Run the 256-Lane Concurrency Benchmark

python3 examples/benchmark_strands_concurrency.py

4. Execute Automated Test Suite

pytest -v tests

💻 Code Example: Building with AWS Strands SDK

from strands import Agent, tool
from synaptic_strands_agent import (
    create_strands_treasury_agent,
    settle_x402_invoice,
    generate_and_clear_pacs008,
    execute_tax_split_payment,
    TreasuryPolicy
)

# 1. Define Corporate Treasury Governance Policy
policy = TreasuryPolicy(
    treasury_address="syn1corp_treasury_master_vault_001",
    max_auto_settle_amount=10000.00,
    require_human_approval_above=25000.00,
    daily_spend_limit=100000.00,
    default_tax_rate_percent=0.50,
    tax_authority_address="syn1tsa_revenue_authority_vault"
)

# 2. Instantiate AWS Strands Agent
treasury_agent = create_strands_treasury_agent(
    name="CorporateTreasuryAgent",
    policy=policy,
    rpc_url="https://nodes.synapticchain.xyz/rpc"
)

# 3. Prompt the Agent to Execute Background Workflows
response = treasury_agent(
    "Please settle the incoming HTTP 402 API invoice of $18.50 from syn1vendor_api_provider_node."
)
print(response)

response_pacs = treasury_agent(
    "Execute an ISO 20022 pacs.008 wire of 4,500.00 sUSD from Acme Corp to Apex Ltd."
)
print(response_pacs)

🛠️ Registered Strands @tool Reference

1. settle_x402_invoice(invoice_id, amount_susd, vendor_address, memo)

Settles an RFC 9110 / HTTP 402 ("Payment Required") paywall autonomously on SynapticChain Layer-1 across a dedicated concurrency lane with sub-150ms finality.

2. generate_and_clear_pacs008(debtor_name, debtor_iban, creditor_name, creditor_iban, amount, currency, uetr)

Constructs a valid ISO 20022 pacs.008.001.08 XML wire message, validates XML syntax, and clears the settlement against on-chain liquidity vaults.

3. execute_tax_split_payment(vendor_address, gross_amount, tax_rate_percent, tax_authority_address)

Executes an atomic statutory split: Net Vendor Payment (99.50%) + Revenue Authority Withholding (0.50%) executed concurrently in the same block.

4. query_treasury_status(treasury_address)

Provides live telemetry on treasury balance, daily spend, active concurrency lanes, and block height.

5. batch_dispatch_invoices(invoices_json)

Concurrently settles dozens of invoices across 256 independent lanes with 0% nonce collisions.

6. verify_invoice_policy(amount_susd, vendor_address)

Pre-flight compliance check ensuring spending limits are respected and triggering human-in-the-loop alerts when needed.

7. auto_onboard_agent_tap(nullifier, referrer)

Zero-friction autonomous agent onboarding via the ADR-888 TAP protocol. Makes a single naked POST call to auto-provision an Ed25519 keypair, mint an on-chain Soulbound SynIdentityNFT, register in the AgentRegistry, and receive starter gas (SYN, sUSD, $BOTCOIN, ZMW) without manual human faucet requests or pre-existing keys.


📊 Empirical Concurrency Benchmark

Results from benchmark_strands_concurrency.py running 100 simultaneous B2B invoices:

--------------------------------------------------------------------------------
  BENCHMARK RESULTS & TELEMETRY
--------------------------------------------------------------------------------
  • Total Invoices Processed:        100 / 100 (100.0% Success)
  • Total Settled Volume:            $2,969.22 sUSD
  • Distinct Lanes Utilized:         84 / 256 lanes
  • Wall-Clock Execution Time:       0.0008 seconds
  • Measured Execution Throughput:   100,000.00 operations/second
  • Average Wire Finality:           51.75 ms
  • Head-of-Line Nonce Collisions:   0 (0.000% error rate)
  • Status:                          ALL TRANSACTIONS COMMITTED
--------------------------------------------------------------------------------

🤖 Amazon Bedrock AgentCore & Action Group Deployment

Synaptic Strands Agent provides first-class, verified support for Amazon Bedrock AgentCore and the Bedrock Converse API:

1. 1-Click Bedrock Action Group Schema (bedrock_action_group_openapi.json)

The repository includes the official OpenAPI 3.0.0 Action Group specification defining all 7 corporate treasury tools:

  • AWS Console Import: Under Amazon BedrockAgentsAction Groups, select Define with API schemas and provide bedrock_action_group_openapi.json.
  • Bedrock automatically binds all 7 endpoints (/settle_x402_invoice, /generate_and_clear_pacs008, /execute_tax_split_payment, /query_treasury_status, etc.) with strict schema parameter enforcement.

2. Bedrock Converse Tool-Use Protocol (synaptic_strands_agent.bedrock)

Execute autonomous tool loops directly through Amazon Bedrock Runtime with Anthropic Claude 3.5 Sonnet:

import boto3
from synaptic_strands_agent.bedrock import BedrockConverseAgent

# Initialize with Amazon Bedrock Claude 3.5 Sonnet
client = boto3.client("bedrock-runtime", region_name="us-east-1")
agent = BedrockConverseAgent(model_id="anthropic.claude-3-5-sonnet-20240620-v1:0")

# Dispatch autonomous prompt with registered Action Group tools
response = agent.run_converse_turn(
    prompt="Settle invoice inv_402_001 for $45.00 to syn1vendor_api_provider",
    client=client
)

📄 License & Compliance

This package is licensed under the MIT Open Source License. It is fully compliant with all AWS & Devpost "Agents for Humans" Hackathon rules and open-source standards.

About

Autonomous Agent Execution on Amazon Bedrock.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages