@agentfabric/sdk
v1.0.1
Published
Agent Fabric SDK - Decentralized cloud for AI agents
Maintainers
Readme
🚀 Agent Fabric SDK (@agentfabric/sdk)
The Unstoppable Infrastructure for AI Agents. Give your autonomous AI agent a permanent brain on Filecoin/IPFS with just 3 lines of code.
🧠 What is this?
AI agents suffer from amnesia. When a server reboots, their local state is wiped. Centralized databases (like AWS S3) introduce trust boundaries and massive Web2 overhead.
Agent Fabric is a decentralized, pay-per-request infrastructure layer. We allow AI agents to cryptographically pin their JSON state directly to the Filecoin network via Lighthouse. They pay for this compute natively using EVM micro-transactions on Base Sepolia.
⚡ Hackathon Quickstart Guide
1. Install the SDK
npm install @agentfabric/sdk ethers2. Fund Your Agent (The Paymaster)
Agent Fabric runs on the x402 Protocol. To use the API, your agent's wallet must hold at least 0.0001 ETH on the AgentPaymaster smart contract deployed on Base Sepolia.
Contract Address (Base Sepolia):
0x64a968FF205eb8DAC54Cc6A860704d8F263D7519
(You can deposit funds via our Frontend Dashboard at https://agentfabric.netlify.app)
3. Initialize Your Agent's Brain
Drop this into your Node.js bot:
import { AgentFabric } from '@agentfabric/sdk';
// 1. Give the agent its private key.
// The SDK automatically handles the cryptographic EVM signatures required for x402 authentication.
const agent = new AgentFabric({
privateKey: process.env.AGENT_PRIVATE_KEY
});
async function main() {
console.log("Saving state to Filecoin...");
// 2. Pass any JSON object you want the agent to remember forever.
const result = await agent.storeMemory({
current_mission: "DeFi Arbitrage",
trades_executed: 42,
profit_usd: 1400.50
});
console.log(`✅ Success! Memory pinned to Filecoin.`);
console.log(`🔗 Verifiable IPFS URL: ${result.lighthouseUrl}`);
}
main();🛠️ API Reference
new AgentFabric(config: AgentFabricConfig)
Creates a new instance of the SDK.
privateKey(string, required): The hex private key of the agent's EVM wallet.apiUrl(string, optional): Overrides the default Agent Fabric gateway.
agent.storeMemory(state: Record<string, any>)
Cryptographically signs the state payload, validates the agent's Base Sepolia balance, and pins the JSON to Filecoin.
Returns:
{
success: boolean;
message: string;
cid: string; // The IPFS/Filecoin Content Identifier
lighthouseUrl: string;// Public gateway link to view the data
agentId: string; // The recovered EVM public address
cost: string; // The micro-transaction cost deducted
timestamp: string;
}Built with ❤️ for the Agentic Economy.
