near-ai

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

NEAR AI Development

NEAR AI开发

Comprehensive guide for building AI agents and AI-powered applications on NEAR Protocol, including NEAR AI integration, agent workflows, and AI model deployment.
这是一份在NEAR Protocol上构建AI Agent和AI驱动应用的综合指南,涵盖NEAR AI集成、Agent工作流以及AI模型部署等内容。

When to Apply

适用场景

Reference these guidelines when:
  • Building AI agents on NEAR
  • Integrating AI models with NEAR smart contracts
  • Creating agent-based workflows
  • Implementing AI-powered dApps
  • Using NEAR AI infrastructure
  • Building with NEAR AI Assistant
在以下场景中可参考本指南:
  • 在NEAR上构建AI Agent
  • 将AI模型与NEAR智能合约集成
  • 创建基于Agent的工作流
  • 实现AI驱动的dApp
  • 使用NEAR AI基础设施
  • 基于NEAR AI Assistant进行开发

Rule Categories by Priority

按优先级划分的规则类别

PriorityCategoryImpactPrefix
1Agent ArchitectureCRITICAL
arch-
2AI IntegrationHIGH
ai-
3Agent CommunicationHIGH
comm-
4Model DeploymentMEDIUM-HIGH
model-
5Agent WorkflowsMEDIUM
workflow-
6Security & PrivacyMEDIUM
security-
7Best PracticesMEDIUM
best-
优先级类别影响程度前缀
1Agent架构关键
arch-
2AI集成
ai-
3Agent通信
comm-
4模型部署中高
model-
5Agent工作流
workflow-
6安全与隐私
security-
7最佳实践
best-

Quick Reference

快速参考

1. Agent Architecture (CRITICAL)

1. Agent架构(关键)

  • arch-agent-structure
    - Design modular agent architecture
  • arch-state-management
    - Manage agent state on-chain vs off-chain
  • arch-agent-registry
    - Register agents in NEAR AI registry
  • arch-composability
    - Build composable agents
  • arch-agent-capabilities
    - Define clear agent capabilities
  • arch-agent-structure
    - 设计模块化Agent架构
  • arch-state-management
    - 管理Agent的链上与链下状态
  • arch-agent-registry
    - 在NEAR AI注册表中注册Agent
  • arch-composability
    - 构建可组合的Agent
  • arch-agent-capabilities
    - 定义清晰的Agent能力

2. AI Integration (HIGH)

2. AI集成(高)

  • ai-model-selection
    - Choose appropriate AI models
  • ai-inference-endpoints
    - Use NEAR AI inference endpoints
  • ai-prompt-engineering
    - Design effective prompts for agents
  • ai-context-management
    - Manage conversation context
  • ai-response-validation
    - Validate and sanitize AI responses
  • ai-model-selection
    - 选择合适的AI模型
  • ai-inference-endpoints
    - 使用NEAR AI推理端点
  • ai-prompt-engineering
    - 为Agent设计有效的提示词
  • ai-context-management
    - 管理对话上下文
  • ai-response-validation
    - 验证并清理AI响应

3. Agent Communication (HIGH)

3. Agent通信(高)

  • comm-agent-protocol
    - Implement standard agent communication protocols
  • comm-message-format
    - Use structured message formats
  • comm-async-messaging
    - Handle asynchronous agent communication
  • comm-multi-agent
    - Coordinate multiple agents
  • comm-human-in-loop
    - Implement human-in-the-loop patterns
  • comm-agent-protocol
    - 实现标准的Agent通信协议
  • comm-message-format
    - 使用结构化消息格式
  • comm-async-messaging
    - 处理Agent异步通信
  • comm-multi-agent
    - 协调多个Agent
  • comm-human-in-loop
    - 实现人在回路模式

4. Model Deployment (MEDIUM-HIGH)

4. 模型部署(中高)

  • model-hosting
    - Deploy models on NEAR AI infrastructure
  • model-versioning
    - Version and update AI models
  • model-optimization
    - Optimize models for inference
  • model-monitoring
    - Monitor model performance
  • model-fallbacks
    - Implement fallback strategies
  • model-hosting
    - 在NEAR AI基础设施上部署模型
  • model-versioning
    - 对AI模型进行版本管理与更新
  • model-optimization
    - 优化模型以提升推理性能
  • model-monitoring
    - 监控模型性能
  • model-fallbacks
    - 实现降级策略

5. Agent Workflows (MEDIUM)

5. Agent工作流(中)

  • workflow-task-planning
    - Implement agent task planning
  • workflow-execution
    - Execute multi-step workflows
  • workflow-error-handling
    - Handle workflow errors gracefully
  • workflow-state-persistence
    - Persist workflow state
  • workflow-composability
    - Compose workflows from smaller tasks
  • workflow-task-planning
    - 实现Agent任务规划
  • workflow-execution
    - 执行多步骤工作流
  • workflow-error-handling
    - 优雅处理工作流错误
  • workflow-state-persistence
    - 持久化工作流状态
  • workflow-composability
    - 基于小型任务组合工作流

6. Security & Privacy (MEDIUM)

6. 安全与隐私(中)

  • security-input-validation
    - Validate user inputs to agents
  • security-output-sanitization
    - Sanitize agent outputs
  • security-access-control
    - Implement agent access control
  • security-data-privacy
    - Protect user data privacy
  • security-prompt-injection
    - Prevent prompt injection attacks
  • security-input-validation
    - 验证Agent的用户输入
  • security-output-sanitization
    - 清理Agent输出内容
  • security-access-control
    - 实现Agent访问控制
  • security-data-privacy
    - 保护用户数据隐私
  • security-prompt-injection
    - 防范提示词注入攻击

7. Best Practices (MEDIUM)

7. 最佳实践(中)

  • best-error-messages
    - Provide clear error messages
  • best-logging
    - Log agent interactions for debugging
  • best-testing
    - Test agent behavior comprehensively
  • best-documentation
    - Document agent capabilities and APIs
  • best-user-feedback
    - Collect and incorporate user feedback
  • best-error-messages
    - 提供清晰的错误提示信息
  • best-logging
    - 记录Agent交互信息用于调试
  • best-testing
    - 全面测试Agent行为
  • best-documentation
    - 记录Agent能力与API
  • best-user-feedback
    - 收集并整合用户反馈

How to Use

使用方法

Read individual rule files for detailed explanations and code examples:
rules/arch-agent-structure.md
rules/ai-inference-endpoints.md
Each rule file contains:
  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and NEAR AI-specific patterns
阅读单个规则文件以获取详细说明和代码示例:
rules/arch-agent-structure.md
rules/ai-inference-endpoints.md
每个规则文件包含:
  • 简要说明该规则的重要性
  • 错误代码示例及解释
  • 正确代码示例及解释
  • 额外背景信息与NEAR AI特定模式

NEAR AI Components

NEAR AI组件

NEAR AI Hub

NEAR AI Hub

Central registry for AI agents, models, and datasets on NEAR.
NEAR上AI Agent、模型和数据集的中央注册表。

NEAR AI Assistant

NEAR AI Assistant

Infrastructure for building conversational AI agents.
用于构建对话式AI Agent的基础设施。

Agent Registry

Agent注册表

On-chain registry for discovering and interacting with agents.
用于发现和与Agent交互的链上注册表。

Inference Endpoints

推理端点

Decentralized inference infrastructure for AI models.
为AI模型提供的去中心化推理基础设施。

Resources

相关资源

Full Compiled Document

完整编译文档

For the complete guide with all rules expanded:
AGENTS.md
如需包含所有扩展规则的完整指南,请查看:
AGENTS.md