Skip to content
@llm-agents-php

LLM Agents on PHP

The most powerful LLM Agents framework for PHP

👋 Welcome to LLM Agents PHP!

This PHP framework allows developers to create and manage Language Model (LLM) based agents in PHP applications. Perfect for building autonomous systems that interact with APIs, process natural language, and perform complex tasks.

✨ Key Features

  • 🤖 Agent Creation: Create and configure LLM-based agents in PHP with customizable behaviors.
  • 🔧 Tool Integration: Seamlessly integrate various tools and APIs for agent use in PHP applications.
  • 🧠 Memory Management: Support for agent memory, enabling information retention and recall across interactions.
  • 💡 Prompt Management: Efficient handling of prompts and instructions to guide agent behavior.
  • 🔌 Extensible Architecture: Easily add new agent types, tools, and capabilities to your PHP projects.
  • 🤝 Multi-Agent Support: Build systems with multiple interacting agents for complex problem-solving scenarios in PHP.

📂 Our packages

  • 🧠 LLM Agents Core: The core library for building LLM-based agents in PHP. It's the brain of our operation!
  • 🎭 Prompt Generator: A cool tool for generating chat prompts with all the system and user messages your agents need.
  • 🔌 OpenAI Client: Your ticket to seamlessly integrate OpenAI's API into your LLM Agents projects.
  • 💬 CLI Chat: A nifty CLI chat interface for chatting with LLM agents. Perfect for testing or building CLI chatbots!
  • 🗺️ JSON Schema Mapper: A handy tool for converting between PHP classes and JSON schemas, and vice versa.
  • 🚀 Sample Application: See LLM Agents PHP in action! This demo app shows you how to put all these cool tools to work.

Understanding the LLM Agents Ecosystem

Here's a UML sequence diagram that shows you exactly what goes down when a user asks their smart home agent to turn on the kitchen light.

sequenceDiagram
    actor User
    participant CLI as CLI Chat (cli-chat)
    participant CS as ChatService (agents)
    participant AE as AgentExecutor (agents)
    participant PG as PromptGenerator (prompt-generator)
    participant OAI as OpenAIClient (openai-client)
    participant SHC as SmartHomeControl (agent-specific)
    participant JSM as JSONSchemaMapper (json-schema-mapper)

    User->>CLI: "Turn on the light in the kitchen"
    activate CLI
    CLI->>CS: ask(sessionUuid, message)
    activate CS
    CS->>AE: execute(agent, prompt)
    activate AE
    AE->>PG: generate(agent, userPrompt, context)
    activate PG
    PG-->>AE: generatedPrompt
    deactivate PG
    AE->>OAI: generate(context, prompt, options)
    activate OAI
    OAI-->>AE: LLM Response (tool call)
    deactivate OAI
    AE->>JSM: toObject(toolCallJson, ToolCallInput::class)
    activate JSM
    JSM-->>AE: toolCallInput
    deactivate JSM
    AE->>SHC: execute(toolCallInput)
    activate SHC
    SHC-->>AE: actionResult
    deactivate SHC
    AE->>JSM: toJsonSchema(actionResult)
    activate JSM
    JSM-->>AE: resultSchema
    deactivate JSM
    AE->>OAI: generate(context, updatedPrompt, options)
    activate OAI
    OAI-->>AE: Final LLM Response
    deactivate OAI
    AE-->>CS: executionResult
    deactivate AE
    CS-->>CLI: response
    deactivate CS
    CLI-->>User: "I've turned on the kitchen light for you."
    deactivate CLI
Loading

Read more here

💬 Community and Support

Join our PHP developer community to contribute, discuss, and report issues:

  • 🛠️ Contribute: Check out our repositories for contribution guidelines to enhance LLM Agents PHP.
  • 💬 Discussions: Engage with other PHP developers in GitHub Discussions about LLM Agents.
  • 🐛 Issues: Report bugs or request new features through GitHub Issues to improve the framework.

🔔 Stay Updated

Follow us on GitHub for the latest updates on LLM Agents PHP, and star our repositories to show your support and stay informed about new releases.

Pinned Loading

  1. sample-app sample-app Public

    This sample application demonstrates the practical implementation and usage patterns of the LLM Agents library.

    PHP 14 1

  2. sample-app-laravel sample-app-laravel Public

    This sample application demonstrates the practical implementation and usage patterns of the LLM Agents library.

    PHP 10 1

  3. agents agents Public

    LLM Agents abstraction

    PHP 68

  4. prompt-generator prompt-generator Public

    Prompt generator for LLM agents with interceptors

    PHP 6 1

  5. openai-client openai-client Public

    OpenAI API client for LLM Agents

    PHP 2

  6. vector-storage vector-storage Public

    LLM Agents Vector Storage

    PHP 2

Repositories

Showing 10 of 14 repositories
  • projector Public

    A set of tools and agents for refactoring and developing the project's codebase.

    llm-agents-php/projector’s past year of commit activity
    PHP 0 BSD-3-Clause 0 1 0 Updated Sep 18, 2024
  • prompt-generator Public

    Prompt generator for LLM agents with interceptors

    llm-agents-php/prompt-generator’s past year of commit activity
    PHP 6 MIT 1 0 0 Updated Sep 15, 2024
  • agents Public

    LLM Agents abstraction

    llm-agents-php/agents’s past year of commit activity
    PHP 68 MIT 0 2 1 Updated Sep 15, 2024
  • sample-app-laravel Public

    This sample application demonstrates the practical implementation and usage patterns of the LLM Agents library.

    llm-agents-php/sample-app-laravel’s past year of commit activity
    PHP 10 1 0 0 Updated Sep 15, 2024
  • openai-client Public

    OpenAI API client for LLM Agents

    llm-agents-php/openai-client’s past year of commit activity
    PHP 2 MIT 0 0 0 Updated Sep 10, 2024
  • vector-storage Public

    LLM Agents Vector Storage

    llm-agents-php/vector-storage’s past year of commit activity
    PHP 2 MIT 0 0 0 Updated Sep 7, 2024
  • sample-app Public

    This sample application demonstrates the practical implementation and usage patterns of the LLM Agents library.

    llm-agents-php/sample-app’s past year of commit activity
    PHP 14 1 1 1 Updated Sep 7, 2024
  • cli-chat Public

    A simple CLI chat application SDK

    llm-agents-php/cli-chat’s past year of commit activity
    PHP 0 MIT 0 0 0 Updated Sep 7, 2024
  • agent-symfony-console Public

    Simple agent that can handle Symfony Console commands based on user input

    llm-agents-php/agent-symfony-console’s past year of commit activity
    PHP 1 MIT 0 0 0 Updated Sep 7, 2024
  • agent-smart-home-control Public

    Simple agent to control smart home devices

    llm-agents-php/agent-smart-home-control’s past year of commit activity
    PHP 1 MIT 0 0 0 Updated Sep 7, 2024