npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@friday-agents/core

v1.0.19

Published

A JavaScript framework for orchestrating multiple AI-driven agents to handle complex tasks like data processing, code generation, chart creation, and image generation

Downloads

32

Readme

Friday Agents

The Friday Agents is a JavaScript package for integrating and orchestrating multiple AI-driven tools (agents) for diverse tasks like data processing, code generation, chart creation, image generation, and more.

Features:

  • Multi-agent orchestration: Use multiple agents together to handle complex tasks.
  • Customizable agent configuration: Easily configure agents like SearchAgent, JsCodeAgent, ImageAgent, and ChartAgent.
  • Flexible workflows: Tailor each agent’s behavior and manage retries and result handling.

Installation

npm install @friday-agents/core

Usage

Here's how to use the core package:

import { FridayAgents } from "@friday-agents/core";

// Create an instance of Friday Agents
const fa = new FridayAgents({
  agents: [/* your configured agents */],
  maxAgentRetry: 2,
  baseLLm: {
    model: "your-model",
    endpoint: "your-endpoint",
    apikey: "your-api-key",
  },
  onChooseAgents: (reason, agents) => {
    console.log('Chosen agents:', agents, 'because:', reason);
  },
  onUsingAgent: (name) => {
    console.log('Using agent:', name);
  },
  onAgentFinished: (name, result) => {
    console.log(`Agent ${name} finished:`, result);
  },
  onAgentFailed: (name, error) => {
    console.log(`Agent ${name} failed:`, error);
  },
  onFinish: (data) => {
    console.log('Final result:', data);
  },
});

// Run with messages
await fa.run({
  messages: [
    { role: "user", content: "Your request here" }
  ],
  user: {  // Optional user context
    name: "John",
    age: 25
  },
  date: "2024-01-01",  // Optional current date
  cutoff_date: "2023-12-31"  // Optional data cutoff date
});

// Results are handled through the onFinish callback

Configuration Options

FridayAgents Options

  • agents: Array of agent instances that will be available for use
  • maxAgentRetry: Maximum number of retries for failed agent executions
  • baseLLm: Configuration for the base language model
    • model: Model identifier
    • endpoint: API endpoint
    • apikey: API key for authentication
  • onChooseAgents: Callback when agents are selected for a task
  • onUsingAgent: Callback when an agent starts processing
  • onAgentFinished: Callback when an agent completes successfully
  • onAgentFailed: Callback when an agent encounters an error
  • onFinish: Callback that receives the final results after all agents complete (this is the main way to get results)

Run Method Options

  • messages: Array of chat messages in OpenAI format
  • user (optional): User context with name and age
  • date (optional): Current date string
  • cutoff_date (optional): Data cutoff date string

Response Format

The final results are provided through the onFinish callback, which receives a FinalResponse object:

interface FinalResponse {
  finalResponse: {
    type: string;  // Response type (e.g., "text", "view")
    text: string | null;  // Text response if applicable
    data?: any;  // Additional data if provided (the agent's dataOutput)
  };
  usedAgents: Array<{
    name: string;
    result: any;
    usedSeconds: number;
    data: any;
  }>;
}

Developing Custom Agents

When creating a custom agent, implement the following interface:

interface Agent {
  name: string;
  description: string;
  viewType: string;
  needSimplify?: boolean;
  config?: any;
  dataOutput?: any;
  // no need to implement this, it's will be provided.
  ai?: {
    create: (params: any) => Promise<any>;
  };

  callFormat(): string;
  onCall(result: string): Promise<string | null>;
}

Key components:

  1. name: Unique identifier for the agent
  2. description: Clear description of the agent's purpose and capabilities
  3. viewType: Output format (e.g., "text", "image", "json")
  4. needSimplify: Whether the output should be simplified by the LLM
  5. callFormat: Returns the expected input format
  6. onCall: Implements the agent's core functionality

Example: WeatherAgent

import Agent from "./agent";

export interface WeatherAgentConfig {
    apiKey: string
}

export default class WeatherAgent extends Agent<WeatherAgentConfig> {
    viewType: Agent['viewType'] = "text"; // Output format as text
    name: string = "weather"; // Agent's name
    description: string = "This agent fetches real-time weather data for a given location.";

    // Returns expected query format for the agent
    callFormat(): string {
        return '{ "location": "city name or coordinates" }';
    }

    // Method to fetch weather data
    async onCall(result: string): Promise<string | null> {
        const { location } = JSON.parse(result) ?? {};
        if (!location) return null;

        // Make API call to weather service
        const res = await fetch(`https://api.weatherapi.com/v1/current.json?key=${this.config.apiKey}&q=${location}`);
        const weatherData = await res.json();

        if (weatherData && weatherData.current) {
            const { temp_c, condition } = weatherData.current;
            return `The current temperature in ${location} is ${temp_c}°C with ${condition.text}.`;
        }

        return null;
    }
}

Key Concepts:

  1. Custom Config: WeatherAgentConfig defines the apiKey needed for the weather service.
  2. callFormat: Specifies that the agent expects a JSON object with a location key.
  3. onCall: This method makes an API request to fetch weather data, processes the response, and returns the weather information.

Once created, you can easily add your custom agent to the FridayAgents and automate workflows using your specialized tools!

License

MIT License.