Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,15 @@ agentcore # interactive TUI
│ │ ├── update # update a connector's description or credential provider
│ │ └── delete # delete a connector
│ ├── session # budget-limited payment contexts (data plane)
│ │ ├── create # create a session with an expiry and optional spend limit
│ │ ├── get
│ │ └── list
│ │ ├── list
│ │ └── delete
│ └── instrument # embedded crypto wallets (data plane)
│ ├── create # create a wallet for a user on a connector
│ ├── get
│ ├── list
│ ├── delete
│ └── balance # read token balance on an explicit chain (default token: USDC)
├── eval # evaluate and optimize AgentCore agents
│ └── evaluator # manage AgentCore evaluators
Expand Down Expand Up @@ -243,8 +247,8 @@ agentcore identity payment-credential-provider create --name cdp-creds --vendor
agentcore payment connector create --manager-id <manager id> --name Coinbase --credential-provider cdp-creds

# Session and instrument commands take the parent manager ID and a user id.
agentcore payment session list --manager-id <manager id> --user-id alice
agentcore payment instrument list --manager-id <manager id> --user-id alice
agentcore payment session create --manager-id <manager id> --user-id alice \
--expiry-minutes 60 --max-spend 10.00 --currency USD

# Check funding on one chain. USDC is the default token.
agentcore payment instrument balance --manager-id <manager id> --user-id alice \
Expand Down
56 changes: 56 additions & 0 deletions src/core/payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ import {
type UpdatePaymentManagerResponse,
} from "@aws-sdk/client-bedrock-agentcore-control";
import {
CreatePaymentInstrumentCommand,
CreatePaymentSessionCommand,
DeletePaymentInstrumentCommand,
DeletePaymentSessionCommand,
GetPaymentInstrumentBalanceCommand,
GetPaymentInstrumentCommand,
GetPaymentSessionCommand,
ListPaymentInstrumentsCommand,
ListPaymentSessionsCommand,
type BedrockAgentCoreClient,
type CreatePaymentInstrumentResponse,
type CreatePaymentSessionResponse,
type DeletePaymentInstrumentResponse,
type DeletePaymentSessionResponse,
type GetPaymentInstrumentResponse,
type GetPaymentInstrumentBalanceResponse,
type GetPaymentSessionResponse,
Expand All @@ -48,11 +56,15 @@ import type {
CorePaymentClient,
CreatePaymentConnectorInput,
CreatePaymentManagerInput,
CreatePaymentSessionInput,
GetPaymentSessionInput,
ListPaymentSessionsInput,
DeletePaymentSessionInput,
CreatePaymentInstrumentInput,
GetPaymentInstrumentInput,
GetPaymentInstrumentBalanceInput,
ListPaymentInstrumentsInput,
DeletePaymentInstrumentInput,
UpdatePaymentConnectorInput,
UpdatePaymentManagerInput,
} from "../handlers/payment/types";
Expand Down Expand Up @@ -248,6 +260,18 @@ export class PaymentClient implements CorePaymentClient {
.send(new DeletePaymentConnectorCommand({ ...request }));
}

// ─── payment sessions (data plane) ──────────────────────────────────────────

async createPaymentSession(
input: CreatePaymentSessionInput,
options: CoreOptions,
): Promise<CreatePaymentSessionResponse> {
const { managerId, ...request } = input;
return this.withPaymentManagerArn(managerId, options, (data, paymentManagerArn) =>
data.send(new CreatePaymentSessionCommand({ paymentManagerArn, ...request })),
);
}

async getPaymentSession(
input: GetPaymentSessionInput,
options: CoreOptions,
Expand All @@ -268,6 +292,28 @@ export class PaymentClient implements CorePaymentClient {
);
}

async deletePaymentSession(
input: DeletePaymentSessionInput,
options: CoreOptions,
): Promise<DeletePaymentSessionResponse> {
const { managerId, ...request } = input;
return this.withPaymentManagerArn(managerId, options, (data, paymentManagerArn) =>
data.send(new DeletePaymentSessionCommand({ paymentManagerArn, ...request })),
);
}

// ─── payment instruments (data plane) ───────────────────────────────────────

async createPaymentInstrument(
input: CreatePaymentInstrumentInput,
options: CoreOptions,
): Promise<CreatePaymentInstrumentResponse> {
const { managerId, ...request } = input;
return this.withPaymentManagerArn(managerId, options, (data, paymentManagerArn) =>
data.send(new CreatePaymentInstrumentCommand({ paymentManagerArn, ...request })),
);
}

async getPaymentInstrument(
input: GetPaymentInstrumentInput,
options: CoreOptions,
Expand Down Expand Up @@ -298,6 +344,16 @@ export class PaymentClient implements CorePaymentClient {
);
}

async deletePaymentInstrument(
input: DeletePaymentInstrumentInput,
options: CoreOptions,
): Promise<DeletePaymentInstrumentResponse> {
const { managerId, ...request } = input;
return this.withPaymentManagerArn(managerId, options, (data, paymentManagerArn) =>
data.send(new DeletePaymentInstrumentCommand({ paymentManagerArn, ...request })),
);
}

// ─── helpers ────────────────────────────────────────────────────────────────

private async resolveConnectorCredentials(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"paymentInstrument": {
"paymentInstrumentId": "payment-instrument-CG2Tl7U1HnCGfHW",
"paymentManagerArn": "arn:aws:bedrock-agentcore:us-west-2:603141041947:payment-manager/mypaymentmanageraidandal-gx3nxzaira",
"paymentConnectorId": "mycdpconnectoraidandal-okve8guw4y",
"userId": "agentcore-cli-e2e",
"paymentInstrumentType": "EMBEDDED_CRYPTO_WALLET",
"paymentInstrumentDetails": {
"embeddedCryptoWallet": {
"network": "ETHEREUM",
"walletAddress": "0x93581aB831Cc862aA451E91fBf8365e098930859",
"redirectUrl": "https://hub.cdp.coinbase.com/e3eae6406a52"
}
},
"createdAt": {
"$date": "2026-09-08T20:24:40.849Z"
},
"status": "ACTIVE",
"updatedAt": {
"$date": "2026-09-08T20:24:41.673Z"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"status": "DELETED"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$error": {
"name": "ResourceNotFoundException",
"message": "Payment instrument not found: payment-instrument-CG2Tl7U1HnCGfHW for the given user and manager."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"paymentInstrument": {
"paymentInstrumentId": "payment-instrument-CG2Tl7U1HnCGfHW",
"paymentManagerArn": "arn:aws:bedrock-agentcore:us-west-2:603141041947:payment-manager/mypaymentmanageraidandal-gx3nxzaira",
"paymentConnectorId": "mycdpconnectoraidandal-okve8guw4y",
"userId": "agentcore-cli-e2e",
"paymentInstrumentType": "EMBEDDED_CRYPTO_WALLET",
"paymentInstrumentDetails": {
"embeddedCryptoWallet": {
"network": "ETHEREUM",
"walletAddress": "0x93581aB831Cc862aA451E91fBf8365e098930859",
"redirectUrl": "https://hub.cdp.coinbase.com/e3eae6406a52"
}
},
"createdAt": "2026-09-08T20:24:40.849Z",
"status": "ACTIVE",
"updatedAt": "2026-09-08T20:24:41.673Z"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"status": "DELETED"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"paymentSession": {
"paymentSessionId": "payment-session-nq812U4e1BJIfw1",
"paymentManagerArn": "arn:aws:bedrock-agentcore:us-west-2:603141041947:payment-manager/mypaymentmanageraidandal-gx3nxzaira",
"userId": "agentcore-cli-e2e",
"expiryTimeInMinutes": 15,
"createdAt": {
"$date": "2026-09-08T20:20:28.618Z"
},
"updatedAt": {
"$date": "2026-09-08T20:20:28.618Z"
},
"limits": {
"maxSpendAmount": {
"value": "1.00",
"currency": "USD"
}
},
"availableLimits": {
"availableSpendAmount": {
"value": "1.00",
"currency": "USD"
},
"updatedAt": {
"$date": "2026-09-08T20:20:28.697Z"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"status": "DELETED"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$error": {
"name": "ResourceNotFoundException",
"message": "Payment session not found: payment-session-nq812U4e1BJIfw1"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"paymentSession": {
"paymentSessionId": "payment-session-nq812U4e1BJIfw1",
"paymentManagerArn": "arn:aws:bedrock-agentcore:us-west-2:603141041947:payment-manager/mypaymentmanageraidandal-gx3nxzaira",
"userId": "agentcore-cli-e2e",
"expiryTimeInMinutes": 15,
"createdAt": "2026-09-08T20:20:28.618Z",
"updatedAt": "2026-09-08T20:20:28.618Z",
"limits": {
"maxSpendAmount": {
"value": "1.00",
"currency": "USD"
}
},
"availableLimits": {
"availableSpendAmount": {
"value": "1.00",
"currency": "USD"
},
"updatedAt": "2026-09-08T20:20:28.697Z"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"status": "DELETED"
}
Loading
Loading