这是indexloc提供的服务,不要输入任何密码
Skip to content

[Feat]: Add before|after_execute config to x402ServerExecutor #40

@matiasanaya

Description

@matiasanaya

Is your feature request related to a problem? Please describe.

When payment is provided, the x402ServerExecutor is:

  1. Verifying: self.verify_payment(...)
  2. Setting task metadata
  3. Executing: await self._delegate.execute(context, event_queue)
  4. Settling: await self.settle_payment(...)

I'd argue that's too much. In particular, users might want to settle before executing.

Describe the solution you'd like

I suggest the x402ServerExecutor delegates some of these tasks. In particular I think x402ExtensionConfig should be expanded to accommodate before_execute and after_execute hooks that would take in a PaymentPayload and a PaymentRequirements and do the required verification and settling as the user sees fit. before_execute could also use it's return value to set task metadata.

If required this library could provide additional defaults to keep the current behavior as a convenience.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions