LogoLogo
  • JuliaOS Documentation Hub
  • About JuliaOS
    • Mission & Vision
    • Features and Capabilities
    • Roadmap
    • Tokenomics
  • Ecosystem
    • Overview
  • Partners
    • Heurist
    • Fetch.ai
    • Soulgraph
    • cheqd.io
    • Aethir
    • Anyone
    • TensorLabs
    • Hashpower
  • Technology
    • Overview
    • Open Source
      • Modular Framework
      • CLI Mode
    • AI Platform
      • Dashboard
      • Agent Management
      • Swarm Management
      • Marketplace
      • Mining
    • LLM
    • Launchpad
    • Robotics & IOT
      • SwarmIOT
      • Modular AI with Robotics
        • J3OS MiniLLM
          • 🔧 Use Cases
  • Technical
    • Overview
    • Developer Hub
      • Getting Started
        • Installation Guide
          • Github Guide
        • Basic Concepts
        • Quick Start Guide
          • Handling secrets
        • Examples and Use
          • Example: Using the Trading Functionality
          • Example: Using the Benchmarking Feature
          • Example: Multi-Agent Swarm Coordination
          • Example: Using the Python Wrapper for LLM Integration
          • Example: Using Cross-Chain Bridges
          • Example: Creating and Running a Swarm Optimization
          • Page 4
      • Best Practices
        • Performance Tuning
        • Agent/Swarm Design Patterns
        • Best Practices & Patterns
        • Security Best Practices
      • CLI
        • JuliaOS CLI Interface
        • Agent Management (CLI)
        • CLI Configuration
        • Cross-Chain Hub (CLI)
        • Swarm Management (CLI)
        • CLI Troubleshooting
        • Wallet Management (CLI)
      • Framework SDK
        • Modules
          • Bridge
          • Agents Module
          • Dex
          • Swarms Module
          • Wallet
        • Python Wrapper
          • LangChain Integration
          • Python Wrapper
      • Contributing Guide
      • Extending JuliaOS
      • Development Setup & Conventions
      • Testing & Debugging
      • Troubleshooting
    • Architecture
      • High Level JuliaOS
      • CLI <-> Backend Communication
      • Data Storage Architecture
      • Framework Internals
      • Architecture Deep Dive
        • Architectual Notes
    • Concepts
      • Core Features & Concepts
      • Agents
        • Agent Skills & Specializations
      • Swarms
      • Neural Networks
      • Blockchains & Chains
      • Bridges (Cross-Chain)
      • Integrations
        • Google ADK
        • LLMs
        • Price Feed
        • DEX Integration
      • Storage
      • Trading Capabilities
      • Use Cases
      • Wallets
      • Portfolio Optimization
  • Research
    • JuliaOS Research
  • API Documentation
    • API Reference
      • API Reference: Julia Backend Commands
      • API Reference: CLI Commands
      • API Reference: Node.js API
      • API Reference: Python API
      • API Reference
  • Community
    • Community & Support
  • FAQ
    • General
    • Technical
    • Community
Powered by GitBook
On this page
  • Overview
  • Installation
  • Usage
  • Initializing the Agents Module
  • Creating an Agent
  • Starting an Agent
  • Executing a Task with an Agent
  • Getting Agent Status
  • Stopping an Agent
  • Listing Agents
  • Deleting an Agent
  • Specialized Agent Types
  • Trading Agents
  • Research Agents
  • Dev Agents
  • Agent Memory
  • Error Handling
  • See Also
Export as PDF
  1. Technical
  2. Developer Hub
  3. Framework SDK
  4. Modules

Agents Module

The Agents module in the JuliaOS framework provides a comprehensive interface for creating, managing, and interacting with agents. This page explains how to use the Agents module in your applications.

Overview

The Agents module connects to the Julia backend through the JuliaBridge and provides methods for creating, retrieving, starting, stopping, and executing tasks with agents. It also includes specialized agent types for specific use cases.

Installation

npm install @juliaos/framework

Usage

Initializing the Agents Module

import { JuliaBridge } from '@juliaos/julia-bridge';
import { Agents } from '@juliaos/framework';

// Initialize the bridge
const bridge = new JuliaBridge({ host: 'localhost', port: 8052 });
await bridge.initialize();

// Create the Agents module
const agents = new Agents(bridge);

Creating an Agent

