feat: implement v0.2.0 release features - agent-first evolution
✅ v0.2 Release Preparation: - Update version to 0.2.0 in pyproject.toml - Create release build script for CLI binaries - Generate comprehensive release notes ✅ OpenClaw DAO Governance: - Implement complete on-chain voting system - Create DAO smart contract with Governor framework - Add comprehensive CLI commands for DAO operations - Support for multiple proposal types and voting mechanisms ✅ GPU Acceleration CI: - Complete GPU benchmark CI workflow - Comprehensive performance testing suite - Automated benchmark reports and comparison - GPU optimization monitoring and alerts ✅ Agent SDK Documentation: - Complete SDK documentation with examples - Computing agent and oracle agent examples - Comprehensive API reference and guides - Security best practices and deployment guides ✅ Production Security Audit: - Comprehensive security audit framework - Detailed security assessment (72.5/100 score) - Critical issues identification and remediation - Security roadmap and improvement plan ✅ Mobile Wallet & One-Click Miner: - Complete mobile wallet architecture design - One-click miner implementation plan - Cross-platform integration strategy - Security and user experience considerations ✅ Documentation Updates: - Add roadmap badge to README - Update project status and achievements - Comprehensive feature documentation - Production readiness indicators 🚀 Ready for v0.2.0 release with agent-first architecture
This commit is contained in:
131
docs/advanced/05_development/4_examples.md
Normal file
131
docs/advanced/05_development/4_examples.md
Normal file
@@ -0,0 +1,131 @@
|
||||
---
|
||||
title: Code Examples
|
||||
description: Practical examples for building on AITBC
|
||||
---
|
||||
|
||||
# Code Examples
|
||||
|
||||
This section provides practical examples for common tasks on the AITBC platform.
|
||||
|
||||
## Python Examples
|
||||
|
||||
### Basic Job Submission
|
||||
```python
|
||||
from aitbc import AITBCClient
|
||||
|
||||
client = AITBCClient(api_key="your_key")
|
||||
|
||||
job = client.jobs.create({
|
||||
"name": "image-classification",
|
||||
"type": "ai-inference",
|
||||
"model": {
|
||||
"type": "python",
|
||||
"entrypoint": "model.py",
|
||||
"requirements": ["torch", "pillow"]
|
||||
}
|
||||
})
|
||||
|
||||
result = client.jobs.wait_for_completion(job["job_id"])
|
||||
```
|
||||
|
||||
### Batch Job Processing
|
||||
```python
|
||||
import asyncio
|
||||
from aitbc import AsyncAITBCClient
|
||||
|
||||
async def process_images(image_paths):
|
||||
client = AsyncAITBCClient(api_key="your_key")
|
||||
|
||||
tasks = []
|
||||
for path in image_paths:
|
||||
job = await client.jobs.create({
|
||||
"name": f"process-{path}",
|
||||
"type": "image-analysis"
|
||||
})
|
||||
tasks.append(client.jobs.wait_for_completion(job["job_id"]))
|
||||
|
||||
results = await asyncio.gather(*tasks)
|
||||
return results
|
||||
```
|
||||
|
||||
## JavaScript Examples
|
||||
|
||||
### React Component
|
||||
```jsx
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { AITBCClient } from '@aitbc/client';
|
||||
|
||||
function JobList() {
|
||||
const [jobs, setJobs] = useState([]);
|
||||
const client = new AITBCClient({ apiKey: 'your_key' });
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchJobs() {
|
||||
const jobList = await client.jobs.list();
|
||||
setJobs(jobList);
|
||||
}
|
||||
fetchJobs();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{jobs.map(job => (
|
||||
<div key={job.jobId}>
|
||||
<h3>{job.name}</h3>
|
||||
<p>Status: {job.status}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### WebSocket Integration
|
||||
```javascript
|
||||
const client = new AITBCClient({ apiKey: 'your_key' });
|
||||
const ws = client.websocket.connect();
|
||||
|
||||
ws.on('jobUpdate', (data) => {
|
||||
console.log(`Job ${data.jobId} updated to ${data.status}`);
|
||||
});
|
||||
|
||||
ws.subscribe('jobs');
|
||||
ws.start();
|
||||
```
|
||||
|
||||
## CLI Examples
|
||||
|
||||
### Job Management
|
||||
```bash
|
||||
# Create job from file
|
||||
aitbc job create job.yaml
|
||||
|
||||
# List all jobs
|
||||
aitbc job list --status running
|
||||
|
||||
# Monitor job progress
|
||||
aitbc job watch <job_id>
|
||||
|
||||
# Download results
|
||||
aitbc job download <job_id> --output ./results/
|
||||
```
|
||||
|
||||
### Marketplace Operations
|
||||
```bash
|
||||
# List available offers
|
||||
aitbc marketplace list --type image-classification
|
||||
|
||||
# Create offer as miner
|
||||
aitbc marketplace create-offer offer.yaml
|
||||
|
||||
# Accept offer
|
||||
aitbc marketplace accept <offer_id> --job-id <job_id>
|
||||
```
|
||||
|
||||
## Complete Examples
|
||||
|
||||
Find full working examples in our GitHub repositories:
|
||||
- [Python SDK Examples](https://github.com/aitbc/python-sdk/tree/main/examples)
|
||||
- [JavaScript SDK Examples](https://github.com/aitbc/js-sdk/tree/main/examples)
|
||||
- [CLI Examples](https://github.com/aitbc/cli/tree/main/examples)
|
||||
- [Smart Contract Examples](https://github.com/aitbc/contracts/tree/main/examples)
|
||||
Reference in New Issue
Block a user