Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Example: one complete agent workflow (local mock, tests, then Base Sepolia)

已关闭
#40 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript

调研方向

Start with the offline example section in docs/DEVELOPERS.md (#test-without-a-chain) and the startMockServer helper exported from @deepfirstsearch/agent-pay/testing, then check how the newcomer CI job runs those examples. Build examples/agent-workflow/ around a free tool call, a paid x402 call and one hostile 402, with a vitest file asserting all three outcomes. Done means npm test passes offline and the newcomer CI job runs the example.

由索引模型根据 Issue 内容生成。

描述

Suggested by @Priyadharshan2003 in #29. Today the docs show each piece on its own:

  • npx @deepfirstsearch/agent-pay demo;
  • a short offline example per framework in docs/DEVELOPERS.md, which CI runs verbatim;
  • the MCP server.

What's missing is one example that goes through a whole agent workflow, start to finish.

What: examples/agent-workflow/, a small agent (AI SDK or LangChain) that:

  1. reads a task;
  2. calls a free tool and a paid x402 API;
  3. hits one hostile 402 along the way, and shows the refusal code it gets back and what the agent does with it (report, ask_owner, retry_later).

The agent should meet all four outcomes a seller can produce, and handle each one as a value, not an exception. dryRun in agent-pay 0.10.0 returns the first three (suggested by @baianomarceloeduardo-jpg below):

  • allow: pay, and keep the receipt.
  • deny with a code: act on its action (report, ask_owner, fix_config, retry_later).
  • no_challenge: nothing to decide. That covers a free route, a free trial, or a stranger's 404, and the same URL can flip between no_challenge and allow.
  • Transport failure: retry or give up. It isn't a payment decision.

Read-only live URLs for the no_challenge and two-scheme allow fixtures: https://api.automaton-sovereign.workers.dev/pricing (200, no challenge) and https://api.automaton-sovereign.workers.dev/v2/oracle/base (402 with exact + eip3009, or 200 while a caller's free trial lasts).

It should cover three ways to run it:

  • Local development: against startMockServer from @deepfirstsearch/agent-pay/testing, no keys, no chain.
  • Tests: a vitest file that asserts the paid call succeeds, the hostile one is refused with its code, and the budget is enforced.
  • Base Sepolia: the same agent pointed at a real testnet merchant, with the steps to fund a payer (overlaps with #36).

Done when: a newcomer can clone, npm i, npm test and see all three outcomes, and the README walks through what the agent saw at each step. It also needs to be added to the newcomer CI job.

主要语言
TypeScript
星标
0
派生
0
平均合并
3 小时 51 分钟
30 天内合并 PR
3

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DeepFirstHQ/deepfirstsearch 的其他 Issue

查看 DeepFirstHQ/deepfirstsearch 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。