Skip to content

Blessedbiello/agent-challenge_v1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

56 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nosana Builders Challenge: Agent-101 Solution

Agent Ecosystem

Overview

This is my submission for the Nosana Builders Challenge: Agent-101. I've built an advanced AI agent ecosystem using the Mastra framework, featuring two specialized agents that demonstrate sophisticated automation capabilities: a Deploy Manager Agent for DevOps automation and a Blockchain Monitor Agent for comprehensive blockchain analytics. The solution showcases agent composition, meta-deployment capabilities, and real-world automation use cases.

Challenge Submission Details

Live Demo: https://2KYQRoo4v8UMBvfPvuNpD5fviEiAmFomvK9QUrVW7xJs.node.k8s.prd.nos.ci

Video Demo: https://www.loom.com/share/4768bd5791144d4d95f59f8b9965d9f3

Docker Image: docker.io/bprime/agent-challenge:latest

Repository: This repository contains the complete solution implementation

Challenge Solution: Implemented Agents

πŸš€ Deploy Manager Agent

A comprehensive DevOps automation agent that demonstrates advanced deployment capabilities within the Mastra framework. This agent showcases meta-deployment functionality, allowing it to discover, analyze, and deploy other agents while providing cost optimization and monitoring capabilities.

Key Features:

  • Agent Discovery & Meta-Deployment: Discovers available Mastra agents and enables deployment of agents by name
  • Real Infrastructure Automation: Actually builds Docker images and deploys to Nosana network
  • Live Deployment Execution: Real docker build and nosana job post commands with live monitoring
  • Cost Intelligence: Analyzes GPU market pricing (RTX 3090, 4090, A6000, A100) with cost optimization
  • Real-time Operations: Live job status tracking and actual cost monitoring
  • Production Monitoring: Real health checks on deployed agents with performance metrics

Implementation Tools:

  • agentDiscoveryTool: Discovers and analyzes available Mastra agents with deployment specifications
  • dockerfileGeneratorTool: Generates optimized Dockerfiles with security best practices
  • dockerBuildTool: Executes real docker build and docker push commands with registry authentication
  • nosanaJobCreatorTool: Creates Nosana job definitions with optimal GPU market selection
  • deploymentExecutorTool: Real Nosana CLI integration with npx @nosana/cli job post execution
  • monitoringTool: Live job monitoring using nosana job get with real-time status updates
  • costAnalyzerTool: Real cost tracking based on actual elapsed time and GPU market rates
  • troubleshooterTool: Diagnoses and resolves deployment issues with actionable solutions

Demonstration Use Cases:

  • Real Agent Deployment: Actually deploy any Mastra agent to Nosana network with live URLs
  • Live Cost Analysis: Real-time cost tracking across different GPU markets with actual pricing
  • Production Infrastructure: Generate and execute Docker builds and Nosana deployments
  • Live Monitoring: Real-time job monitoring with health checks and performance metrics

πŸ“Š Blockchain Monitor Agent

A specialized blockchain analytics agent built for the challenge that demonstrates comprehensive monitoring capabilities across multiple networks and DeFi protocols. This agent showcases advanced workflow orchestration and real-time blockchain intelligence gathering.

Key Features:

  • Real-time Price Monitoring: Live CoinGecko API integration for actual cryptocurrency prices
  • Transaction Analysis: Monitor wallet addresses and detect activity patterns
  • DeFi Protocol Monitoring: Track liquidity pools, yield farming, and protocol health
  • Risk Assessment: Evaluate investment risks and provide market insights
  • Workflow Orchestration: Advanced multi-step monitoring workflows

Implementation Tools:

  • priceMonitorTool: Real CoinGecko API calls for live cryptocurrency price data
  • transactionMonitorTool: Wallet address monitoring and transaction analysis
  • defiMonitorTool: DeFi protocol monitoring and yield analysis

Demonstration Use Cases:

  • Portfolio Monitoring: Track cryptocurrency investments with automated alerts
  • Market Analysis: Analyze market movements and identify opportunities
  • DeFi Tracking: Monitor DeFi protocols and yield farming opportunities
  • Risk Assessment: Evaluate investment risks and protocol health
  • Compliance Monitoring: Track transactions for regulatory compliance

πŸ”„ Challenge Solution: Agent Integration

