{"_id":"@bruhmarket/agent-sdk","_rev":"2-0f76745b9f41d6d1d5341893af848ed6","name":"@bruhmarket/agent-sdk","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@bruhmarket/agent-sdk","version":"0.1.0","keywords":["ai","agent","prediction-market","forecasting","web3","autonomous-agents","bruh","sdk"],"license":"MIT","_id":"@bruhmarket/agent-sdk@0.1.0","maintainers":[{"name":"bristinwild","email":"bristineth@gmail.com"}],"homepage":"https://github.com/bristinWild/bruh#readme","bugs":{"url":"https://github.com/bristinWild/bruh/issues"},"dist":{"shasum":"b955666de528ed9710cb27ee68b0b5e0ad3058f0","tarball":"https://registry.npmjs.org/@bruhmarket/agent-sdk/-/agent-sdk-0.1.0.tgz","fileCount":181,"integrity":"sha512-+xHdE9NCu188a12uPNkmie+yMWRGhsbXHFTAqKNHWSXqQUSc9HMZRgYakzv03gRdqNjLGpiVsplAxUr42P3crQ==","signatures":[{"sig":"MEQCICJ4Nawp8B1FOimAGzFZB3Rlod7OwxMaRHsN8dVrMNzfAiBYzbdh2uiA0akydkHVsf/RaENXw77gRDPgYPxKXEzEZQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":575369},"main":"./dist/index.js","type":"commonjs","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.js"},"./runtime":{"types":"./dist/runtime.d.ts","import":"./dist/runtime.js","default":"./dist/runtime.js","require":"./dist/runtime.js"}},"gitHead":"48c831d273355e56facefd3edf259fc922064e48","scripts":{"test":"vitest run","build":"tsc --noEmit","clean":"rm -rf dist","prepack":"npm run build:package","test:smoke":"tsx src/test/runtime-smoke.ts","test:watch":"vitest","legacy:start":"tsx src/legacy-runner.ts","build:package":"npm run clean && tsc -p tsconfig.build.json"},"_npmUser":{"name":"bristinwild","email":"bristineth@gmail.com"},"repository":{"url":"git+https://github.com/bristinWild/bruh.git","type":"git","directory":"bruh-agent"},"_npmVersion":"10.9.8","description":"SDK for building custom autonomous forecasting agents for Bruh.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"viem":"^2.0.0","axios":"^1.9.0","dotenv":"^16.0.0","@tavily/core":"^0.7.6","@anthropic-ai/sdk":"^0.39.0","@supabase/supabase-js":"^2.111.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.0.0","vitest":"^4.1.10","ts-node":"^10.9.0","typescript":"^5.0.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/agent-sdk_0.1.0_1785751078202_0.7969691447996861","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@bruhmarket/agent-sdk","version":"0.1.1","description":"SDK for building custom autonomous forecasting agents for Bruh.","type":"commonjs","main":"./dist/index.js","types":"./dist/index.d.ts","license":"MIT","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js","default":"./dist/index.js"},"./runtime":{"types":"./dist/runtime.d.ts","import":"./dist/runtime.js","require":"./dist/runtime.js","default":"./dist/runtime.js"}},"keywords":["ai","agent","prediction-market","forecasting","web3","autonomous-agents","bruh","sdk"],"repository":{"type":"git","url":"git+https://github.com/bristinWild/bruh.git","directory":"bruh-agent"},"sideEffects":false,"publishConfig":{"access":"public"},"scripts":{"clean":"rm -rf dist","build":"tsc --noEmit","build:package":"npm run clean && tsc -p tsconfig.build.json","test":"vitest run","test:watch":"vitest","test:smoke":"tsx src/test/runtime-smoke.ts","test:protocol":"tsx src/test/protocol-smoke.ts","prepack":"npm run build:package","legacy:start":"tsx src/legacy-runner.ts"},"dependencies":{"@anthropic-ai/sdk":"^0.39.0","@supabase/supabase-js":"^2.111.0","@tavily/core":"^0.7.6","axios":"^1.9.0","dotenv":"^16.0.0","viem":"^2.0.0"},"devDependencies":{"@types/node":"^22.0.0","ts-node":"^10.9.0","tsx":"^4.0.0","typescript":"^5.0.0","vitest":"^4.1.10"},"_id":"@bruhmarket/agent-sdk@0.1.1","gitHead":"48c831d273355e56facefd3edf259fc922064e48","bugs":{"url":"https://github.com/bristinWild/bruh/issues"},"homepage":"https://github.com/bristinWild/bruh#readme","_nodeVersion":"22.23.2","_npmVersion":"10.9.8","dist":{"integrity":"sha512-HGOw2WqOiUe6DpASfCRq+vO9KqQhNtTL8iFUGE6I/UcvXQ3s2EdAh4WnyRF5xvaOU7bnq8opHrGjtDZBjTFchA==","shasum":"5bc80e11294c2828098246757718f61ea831ac82","tarball":"https://registry.npmjs.org/@bruhmarket/agent-sdk/-/agent-sdk-0.1.1.tgz","fileCount":193,"unpackedSize":598586,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAiehO/CQV+mjrw5xCxbM534SRPcgQTg69/TskMYFdcVAiEA2XpjaQeFVhW3e6OMDfPpYCPtgKqpDQImqOTC2wihM3Q="}]},"_npmUser":{"name":"bristinwild","email":"bristineth@gmail.com"},"directories":{},"maintainers":[{"name":"bristinwild","email":"bristineth@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agent-sdk_0.1.1_1785755937621_0.15273968418886597"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-03T09:57:58.027Z","modified":"2026-08-03T11:18:57.986Z","0.1.0":"2026-08-03T09:57:58.342Z","0.1.1":"2026-08-03T11:18:57.813Z"},"bugs":{"url":"https://github.com/bristinWild/bruh/issues"},"license":"MIT","homepage":"https://github.com/bristinWild/bruh#readme","keywords":["ai","agent","prediction-market","forecasting","web3","autonomous-agents","bruh","sdk"],"repository":{"type":"git","url":"git+https://github.com/bristinWild/bruh.git","directory":"bruh-agent"},"description":"SDK for building custom autonomous forecasting agents for Bruh.","maintainers":[{"name":"bristinwild","email":"bristineth@gmail.com"}],"readme":"# @bruh/agent-sdk\n\nBuild autonomous AI forecasting agents for the Bruh prediction ecosystem.\n\nThe Bruh Agent SDK enables developers to create portable, typed, and deterministic\nforecasting agents that can research prediction markets, estimate probabilities,\nevaluate risk, and generate execution plans compatible with the Bruh runtime.\n\n> Define your own reasoning. Bruh handles orchestration, execution, scheduling,\n> wallet management, and settlement.\n\n---\n\n## Features\n\n- 🤖 Build custom forecasting agents\n- 🧠 Custom reasoning pipelines\n- 📊 Research + probability estimation\n- 🛡 Built-in risk evaluation\n- 💰 Kelly position sizing\n- 📝 Agent manifest validation\n- 🔌 Pluggable providers\n- 📚 Agent memory lifecycle\n- ⚡ Fully typed TypeScript SDK\n\n---\n\n## Installation\n\n```bash\nnpm install @bruh/agent-sdk\n```\n\n---\n\n## Quick Start\n\n```ts\nimport { defineAgent } from \"@bruh/agent-sdk\";\n\nexport default defineAgent({\n    manifest: {\n        id: \"my-agent\",\n\n        name: \"My Agent\",\n\n        version: \"0.1.0\",\n\n        description: \"Example forecasting agent.\",\n\n        source: \"custom\",\n\n        difficulty: \"developer\",\n\n        author: {\n            name: \"John Doe\",\n        },\n\n        categories: [\n            \"macro\",\n        ],\n\n        capabilities: [\n            \"research\",\n            \"prediction\",\n        ],\n\n        permissions: {\n            canResearch: true,\n            canTrade: false,\n            canPurchaseResearch: false,\n            canAccessHistoricalData: false,\n            canAccessOnchainData: false,\n            canUseExternalApis: false,\n            maximumTradeUsdc: 0,\n        },\n    },\n\n    systemPrompt:\n        \"You are a macro forecasting expert.\",\n\n    defaults: {\n        edgeThreshold: 0.05,\n\n        kellyFraction: 0.15,\n\n        maxPositionUsdc: 10,\n\n        researchBudgetUsdc: 0.02,\n\n        maxResearchSources: 10,\n\n        minimumConfidence: 0.60,\n    },\n\n    async research(context) {\n        return {\n            profileId: \"my-agent\",\n\n            marketId: context.market.id,\n\n            collectedAt:\n                new Date().toISOString(),\n\n            summary:\n                \"Research summary.\",\n\n            evidence: [],\n\n            costUsdc: 0,\n        };\n    },\n\n    async estimate(context) {\n        return {\n            probability: 0.62,\n\n            confidence: 0.71,\n\n            reasoning:\n                \"Example reasoning.\",\n\n            keyFactors: [],\n\n            risks: [],\n\n            recommendedAction:\n                \"BUY_YES\",\n        };\n    },\n});\n```\n\n---\n\n# Architecture\n\n```\n                +--------------------+\n                |   Custom Agent     |\n                +--------------------+\n                           |\n                     defineAgent()\n                           |\n                           ▼\n                +--------------------+\n                | Agent Manifest     |\n                +--------------------+\n                           |\n                           ▼\n              Manifest Validation Layer\n                           |\n                           ▼\n                 Bruh Runtime Engine\n                           |\n       +-------------------+-------------------+\n       |                   |                   |\n   Research          Risk Engine        Position Sizing\n       |                   |                   |\n       +-------------------+-------------------+\n                           |\n                           ▼\n                  Execution Plan Builder\n                           |\n                           ▼\n                Bruh Backend / Scheduler\n                           |\n                           ▼\n                  Prediction Markets\n```\n\n---\n\n# SDK Philosophy\n\nThe SDK only defines **how an agent thinks**.\n\nIt does **not**:\n\n- execute blockchain transactions\n- manage wallets\n- schedule executions\n- discover markets\n- store runs\n- maintain infrastructure\n\nThose responsibilities belong to the Bruh backend.\n\n---\n\n# Agent Lifecycle\n\n```\nMarket\n    │\n    ▼\nResearch()\n    │\n    ▼\nEstimate()\n    │\n    ▼\nRisk Evaluation\n    │\n    ▼\nKelly Position Sizing\n    │\n    ▼\nExecution Plan\n    │\n    ▼\nBruh Runtime\n```\n\n---\n\n# Manifest\n\nEvery agent contains a manifest.\n\n```ts\nmanifest: {\n    id\n    name\n    version\n    description\n    author\n    permissions\n    capabilities\n}\n```\n\nThe manifest identifies the agent and declares its permissions and runtime capabilities.\n\n---\n\n# Permissions\n\n| Permission | Description |\n|------------|-------------|\n| canResearch | May perform research |\n| canTrade | May execute trades |\n| canPurchaseResearch | May purchase external research |\n| canAccessHistoricalData | Historical datasets |\n| canAccessOnchainData | On-chain analytics |\n| canUseExternalApis | External API access |\n| maximumTradeUsdc | Maximum trade size |\n\n---\n\n# Hooks\n\nEvery custom agent implements two primary hooks.\n\n## research()\n\nCollects evidence.\n\nReturns\n\n- summary\n- evidence\n- research cost\n\n---\n\n## estimate()\n\nProduces\n\n- probability\n- confidence\n- reasoning\n- risks\n- key factors\n- recommended action\n\n---\n\n# Runtime\n\nThe runtime is intentionally separated from the public SDK.\n\n```\n@bruh/agent-sdk\n```\n\ncontains only the developer-facing API.\n\n```\n@bruhmarket/agent-sdk/runtime\n```\n\ncontains Bruh runtime utilities used by the backend.\n\n---\n\n# Built-in Profiles\n\nThe SDK ships with reference implementations.\n\n- Newshound\n- Actuary\n- Whale Hunter\n\nUse them as examples when building custom agents.\n\n---\n\n# Provider System\n\nBruh supports pluggable providers.\n\nExamples include\n\n- Anthropic\n- Tavily\n- Supabase\n- Dune\n- x402\n\nDevelopers can replace providers with their own implementations.\n\n---\n\n# Memory\n\nThe SDK includes an optional memory layer.\n\nSupported memories include\n\n- Trade memories\n- Reflection memories\n- Resolution memories\n- Performance summaries\n\nMemory providers are replaceable.\n\n---\n\n# Risk Engine\n\nBefore execution every estimate passes through\n\n- confidence validation\n- edge validation\n- research budget validation\n- execution permission validation\n\nOnly approved decisions become execution plans.\n\n---\n\n# Position Sizing\n\nBruh uses Kelly-based sizing.\n\nInputs include\n\n- estimated probability\n- market probability\n- bankroll\n- Kelly fraction\n\nOutput\n\n- recommended USDC allocation\n\n---\n\n# Execution Plans\n\nThe SDK never executes trades.\n\nIt produces execution plans consumed by the Bruh backend.\n\n```\nResearch\n    ↓\nEstimate\n    ↓\nRisk\n    ↓\nExecution Plan\n```\n\n---\n\n# Examples\n\nSee\n\n```\nexamples/custom-agent.ts\n```\n\n---\n\n# API\n\n## SDK\n\n- defineAgent()\n- validateAgentManifest()\n- normalizeAgentManifest()\n\n## Runtime\n\n- runAgentRuntime()\n- executeAgent()\n\n---\n\n# Compatibility\n\nCurrent SDK Version\n\n```\n0.1.x\n```\n\nRequires\n\n- Node.js 20+\n- TypeScript 5+\n\n---\n\n# Roadmap\n\n- Agent Registry\n- Agent Marketplace\n- CLI scaffolding\n- Agent signing\n- Version compatibility\n- Remote agent execution\n- Hosted research providers\n\n---\n\n# License\n\nMIT","readmeFilename":"README.md"}