@cdr-kit/agent
v0.5.0
Published
Autonomous agent client for Story CDR: discover -> subscribe -> access vaults from its own wallet.
Downloads
559
Readme
@cdr-kit/agent
Autonomous agent client for Story CDR: an agent discovers vaults, subscribes, and accesses the plaintext from its own wallet — the headless counterpart to @cdr-kit/react.
npm install @cdr-kit/agent @cdr-kit/coreimport { CdrAgent } from "@cdr-kit/agent";
const agent = new CdrAgent({ privateKey: process.env.PRIVATE_KEY, apiUrl: process.env.STORY_API_URL });
const vaults = await agent.discover();
const bytes = await agent.subscribeAndAccess({ uuid: vaults[0].uuid, periods: 1n, maxPricePerPeriod: price, value: price });
// or, if already entitled:
const data = await agent.access(uuid);This is the object every framework adapter wraps — see @cdr-kit/tools, @cdr-kit/mcp, and the vercel-ai / openai / langchain / agentkit / goat adapters.
Demos
- Scripted loop (no LLM):
source contracts/.env && pnpm --filter @cdr-kit/agent run demo— a seller vaults a signal; the agent thendiscover()s it, subscribes from its own wallet, decrypts, and makes a decision. Live on Aeneid. - Model-in-the-loop (real LLM):
examples/vercel-ai-chatbot— an LLM is handed the CDR tools and autonomously callscdr_discover_vaults→cdr_subscribe_and_access, then answers from the decrypted data. Run withsource contracts/.env && ANTHROPIC_API_KEY=… pnpm --filter cdr-kit-example-vercel-ai-chatbot start.
The model→tool wiring is covered by a deterministic, key-less test in @cdr-kit/vercel-ai (a scripted mock model drives the real generateText loop).
