near-ai
NEAR AI Development
Comprehensive guide for building AI agents and AI-powered applications on NEAR Protocol, including NEAR AI integration, agent workflows, and AI model deployment.
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
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Agent Architecture | CRITICAL | arch- |
| 2 | AI Integration | HIGH | ai- |
| 3 | Agent Communication | HIGH | comm- |
| 4 | Model Deployment | MEDIUM-HIGH | model- |
| 5 | Agent Workflows | MEDIUM | workflow- |
| 6 | Security & Privacy | MEDIUM | security- |
| 7 | Best Practices | MEDIUM | best- |
Quick Reference
1. Agent Architecture (CRITICAL)
arch-agent-structure- Design modular agent architecturearch-state-management- Manage agent state on-chain vs off-chainarch-agent-registry- Register agents in NEAR AI registryarch-composability- Build composable agentsarch-agent-capabilities- Define clear agent capabilities
2. AI Integration (HIGH)
ai-model-selection- Choose appropriate AI modelsai-inference-endpoints- Use NEAR AI inference endpointsai-prompt-engineering- Design effective prompts for agentsai-context-management- Manage conversation contextai-response-validation- Validate and sanitize AI responses
3. Agent Communication (HIGH)
comm-agent-protocol- Implement standard agent communication protocolscomm-message-format- Use structured message formatscomm-async-messaging- Handle asynchronous agent communicationcomm-multi-agent- Coordinate multiple agentscomm-human-in-loop- Implement human-in-the-loop patterns
4. Model Deployment (MEDIUM-HIGH)
model-hosting- Deploy models on NEAR AI infrastructuremodel-versioning- Version and update AI modelsmodel-optimization- Optimize models for inferencemodel-monitoring- Monitor model performancemodel-fallbacks- Implement fallback strategies
5. Agent Workflows (MEDIUM)
workflow-task-planning- Implement agent task planningworkflow-execution- Execute multi-step workflowsworkflow-error-handling- Handle workflow errors gracefullyworkflow-state-persistence- Persist workflow stateworkflow-composability- Compose workflows from smaller tasks
6. Security & Privacy (MEDIUM)
security-input-validation- Validate user inputs to agentssecurity-output-sanitization- Sanitize agent outputssecurity-access-control- Implement agent access controlsecurity-data-privacy- Protect user data privacysecurity-prompt-injection- Prevent prompt injection attacks
7. Best Practices (MEDIUM)
best-error-messages- Provide clear error messagesbest-logging- Log agent interactions for debuggingbest-testing- Test agent behavior comprehensivelybest-documentation- Document agent capabilities and APIsbest-user-feedback- Collect and incorporate 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
NEAR AI Components
NEAR AI Hub
Central registry for AI agents, models, and datasets on NEAR.
NEAR AI Assistant
Infrastructure for building conversational AI agents.
Agent Registry
On-chain registry for discovering and interacting with agents.
Inference Endpoints
Decentralized inference infrastructure for AI models.
Resources
- NEAR AI Documentation: https://docs.near.ai/
- NEAR AI Hub: https://app.near.ai/
- NEAR AI GitHub: https://github.com/near/nearai
- Agent Examples: https://github.com/near/nearai/tree/main/examples
- NEAR AI Research: https://near.ai/research
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
More from near/agent-skills
near-intents
Cross-chain token swap integration using NEAR Intents 1Click API. Use when building swap widgets, bridge interfaces, or multi-chain transfers across EVM, Solana, NEAR, TON, Stellar, and Tron.
69near-api-js
>-
48near-smart-contracts
NEAR Protocol smart contract development in Rust. Use when writing, reviewing, or deploying NEAR smart contracts. Covers contract structure, state management, cross-contract calls, testing, security, and optimization patterns. Based on near-sdk v5.x with modern macro syntax.
42near-kit
TypeScript library for NEAR Protocol blockchain interaction. Use this skill when writing code that interacts with NEAR Protocol, including viewing contract data, calling contract methods, sending NEAR tokens, building transactions, creating type-safe contract wrappers, integrating wallets (Wallet Selector, HOT Connect), React hooks and providers (@near-kit/react), managing keys, testing with sandbox, meta-transactions (NEP-366), and message signing (NEP-413).
35near-ai-cloud
NEAR AI Cloud private inference and verification. Use when integrating NEAR AI Cloud API for verifiable private AI inference, verifying model or gateway TEE attestation (NVIDIA NRAS, Intel TDX), verifying chat message signatures, implementing end-to-end encrypted chat, or using the OpenAI-compatible API with NEAR AI Cloud.
26near-contract-audit
Comprehensive security audit skill for NEAR Protocol smart contracts written in Rust. Use when auditing NEAR contracts, reviewing security vulnerabilities, or analyzing contract code for issues like reentrancy, unhandled promises, unsafe math, access control flaws, and callback security.
24