This solution demonstrates advanced agent integration capabilities where agents can work together to provide comprehensive automation:

Meta-Deployment Capabilities:

  • Deploy Manager can discover and deploy the Blockchain Monitor Agent
  • Automated configuration and optimization for blockchain monitoring deployments
  • Cost analysis for running blockchain monitoring infrastructure
  • Real-time monitoring of deployed blockchain monitoring services

Agent Orchestration:

  • Seamless integration between deployment automation and blockchain monitoring
  • Agents can be deployed independently or work together in workflows
  • Demonstrates composable agent architecture principles
  • Showcases real-world automation scenarios

Technical Implementation

Architecture Overview

  • Framework: Built with Mastra framework for TypeScript-based AI applications
  • Agent System: Modular agent architecture with specialized tools
  • Workflow Engine: Multi-step orchestration for complex operations
  • Tool Integration: Custom tools with Zod schema validation
  • Deployment: Real deployment on Nosana GPU network with live monitoring
  • Production Ready: Full CI/CD integration with real Docker builds and job submission

Blockchain Monitor Workflow

The Blockchain Monitor Agent includes a sophisticated workflow (blockchain-monitor-workflow.ts) that orchestrates multiple monitoring operations:

  1. Market Analysis: Analyzes current market conditions and price movements
  2. Transaction Monitoring: Monitors wallet addresses for activity patterns
  3. DeFi Analysis: Evaluates yield opportunities and protocol health
  4. Report Generation: Creates comprehensive monitoring reports with alerts

Workflow Triggers:

  • portfolio: Monitor cryptocurrency portfolios
  • defi: Analyze DeFi protocols and opportunities
  • whale-watching: Monitor large wallet addresses
  • market-analysis: Comprehensive market analysis

Deploy Manager Integration

The Deploy Manager Agent demonstrates advanced meta-deployment capabilities:

// Example deployment flow
1. User: "Deploy the blockchain monitor agent"
2. Deploy Manager:
   - Discovers agent requirements and specifications
   - Analyzes cost implications across GPU markets
   - Generates agent-specific optimized Dockerfile
   - Creates Nosana job definition with appropriate GPU selection
   - Builds and pushes Docker image to registry
   - Deploys to Nosana network with monitoring setup
   - Provides service URL for accessing the deployed agent

Running the Solution

Local Development

# Install dependencies
pnpm install

# Start development server
pnpm run dev

# Visit http://localhost:8080

Real Deployment Setup

Prerequisites

  1. Install Nosana CLI:

    npm install -g @nosana/cli
  2. Setup Nosana Wallet:

    # Generate new wallet
    npx @nosana/cli wallet new
    
    # Fund wallet with SOL and NOS tokens
    npx @nosana/cli wallet balance
  3. Configure Environment:

    # Copy example configuration
    cp .env.nosana.example .env
    
    # Update with your settings:
    # NOSANA_WALLET_PATH=~/.nosana/nosana_key.json
    # DOCKER_USERNAME=yourdockerhubusername
    # DOCKER_TOKEN=your_docker_access_token

Real Deployment Commands

# Build and deploy using the Deploy Manager Agent
pnpm run dev
# Then interact with the Deploy Manager Agent to:
# 1. Build Docker images with real `docker build`
# 2. Deploy to Nosana network with real `nosana job post`
# 3. Monitor live deployments with real job tracking

# Or deploy manually:
pnpm run deploy:manager  # Uses real Nosana CLI

Docker Deployment

# Build container (can be automated by Deploy Manager Agent)
docker build -t yourusername/agent-challenge:latest .

# Run locally
docker run -p 8080:8080 --env-file .env yourusername/agent-challenge:latest

# Push to registry (automated by Deploy Manager Agent)
docker push yourusername/agent-challenge:latest

Configuration

# Mastra Configuration
MODEL_NAME_AT_ENDPOINT=qwen2.5:1.5b
API_BASE_URL=http://127.0.0.1:11434/api

# Nosana Real Deployment Configuration
NOSANA_WALLET_PATH=~/.nosana/nosana_key.json
NOSANA_DEFAULT_MARKET=nvidia-3090
DOCKER_USERNAME=yourdockerhubusername
DOCKER_TOKEN=your_docker_access_token

