Skip to content

garyblankenship/sentinels

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 

Repository files navigation

Sentinels: Powerful, Flexible, and Simple Agent-Based Task Execution for Laravel

Sentinels is a cutting-edge, agent-based task execution framework for Laravel that combines power and flexibility with simplicity and ease of use. It empowers developers to create, manage, and execute single-purpose agents in a highly efficient pipeline architecture.

πŸš€ Key Features

  • Invokable Agents: Create powerful, single-purpose agents with a clean, invokable interface.
  • Flexible Pipeline Architecture: Chain multiple agents together for complex task execution.
  • Dynamic Agent Routing: Route tasks to specific agents based on custom conditions.
  • Easy Integration: Seamlessly integrates with Laravel projects.
  • Extensible Design: Easily extend and customize to fit your specific needs.
  • Performance Optimized: Designed for efficient execution of complex task chains.

πŸ›  Installation

Install Sentinels via Composer:

composer require vampires/sentinels

🎯 Quick Start

Here's a simple example to get you started with Sentinels:

use Vampires\Sentinels\Agents\AgentManager;
use Vampires\Sentinels\Agents\BaseAgent;

// Define a simple agent
class UppercaseAgent extends BaseAgent
{
    public function __invoke($input = null)
    {
        return strtoupper($input);
    }
}

// Use the agent in a pipeline
$manager = new AgentManager();
$result = $manager
    ->addAgent(new UppercaseAgent())
    ->pipeline("hello world");

echo $result; // Outputs: HELLO WORLD

🧠 Core Concepts

Creating an Agent

Agents are the building blocks of Sentinels. Create a new agent by extending the BaseAgent class:

use Vampires\Sentinels\Agents\BaseAgent;

class MyCustomAgent extends BaseAgent
{
    public function __invoke($input = null)
    {
        // Your agent logic here
        return $input;
    }
}

Using the AgentManager

The AgentManager allows you to create powerful pipelines by chaining multiple agents:

use Vampires\Sentinels\Agents\AgentManager;

$manager = new AgentManager();
$result = $manager
    ->addAgent(new DataFetchAgent())
    ->addAgent(new DataTransformAgent())
    ->addAgent(new DataValidationAgent())
    ->executeAll($initialData);

Dynamic Agent Routing

Use the AgentRouter to dynamically route tasks to specific agents:

use Vampires\Sentinels\Agents\AgentRouter;

$router = new AgentRouter();
$router
    ->addRoute("email", new EmailAgent())
    ->addRoute("sms", new SmsAgent());

$agent = $router->route("email task");
$result = $agent("Send this email");

πŸ§ͺ Testing

Sentinels comes with a comprehensive test suite. Run the tests with:

composer test

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details on how to contribute to Sentinels.

πŸ”’ Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

πŸ‘ Credits

πŸ“„ License

Sentinels is open-sourced software licensed under the MIT license.

About

invokable agents with pipeline actions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published