{"id":50833433,"url":"https://github.com/masaun/world-agent-kit-template","last_synced_at":"2026-06-14T01:34:13.810Z","repository":{"id":351963641,"uuid":"1212059290","full_name":"masaun/world-agent-kit-template","owner":"masaun","description":"Template for World Agent Kit integraiton","archived":false,"fork":false,"pushed_at":"2026-04-17T07:59:21.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-17T09:38:10.584Z","etag":null,"topics":["world-agent-kit","zero-knowledge-proof"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/masaun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-16T02:49:17.000Z","updated_at":"2026-04-17T07:49:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/masaun/world-agent-kit-template","commit_stats":null,"previous_names":["masaun/world-agent-kit-template"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/masaun/world-agent-kit-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masaun%2Fworld-agent-kit-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masaun%2Fworld-agent-kit-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masaun%2Fworld-agent-kit-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masaun%2Fworld-agent-kit-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masaun","download_url":"https://codeload.github.com/masaun/world-agent-kit-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masaun%2Fworld-agent-kit-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34306772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["world-agent-kit","zero-knowledge-proof"],"created_at":"2026-06-14T01:34:12.929Z","updated_at":"2026-06-14T01:34:13.799Z","avatar_url":"https://github.com/masaun.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# World AgentKit Template\n\n## Overview\n\nThis repo is the template for the `World AgentKit` integration by referencing the [World AgentKit integration guide](https://docs.world.org/agents/agent-kit/integrate).\n\n\n\n## What this demonstrates\n\n| Step | Component | Description |\n|------|-----------|-------------|\n| 1 | `src/server.ts` | Hono server with a protected `/data` endpoint |\n| 2 | `src/server.ts` | `createAgentkitHooks` enforces a 3-use free-trial per registered human |\n| 3 | `src/agent.ts` | Agent builds a SIWE message, signs it, and sends the `X-AgentKit` header |\n| 4 | Both | First 3 requests succeed; the 4th returns 402 (trial exhausted) |\n\n### Workflow\n\n```\nAgent                             Server                      World Chain\n  |                                  |                              |\n  |-- GET /data + X-AgentKit ------\u003e |                              |\n  |                                  |-- lookupHuman(address) ----\u003e |\n  |                                  |\u003c- humanId ------------------- |\n  |                                  | (free trial: 1/3 used)       |\n  |\u003c-- 200 { data } ----------------- |                              |\n  ...\n  |-- GET /data + X-AgentKit ------\u003e | (3/3 uses exhausted)\n  |\u003c-- 402 { payment required } ---- |\n```\n\n## Quick start\n\n### 1. Install dependencies\n\n```bash\nbun install\n```\n\n### 2. Configure environment\n\n```bash\ncp .env.example .env\n```\n\nEdit `.env` and set `AGENT_PRIVATE_KEY`.\n```bash\nAGENT_PRIVATE_KEY=\"0xYourPrivateKeyHere\"\n```\n\n### 3. Register your `agent's wallet address` (`public key`) to the [`AgentBook`](https://worldscan.org/address/0xa23ab2712ea7bba896930544c7d6636a96b944da#code) contract on `World Chain mainnet`:\n\nRegister your `\u003cagent-wallet-address\u003e`, which is public key of the `AGENT_PRIVATE_KEY` that you set the step 2 above.\n```bash\nbunx @worldcoin/agentkit-cli register \u003cagent-wallet-address\u003e\n```\n\nThe CLI prompts you to verify with World App, then submits the registration\ntransaction to World Chain.\n\n### 4. Start the server\n\n```bash\nbun run dev:server\n```\n\nOutput:\n\n```\n World AgentKit Demo Server\n Listening on http://localhost:3000\n Protected endpoint: GET http://localhost:3000/data\n Free-trial uses: 3 per registered human\n```\n\n### 5. Run the agent demo (separate terminal)\n\n```bash\nbun run dev:agent\n```\n\nExpected output:\n\n```\n--- Request #1 ---   → 200  (free trial 1/3)\n--- Request #2 ---   → 200  (free trial 2/3)\n--- Request #3 ---   → 200  (free trial 3/3)\n--- Request #4 ---   → 402  (trial exhausted — payment required)\n```\n\n## Project layout\n\n```\n.\n├── src/\n│   ├── server.ts   # Hono server + AgentKit hooks + 402 enforcement\n│   └── agent.ts    # Agent wallet + SIWE signing + demo loop\n├── .env.example\n├── package.json\n└── tsconfig.json\n```\n\n## Key constants (`World Chain - mainnet`)\n\n| Name | Value |\n|------|-------|\n| Chain ID (CAIP-2) | `eip155:480` |\n| World USDC | `0x79A02482A880bCE3F13e09Da970dC34db4CD24d1` |\n| AgentBook contract | [`0xA23aB2712eA7BBa896930544C7d6636a96b944dA`](https://worldscan.org/address/0xa23ab2712ea7bba896930544c7d6636a96b944da#code) |\n| Default facilitator | `https://x402-worldchain.vercel.app/facilitator` |\n\n## Production checklist\n\n- [ ] Replace `InMemoryAgentKitStorage` with a database-backed implementation\n  (implement `getUsageCount`, `incrementUsage`, `hasUsedNonce`, `recordNonce`)\n- [ ] Set `PAY_TO` to your actual payment address\n- [ ] Integrate real x402 payment verification for the post-trial flow\n- [ ] Load `AGENT_PRIVATE_KEY` from a secrets manager (e.g. AWS Secrets Manager)\n- [ ] Set `BASE_URL` to your public domain\n\n## References\n\n- [World AgentKit integration guide](https://docs.world.org/agents/agent-kit/integrate)\n- [SDK reference](https://docs.world.org/agents/agent-kit/sdk-reference)\n- [x402 protocol](https://x402.org)\n\n\u003cbr\u003e\n\n\u003chr\u003e\n\n## Extra - How to generate a public key/private key pair and regster it to the `AgentBook` contract on `World Chain mainnet` for testing purpose \n\n- Generate a public key/private key pair and regster it to the `AgentBook` contract on `World Chain mainnet` for testing purpose: \n```bash\nsh random-key-pair-generation-and-registration.sh\n```\n\n\nOr, manually executing the following commands 1 by 1:\n\n1/ Generate an agent `private key`:\n```bash\nbun -e \"console.log('0x' + require('crypto').randomBytes(32).toString('hex'))\"\n```\n\n2/ Derive an agent `wallet address` (`public key`) with a generated `privat key` above using `viem`:\n   \n```bash\n# NOTE: You need to set \"0x\u003cyour-private-key\u003e\" to the privateKeyToAccount() below - before executing the following code.\nbun -e \"\nconst { privateKeyToAccount } = require('viem/accounts');\nconst a = privateKeyToAccount('0x\u003cyour-private-key\u003e');\nconsole.log(a.address);\n\"\n```\n\n3/ Register your agent (NOTE: This is the same with the step 3 of the \"Quick start\" above)\n\nRegister your agent's `wallet-address` (agent's `public-key`)\n```bash\nbunx @worldcoin/agentkit-cli register \u003cagent's wallet-address\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasaun%2Fworld-agent-kit-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasaun%2Fworld-agent-kit-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasaun%2Fworld-agent-kit-template/lists"}