Usage Examples

Deploy Manager Agent (Real Deployment)

  • "What agents can I deploy?" β†’ Lists available agents with deployment specs
  • "Deploy the blockchain monitor agent" β†’ Actually deploys to Nosana network with live URL
  • "Analyze costs for deploying on A100 market" β†’ Real cost analysis with current GPU pricing
  • "Monitor deployment JOB_ID" β†’ Live monitoring using real Nosana CLI job status
  • "Build Docker image for my agent" β†’ Executes real docker build with registry push

Blockchain Monitor Agent (Real Data)

  • "Monitor Bitcoin and Ethereum prices" β†’ Live CoinGecko API data with real prices
  • "Track wallet address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" β†’ Transaction monitoring
  • "Analyze Uniswap V3 liquidity pools" β†’ DeFi protocol analysis
  • "Generate a market analysis report" β†’ Comprehensive market data
  • "Set up portfolio monitoring workflow" β†’ Multi-step workflow orchestration

Challenge Demonstrations (Production Ready)

  • "Show me all available agents with their costs" β†’ Real deployment specifications
  • "Deploy the blockchain monitor agent to track BTC and ETH" β†’ Actually deploys with live monitoring
  • "What's the deployment complexity of different agents?" β†’ Real resource analysis
  • "Monitor my deployment costs in real-time" β†’ Live cost tracking with actual billing

Project Structure

src/mastra/agents/
β”œβ”€β”€ deploy-manager/           # DevOps automation agent
β”‚   β”œβ”€β”€ deploy-manager-agent.ts
β”‚   β”œβ”€β”€ agent-discovery-tool.ts
β”‚   β”œβ”€β”€ cost-analyzer-tool.ts
β”‚   β”œβ”€β”€ deployment-executor-tool.ts
β”‚   β”œβ”€β”€ docker-build-tool.ts
β”‚   β”œβ”€β”€ dockerfile-generator-tool.ts
β”‚   β”œβ”€β”€ monitoring-tool.ts
β”‚   β”œβ”€β”€ nosana-job-creator-tool.ts
β”‚   └── troubleshooter-tool.ts
β”œβ”€β”€ blockchain-monitor/       # Blockchain monitoring agent
β”‚   β”œβ”€β”€ blockchain-monitor-agent.ts
β”‚   β”œβ”€β”€ blockchain-monitor-workflow.ts
β”‚   β”œβ”€β”€ defi-monitor-tool.ts
β”‚   β”œβ”€β”€ price-monitor-tool.ts
β”‚   └── transaction-monitor-tool.ts
└── weather-agent/           # Example weather agent
    β”œβ”€β”€ weather-agent.ts
    β”œβ”€β”€ weather-tool.ts
    └── weather-workflow.ts

Deployment Information

Challenge Solution Highlights

  1. Real Meta-Deployment Architecture: Deploy Manager actually deploys agents to Nosana network
  2. Live Cost-Aware Deployment: Real-time cost tracking with intelligent GPU market selection
  3. Production-Ready Agent System: Real Docker builds and live Nosana deployments
  4. Real-World Applications: Actual deployments for DevOps automation and blockchain monitoring
  5. Live Workflow Orchestration: Real-time monitoring with intelligent decision making
  6. Full CI/CD Integration: Complete deployment pipeline from code to live production

Production Deployment Features

βœ… Real Deployment Capabilities

  • Docker Integration: Real docker build, docker push with registry authentication
  • Nosana CLI Integration: Real npx @nosana/cli job post deployment execution
  • Live Job Monitoring: Real-time job status with nosana job get integration
  • Cost Tracking: Actual cost monitoring based on real elapsed time and GPU rates
  • Health Monitoring: Live health checks on deployed services

βœ… Production Setup

  • Environment Configuration: Complete .env setup for wallet and credentials
  • Security: Secure credential management with Docker token support
  • Documentation: Comprehensive setup guide in NOSANA_SETUP.md
  • Error Handling: Production-grade error handling and troubleshooting

This implementation demonstrates real production deployment where the Deploy Manager Agent can actually deploy other agents to the Nosana network, monitor them in real-time, and provide live cost analysis - showcasing the power of composable AI agents in production environments.

About

Nosana Builders' Challenge: Agent 101

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors