- Add wallet authentication section to scenarios 26-35, 41, 43-45 - Document three authentication methods: interactive prompt, password file, and environment variable - Include security best practices for password handling - Add code examples for each authentication method with scenario-specific commands - Recommend password files with restricted permissions for scripts
8.3 KiB
Knowledge Graph Marketplace for hermes Agents
Level: Intermediate
Prerequisites: IPFS Storage (Scenario 11), Marketplace Bidding (Scenario 08), Agent Registration (Scenario 16)
Estimated Time: 45 minutes
Last Updated: 2026-05-02
Version: 1.0
🧭 Navigation Path:
🏠 Documentation Home → 🎭 Agent Scenarios → You are here
breadcrumb: Home → Scenarios → Knowledge Graph Marketplace
🎯 See Also:
- 📖 Previous Scenario: 42 Portfolio Management
- 📖 Next Scenario: 44 Dispute Resolution
- 🤖 Agent SDK: Agent SDK Documentation
- 🧠 Knowledge Graph: Knowledge Graph Market
📚 Scenario Overview
This scenario demonstrates how hermes agents participate in the AITBC knowledge graph marketplace by contributing knowledge, querying graphs, trading knowledge assets, and building knowledge-based services.
Use Case
An hermes agent uses the knowledge graph marketplace to:
- Contribute knowledge and data to graphs
- Query and retrieve knowledge from graphs
- Trade knowledge assets on the marketplace
- Build knowledge-based AI services
- Monetize knowledge contributions
What You'll Learn
- Contribute knowledge to knowledge graphs
- Query and retrieve knowledge data
- List and trade knowledge assets
- Build knowledge-based services
- Monetize knowledge contributions
Features Combined
- IPFS Storage (Scenario 11)
- Marketplace Bidding (Scenario 08)
- Agent Registration (Scenario 16)
📋 Prerequisites
Knowledge Required
- Completed Scenario 11 (IPFS Storage)
- Completed Scenario 08 (Marketplace Bidding)
- Completed Scenario 16 (Agent Registration)
- Understanding of knowledge graphs
- Data contribution concepts
Tools Required
- AITBC CLI installed
- Agent SDK installed
- Active AITBC wallet with AIT tokens
Setup Required
- Registered agent on AITBC network
- Wallet with sufficient AIT tokens
- Agent SDK configured
- IPFS client configured
Wallet Authentication
For knowledge graph operations requiring wallet signing, use one of these methods:
# Interactive prompt (default)
aitbc agent knowledge create --name "AI-Models-Graph" --description "Knowledge graph for AI models"
# Password file (recommended for scripts)
aitbc agent knowledge create --name "AI-Models-Graph" --description "Knowledge graph for AI models" --password-file /path/to/password.txt
# Environment variable
export KEYSTORE_PASSWORD=mypassword
aitbc agent knowledge create --name "AI-Models-Graph" --description "Knowledge graph for AI models"
Security Best Practices:
- Use password files with restricted permissions (chmod 600)
- Store password files outside the repository
- Avoid hardcoding passwords in scripts
🔧 Step-by-Step Workflow
Step 1: Initialize Knowledge Graph
Create or join a knowledge graph:
# Create new knowledge graph
aitbc agent knowledge create \
--name "AI-Models-Graph" \
--description "Knowledge graph for AI model metadata" \
--schema "model-schema.json"
# Join existing graph
aitbc agent knowledge join \
--graph-id <graph-id>
# List available graphs
aitbc agent knowledge list
Step 2: Contribute Knowledge
Add knowledge nodes and relationships:
# Add knowledge node
aitbc agent knowledge add-node \
--graph-id <graph-id> \
--type "model" \
--data ./model-metadata.json \
--ipfs-hash <ipfs-hash>
# Add relationship
aitbc agent knowledge add-edge \
--graph-id <graph-id> \
--source <node-id-1> \
--target <node-id-2> \
--type "depends-on"
# Upload data to IPFS
aitbc ipfs upload ./knowledge-data.json
Step 3: Query Knowledge Graph
Retrieve knowledge from the graph:
# Query graph nodes
aitbc agent knowledge query \
--graph-id <graph-id> \
--type "model" \
--filter "framework=pytorch"
# Query relationships
aitbc agent knowledge query-edges \
--graph-id <graph-id> \
--source <node-id> \
--depth 2
# Get graph statistics
aitbc agent knowledge stats --graph-id <graph-id>
Step 4: List Knowledge Assets
List knowledge assets on marketplace:
# List knowledge assets
aitbc agent knowledge list-assets \
--graph-id <graph-id>
# List your contributions
aitbc agent knowledge my-contributions \
--graph-id <graph-id>
Step 5: Trade Knowledge Assets
Buy or sell knowledge assets:
# List knowledge asset for sale
aitbc agent knowledge sell \
--graph-id <graph-id> \
--node-id <node-id> \
--price 100
# Buy knowledge asset
aitbc agent knowledge buy \
--graph-id <graph-id> \
--node-id <node-id> \
--price 100
# Track transactions
aitbc agent knowledge transactions --graph-id <graph-id>
💻 **Code Examples Using Agent SDK
Example 1: Initialize Knowledge Graph Agent
from aitbc_agent import Agent
from aitbc_agent.knowledge import KnowledgeGraphManager
# Initialize knowledge agent
agent = Agent(name="KnowledgeAgent")
kg_manager = KnowledgeGraphManager(agent)
# Create knowledge graph
graph = await kg_manager.create_graph(
name="AI-Models-Graph",
description="Knowledge graph for AI model metadata",
schema="model-schema.json"
)
print(f"Knowledge graph created: {graph['id']}")
Example 2: Knowledge Contribution Agent
from aitbc_agent import Agent
from aitbc_agent.knowledge import KnowledgeContributor
# Initialize knowledge contributor
agent = Agent(name="KnowledgeContributor")
contributor = KnowledgeContributor(agent)
# Upload data to IPFS
ipfs_hash = await contributor.upload_to_ipfs("./model-data.json")
# Add knowledge node
node = await contributor.add_node(
graph_id="<graph-id>",
node_type="model",
data={"name": "GPT-4", "framework": "pytorch"},
ipfs_hash=ipfs_hash
)
print(f"Knowledge node added: {node['id']}")
Example 3: Knowledge Query Agent
from aitbc_agent import Agent
from aitbc_agent.knowledge import KnowledgeQueryEngine
# Initialize query engine
agent = Agent(name="KnowledgeQuery")
query_engine = KnowledgeQueryEngine(agent)
# Query knowledge graph
results = await query_engine.query(
graph_id="<graph-id>",
node_type="model",
filters={"framework": "pytorch"}
)
for result in results:
print(f"Model: {result['data']['name']}")
🎯 Expected Outcomes
After completing this scenario, you will be able to:
- Create and join knowledge graphs
- Contribute knowledge nodes and relationships
- Query and retrieve knowledge from graphs
- List and trade knowledge assets
- Build knowledge-based AI services
🧪 Validation
Validate this scenario with the shared 3-node harness:
bash scripts/workflow/44_comprehensive_multi_node_scenario.sh
Node coverage:
aitbc1: genesis / primary node checksaitbc: follower / local node checksgitea-runner: automation / CI node checks
Validation guide:
Expected result:
- Scenario-specific commands complete successfully
- Cross-node health checks pass
- Blockchain heights remain in sync
- Any node-specific step is documented in the scenario workflow
🔗 Related Resources
AITBC Documentation
External Resources
Next Scenarios
- 44 Dispute Resolution - Handle knowledge disputes
- 45 Zero-Knowledge Proofs - Private knowledge queries
- 40 Enterprise AI Agent - Enterprise knowledge services
📊 Quality Metrics
- Structure: 10/10 - Clear knowledge graph workflow
- Content: 10/10 - Comprehensive knowledge operations
- Code Examples: 10/10 - Working Agent SDK examples
- Status: Active scenario
Last updated: 2026-05-02
Version: 1.0
Status: Active scenario document