项目的 README,来自 github.com/ChatAndBuild/non-fungible-agents-BAP-578。合并为一个 markdown 文件:README.md。

BAP-578 introduces Non-Fungible Agents (NFAs)—programmable, autonomous tokens that act as on-chain "agents" capable of executing tasks, evolving, and interacting with other contracts. This standard merges the uniqueness of NFTs with autonomous functionality, positioning BNB Chain as the home for decentralized automation.
This implementation provides a complete framework for creating, managing, and governing autonomous agent tokens on the BNB Chain with optional learning capabilities that allow agents to evolve and improve over time.
For a comprehensive technical breakdown, read the Whitepaper
BAP-578 now offers two development paths to accommodate different use cases and developer preferences:
Perfect for most developers and immediate deployment:
For advanced developers wanting truly evolving agents:
While traditional NFTs (BEP-721) provide uniqueness and ownership, they lack the standardized interfaces needed for autonomous behavior and cross-platform agent interactions. BAP-578 addresses this gap by defining:
Consistent Agent Interfaces: Standardized methods for action execution, state management, and logic upgrades that enable predictable interactions across platforms.
Interoperability Framework: Common patterns for how agents interact with other contracts, services, and each other, creating an ecosystem where agents from different developers can work together.
Hybrid On-Chain/Off-Chain Architecture: Clear separation between on-chain identity and permissions versus off-chain extended experience and complex behaviors, optimizing for both gas efficiency and rich functionality.
Optional Learning System: Standardized interfaces for agent learning and evolution, allowing developers to choose between simple static agents or sophisticated learning agents.
Security Boundaries: Standardized circuit breaker patterns, permission systems, and access controls that protect users and their assets.
BAP-578 carefully balances which components belong on-chain versus off-chain:
| Component | Storage | Rationale |
|---|---|---|
| Agent Identity | On-chain | Core identity must be immutable and universally accessible |
| Ownership & Permissions | On-chain | Security and access control require consensus verification |
| Basic Metadata | On-chain | Essential for marketplace display and basic interactions |
| Logic Address | On-chain | Determines how the agent behaves when actions are executed |
| Learning Tree Root | On-chain | Cryptographic proof of learning state (32 bytes only) |
| Extended Experience | Off-chain (with hash verification) | Rich experience would be prohibitively expensive on-chain |
| Learning Tree Data | Off-chain (with Merkle verification) | Detailed learning data with cryptographic integrity |
| Complex Behaviors | Off-chain | Advanced AI behaviors require off-chain computation |
| Voice/Animation | Off-chain (with URI reference) | Media assets are too large for on-chain storage |
This hybrid approach ensures that:
Standardization through BAP-578 enables:
Developer Ecosystem: Common interfaces allow developers to build agent-compatible applications without custom integration for each agent implementation.
Marketplace Integration: Platforms can display, trade, and interact with agents using standardized methods, regardless of the agent's specific purpose or learning capabilities.
Cross-Platform Compatibility: Agents can move between applications while maintaining their identity, experience, and learned behaviors.
User Ownership: Clear separation of on-chain and off-chain components ensures users maintain control of their agents' data and behavior.
Innovation Acceleration: Developers can focus on creating unique agent behaviors rather than reinventing infrastructure patterns.
Learning Portability: Agents with learning enabled can carry their knowledge and experience across different platforms and applications.
The BAP-578 standard consists of the following components:
BAP578Enhanced.sol: The enhanced NFA contract that implements the agent token standard with optional learningBAP578.sol: The original NFA contract for backward compatibilityCircuitBreaker.sol: Emergency shutdown mechanism with global and targeted pause capabilitiesAgentFactory.sol: Factory contract for deploying new agent tokens with customizable templatesBAP578Governance.sol: Governance contract for protocol-level decisionsBAP578Treasury.sol: Treasury management for fee collection and distributionExperienceModuleRegistry.sol: Registry for managing external experience modules with cryptographic verificationVaultPermissionManager.sol: Manages secure access to off-chain data vaults with time-based delegationMerkleTreeLearning.sol: Implementation of Merkle tree-based learning with cryptographic verificationIBAP578.sol: Interface defining the core functionality for BAP-578 compliant tokensILearningModule.sol: Interface defining the standard for pluggable learning systemslearning-integration.js: Demonstrates how to use the enhanced BAP700 standard with optional learning capabilities from day 1StrategicAgent.sol: Template for agents to monitor trends, detect mentions, and analyze sentiment across various platformsDeFiAgent.sol: Template for DeFi-focused agents (trading, liquidity provision)GameAgent.sol: Template for gaming-focused agents (NPCs, item management)DAOAgent.sol: Template for DAO-focused agents (voting, proposal execution)CreatorAgent.sol: Template for content creator agents (brand management, content scheduling)MockAgentLogic.sol: Template for basic functionality to validate the agent interaction model without complex business logicDAOAmbassadorAgent.sol: Alternative template for DAO-focused agents with optional learning capabilityLifestyleAgent.sol: Template for travel and personal assistant focused agentsFanCollectibleAgent.sol: Template for agents for anime, game, or fictional characters with AI conversation capabilitiesBAP-578 tokens include an enhanced metadata structure with:
npm install
npm run compile
npm test
# Local development
npm run deploy
# BSC Testnet
npm run deploy:testnet
# BSC Mainnet
npm run deploy:mainnet
# Interactive CLI
npm run interact:testnet
# Automatic verification
npm run verify:testnet
# Manual verification guide
npm run verify:manual:testnet
To streamline adapter design, vault safety checks, deployment sequencing, and test scaffolding, this repository includes a SkillsHub-based Dev Kit guide.
docs/dev-tools/README.mddocs/dev-tools/getting-started-15-minutes.mddocs/dev-tools/security-checklist.mdInstall commands:
npx @skillshub/bap578-adapter-blueprint
npx @skillshub/bap578-vault-checklist
npx @skillshub/bap578-deploy-plan
npx @skillshub/bap578-test-template
npx @skillshub/bap578-contract-idea-sprint
Optional local skeletons included:
contracts/templates/BAP578AdapterBlueprint.soltest/templates/bap578-adapter.template.test.jsstruct AgentMetadata {
string persona; // JSON traits/style
string experience; // Agent's role/expertise
string voiceHash; // Voice identifier
string animationURI; // Animation resource
string vaultURI; // Vault resource
bytes32 vaultHash; // Vault identifier
}
createAgent() - Mint new agent NFT (free for first 3, then 0.01 BNB)fundAgent() - Send BNB to an agentwithdrawFromAgent() - Withdraw BNB from your agentsetAgentStatus() - Activate/deactivate agentsetLogicAddress() - Set agent's logic contractupdateAgentMetadata() - Update agent's metadataCreate a .env file:
DEPLOYER_PRIVATE_KEY=your_private_key_here
TESTNET_RPC_URL=https://data-seed-prebsc-1-s1.binance.org:8545/
MAINNET_RPC_URL=https://bsc-dataseed.binance.org/
BSCSCAN_API_KEY=your_bscscan_api_key_here
| Command | Description |
|---|---|
npm test |
Run test suite |
npm run compile |
Compile contracts |
npm run deploy |
Deploy to local network |
npm run deploy:testnet |
Deploy to BSC testnet |
npm run deploy:mainnet |
Deploy to BSC mainnet |
npm run interact |
Interactive CLI |
npm run verify:testnet |
Verify on testnet BSCScan |
npm run clean |
Clean artifacts |
npm run coverage |
Generate test coverage |
MIT