const agent = await agents.createAgent({
  name: 'MyAgent',
  type: 'trading',
  config: {
    risk_tolerance: 'medium',
    max_position_size: 1000,
    take_profit: 0.05,
    stop_loss: 0.03,
    trading_pairs: ['ETH/USDC', 'BTC/USDC'],
    strategies: ['momentum', 'mean_reversion']
  }
});

console.log('Created agent:', agent);

Starting an Agent

await agents.startAgent(agent.id);
console.log('Agent started');

Executing a Task with an Agent

const taskResult = await agents.executeTask(agent.id, {
  action: 'analyze_market',
  market: 'crypto',
  timeframe: '1d'
});

console.log('Task result:', taskResult);

Getting Agent Status

const status = await agents.getAgentStatus(agent.id);
console.log('Agent status:', status);

Stopping an Agent

await agents.stopAgent(agent.id);
console.log('Agent stopped');

Listing Agents

const allAgents = await agents.listAgents();
console.log('All agents:', allAgents);

// Filter by type
const tradingAgents = await agents.listAgents({ type: 'trading' });
console.log('Trading agents:', tradingAgents);

// Filter by status
const runningAgents = await agents.listAgents({ status: 'running' });
console.log('Running agents:', runningAgents);

Deleting an Agent

await agents.deleteAgent(agent.id);
console.log('Agent deleted');

Specialized Agent Types

The framework includes specialized agent types for specific use cases:

Trading Agents

import { TradingAgent } from '@juliaos/framework';

const tradingAgent = await TradingAgent.create(agents, {
  name: 'MyTradingAgent',
  risk_level: 'medium',
  max_position_size: 1000,
  take_profit: 0.05,
  stop_loss: 0.03,
  trading_pairs: ['ETH/USDC', 'BTC/USDC'],
  strategies: ['momentum', 'mean_reversion']
});

// Execute a trade
const tradeResult = await tradingAgent.executeTrade({
  pair: 'ETH/USDC',
  side: 'buy',
  amount: 0.1,
  price: 2000,
  type: 'limit'
});

// Get portfolio
const portfolio = await tradingAgent.getPortfolio();

Research Agents

import { ResearchAgent } from '@juliaos/framework';

const researchAgent = await ResearchAgent.create(agents, {
  name: 'MyResearchAgent',
  research_areas: ['market', 'technology', 'sentiment'],
  data_sources: ['web', 'api', 'database'],
  analysis_methods: ['statistical', 'nlp', 'trend'],
  output_formats: ['text', 'json', 'chart']
});

// Conduct research
const researchResult = await researchAgent.conductResearch({
  topic: 'Ethereum Layer 2 Solutions',
  depth: 'medium',
  focus: ['technology', 'adoption', 'performance'],
  timeframe: 'last_6_months',
  sources: ['academic', 'news', 'social_media']
});

Dev Agents

import { DevAgent } from '@juliaos/framework';

const devAgent = await DevAgent.create(agents, {
  name: 'MyDevAgent',
  languages: ['python', 'javascript', 'julia'],
  frameworks: ['react', 'tensorflow', 'flask'],
  specialties: ['web', 'ai', 'blockchain'],
  code_style: 'clean'
});

// Write code
const codeResult = await devAgent.writeCode({
  description: 'Create a simple React component that displays cryptocurrency prices',
  language: 'javascript',
  framework: 'react',
  requirements: [
    'Fetch data from CoinGecko API',
    'Display prices for BTC, ETH, and SOL',
    'Update prices every 30 seconds',
    'Include error handling'
  ]
});

// Review code
const reviewResult = await devAgent.reviewCode({
  content: '/* code to review */',
  language: 'javascript',
  framework: 'react'
});

Agent Memory

Agents have memory capabilities that allow them to store and retrieve information:

// Set memory
await agents.setAgentMemory(agent.id, 'key', 'value');

// Get memory
const value = await agents.getAgentMemory(agent.id, 'key');

// Delete memory
await agents.deleteAgentMemory(agent.id, 'key');

Error Handling

The Agents module includes robust error handling:

try {
  const agent = await agents.createAgent({
    name: 'MyAgent',
    type: 'trading',
    config: { /* ... */ }
  });
} catch (error) {
  console.error('Failed to create agent:', error);
}

See Also

  • Swarms Module - Learn about swarms and how to use them with agents

  • Bridge Module - Learn about the bridge that connects to the Julia backend

  • Wallet Module - Learn about wallet management

  • Blockchain Module - Learn about blockchain integration

PreviousBridgeNextDex