TDM DaOS Agent

Agent Skill Definitions, Reference Docs, and Payment Guidance for TDM DaOS

License: MIT MCP Guidance GitHub stars

Agent skill definitions, contract reference docs, and payment guidance for TDM DaOS (Decentralized Agent Operating System).

DocumentationAPI ReferenceGitHubX/Twitter


What is TDM DaOS Agent?

Agent guidance repository for TDM DaOS. This is not a package to install -- it is a collection of skill definitions, reference docs, and utility scripts that teach AI agents how to work with the TDM payment and agent runtime system.

What it provides:

  • SKILL.md -- agent skill definition for Claude, GPT-4, and other AI runtimes
  • references/ -- detailed contract docs (authorize API, MCP runtime, sweep capabilities, vault scenarios)
  • scripts/ -- utility scripts for price lookups and sweep execution

What it is not:

  • Not the TDM SDK (use npm install -g tdm-sdk)
  • Not a runnable application
  • Not a separate package operators need to install

Quick Start

npm install -g tdm-sdk
tdm connect

Then configure your agent with the skill definition in SKILL.md or agents/openai.yaml.


What It Covers

Payment Interpretation

  • POST /authorize responses
  • Payment-required (402) handling
  • Balance checks and authorization IDs

Session Gas Tank

  • Prepaid budget model
  • Delegated session tokens
  • Multi-agent spending

Recovery Actions

  • tdm fuel -- top up gas tank
  • tdm sweep -- recover dust to stablecoin
  • tdm sweep status -- check progress

Public Contracts

  • SDK request/response formats
  • CLI command patterns
  • MCP integration guidance

Core Commands

Authentication

tdm connect                              # One-time wallet + gateway setup
tdm login --gateway <url> --api-key <k>  # Manual headless setup

Funding

tdm fuel --amount 5 --yes                # Top up Session Gas Tank
tdm fuel --amount 10 --session-id <id>   # Fund specific session

Recovery

tdm sweep --network solana --resume-burner --deposit-address <addr>
tdm sweep status

Seller Payouts

tdm cashout                              # Withdraw earned revenue

Agent Management

tdm vault create photos --use            # Named vault for isolation
tdm agent list                           # List agents
tdm agent spawn worker-1 --type DISCRETE --limit 5
tdm agent boot worker-1                  # Issue session token

Route Policy (optional)

tdm allowlist add api.example.com --scope vault --vault photos --verified
tdm allowlist check https://api.example.com/private/route --vault photos

Payment Flow

sequenceDiagram
    participant Agent as Agent Runtime
    participant SDK as TDM SDK
    participant Payment as TDM Payment Surface
    participant User as User

    Agent->>SDK: Call protected operation
    SDK->>Payment: Check whether the request can proceed
    Payment-->>SDK: Top-up needed
    SDK-->>Agent: Payment required
    Agent->>User: "Suggest: tdm fuel --amount 5"
    User->>User: Run tdm fuel
    User-->>Agent: Ready
    Agent->>SDK: Retry operation
    SDK->>Payment: Check again
    Payment-->>SDK: Access approved
    SDK-->>Agent: Success

Integration Example

import { createFetchHookClient, makePayable, LocalPaymentRequiredError } from 'tdm-sdk';

const hooks = createFetchHookClient({
  baseUrl: 'https://tdm.todealmarket.com',
  apiKey: 'your-api-key'
});

const payableFunction = makePayable(
  async (input: string) => {
    return `Tool result: ${input}`;
  },
  {
    operation: 'agent:tool-call',
    tokenOrUuid: 'user-123',
    hooks
  }
);

try {
  await payableFunction('hello');
} catch (error) {
  if (error instanceof LocalPaymentRequiredError && error.statusCode === 402) {
    // Suggest: tdm fuel --amount 5
  }
}

Key Concepts

Session Gas Tank

A prepaid budget for agent workflows:

  1. Operator funds with tdm fuel
  2. Agent gets a session token via tdm agent boot <name>
  3. Paid requests go through POST /authorize
  4. Spending enforced by the Session Gas Tank contract

Sweep vs Cashout

Sweep (Recovery) Cashout (Seller Payout)
Purpose Convert dust to stablecoin Withdraw earned revenue
Who User-initiated Seller-initiated
Command tdm sweep tdm cashout
Networks Solana, Base Solana

Keep them separate. Sweep recovers small balances; cashout withdraws revenue.


SDK Surface for Payment Contracts

The public tdm-sdk surface around this contract:

Export Purpose
makePayable() Wrap any function with payment hooks
createFetchHookClient() Live gateway authorize + telemetry
createGatewayClients() Composed client: authorize + sessionTanks + checkout
createSessionTanksClient() Session gas tank management
createCheckoutClient() Buyer-facing checkout
LocalPaymentRequiredError 402 error with retry-after, balance, payment options

Repository Structure

tdm-daos-agent/
├── README.md              ← You are here
├── SKILL.md               ← Agent skill definition (primary artifact)
├── agents/
│   └── openai.yaml        ← OpenAI agent configuration
├── references/
│   ├── authorize-contract.md      ← /authorize API contract
│   ├── mcp-runtime.md             ← MCP integration guide
│   ├── sdk-sweep-capabilities.md  ← Sweep flow documentation
│   ├── vault-scenarios.md         ← Vault usage scenarios
│   └── adaptation-map.md          ← SDK adaptation guide
└── scripts/
    ├── fetch_x402_price.mjs       ← Price lookup utility
    └── run_tdm_sweep.mjs          ← Sweep execution script

Security Notes

  • No private keys in this repo -- this is guidance only
  • OS keyring required -- CLI stores keys securely
  • Session tokens expire -- short-lived by design
  • Review local automations carefully -- especially when using advanced signer flows

Documentation


License

MIT License - see LICENSE for details


Built by the TDM team

WebsiteDocumentationGitHubX/Twitter