Awesome Reviewers

Agentic systems that can spend money, handle credentials, or call AWS APIs must enforce three controls:

1) Require explicit user consent before spending or creating payment sessions

2) Keep secrets out of LLM inputs/parameters

3) Use least-privilege permissions in production

Example (consent gate + env-based secrets):

// Pseudocode / integration-style example
function shouldCreatePaymentSession(userMessage) {
  // e.g., ask and require a clear yes/no
  return userMessage.includes("I approve") || userMessage.includes("Yes, create it");
}

async function handleUserRequest(agent, req) {
  if (req.action === "create_payment_session") {
    // 1) Always ask for consent; show budget/duration details.
    const userApproved = await agent.askUserForApproval({
      budget: req.budget,
      duration: req.duration,
    });

    if (!userApproved) return { status: "cancelled" };

    // 2) Load secrets locally (not from the LLM conversation).
    //    .env example:
    //    CDP_API_KEY_ID=...
    //    CDP_API_KEY_SECRET=...
    //    CDP_WALLET_SECRET=...
    const cdpApiKeyId = process.env.CDP_API_KEY_ID!;
    const cdpApiKeySecret = process.env.CDP_API_KEY_SECRET!;
    const cdpWalletSecret = process.env.CDP_WALLET_SECRET!;

    // Tool call with secrets handled by the host process.
    return agent.tools.create_payment_session({
      budget: req.budget,
      duration: req.duration,
      // Do NOT include raw secrets in any LLM messages.
      // Secrets stay in the execution environment / secure host config.
    });
  }
}

Adopt this as a standard checklist for any tool the agent can invoke that: