neuron-ai

neuron-coreMIT活跃维护

PHP 生态的 Agent 编排框架,把 LLM、工具、向量库和记忆组装成能读写数据、对接 UI 的智能体,方便落地生产级 AI 应用。

The Agentic Framework of the PHP ecosystem to build production-ready AI driven applications. Connect components (LLMs, Tools, vector DBs, memory) to agents that interact with your data and UI.

4.1.22发布于 2026-11-06 21:21 UTC2,169star +3 / 7 天260fork同步于 2026-11-10 17:47 UTC

怎么上手

由 README 提炼,执行前请确认
composer require neuron-core/neuron-ai
vendor/bin/neuron make:agent DataAnalystAgent
硬件要求按 README 说明

README 未说明,仅要求 PHP ^8.1,未提及 GPU 或显存要求

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

PHP 生态的 Agentic 框架,用组件拼装可上生产的 AI 智能体应用

PHP 生态的 Agent 编排框架,把 LLM、工具、向量库和记忆组装成能读写数据、对接 UI 的智能体,方便落地生产级 AI 应用。

核心能力

  • 继承 Agent 类即可获得记忆、工具与 RAG 能力
  • 支持 Anthropic 等多家 LLM 提供商接入
  • 通过 MCP 连接器对接外部工具与数据源
  • 用 Workflow 编排多智能体、状态与人工审批
  • 支持流式输出与 AG-UI、Vercel AI SDK 等 UI 协议

容易踩的坑

需要 PHP 8.1 及以上版本;要自行准备 LLM 提供商的 API Key 与模型名;官方建议额外运行 npx skills add 安装随包附带的 agent skills

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本4.1.22
  1. 4.1.22最新正式版2026-11-06 · 2026-11-06 21:21 UTC

    Command extension from installed packages

  2. 4.1.212026-11-04 · 2026-11-04 17:51 UTC
    查看更新说明

    Toolkit visibility:

    protected function tools(): array
    {
        return [
            MyToolkit::make()->visible(true|false),
        ];
    }
    
  3. 4.1.202026-11-04 · 2026-11-04 16:31 UTC
    查看更新说明

    Add node heartbeat to update the lease timeout in a long-running node

  4. 4.1.192026-11-02 · 2026-11-02 19:15 UTC
    查看更新说明

    fix failed tools run twice on recovery

  5. 4.1.182026-11-02 · 2026-11-02 11:45 UTC
    查看更新说明

    Spport usage meter in evaluations

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Create Full-Featured Agentic Applications in PHP

    Latest Stable Version Total Downloads

    [!IMPORTANT] Get early access to new features, exclusive tutorials, and expert tips for building AI agents in PHP. Join a community of PHP developers pioneering the future of AI development. Subscribe to the newsletter

    Before moving on, support the Neuron AI community giving a GitHub star ⭐️. Thank you!

    What is Neuron

    Neuron is a PHP framework for creating and orchestrating AI Agents. It allows you to integrate AI entities into your PHP applications with a powerful and flexible architecture. We provide tools for the entire agentic application development lifecycle, from LLM interfaces, data loading, multi-agent orchestration, to monitoring and debugging. In addition, we provide tutorials and other educational content to help you get started using AI Agents in your projects.

    Video Tutorial

    Neuron & Inspector

    Why Neuron

    Your next application will be agentic. A growing share of new software is no longer a web application with AI features added along the way, but an application born agentic, where the agent is the architecture itself, driving how the system reasons, acts, and talks to the user interface. Building this kind of application requires a specific set of foundations: event-driven workflows with checkpointing, human-in-the-loop, interruption, multi-agent orchestration, streaming, and agentic UI integration like AG-UI and the Vercel AI SDK, MCP connectors, and asynchronous execution.

    Each one is a chapter of the documentation: Workflow, Human in the loop, Streaming & UI protocols, MCP, Async.

    There is also no second framework waiting for you when the project grows. The same Workflow that runs your first agent in the getting started guide runs a multi-agent system with state, loops, and human approvals in production. What you learn on day one is what you ship in future projects.

    A Vertical Ecosystem

    Neuron is the vertical ecosystem for agentic applications development in PHP. Around the framework there is a registry of extensions, tools, and technologies designed specifically for agentic applications, and a growing number of companies building on the same architecture instead of assembling their own from scattered parts.

    For a software house or a product company this is a place to be recognized as a specialist rather than one more team claiming AI experience. For a company that needs an agentic foundation it can commit to for years, it means standardizing on an architecture whose whole direction is this space, not a general-purpose library where AI is a side feature. It also means hiring becomes a solvable problem: as the community grows, so does the number of developers who already know how to design, test, and run agentic applications on this architecture, so the people you bring in tomorrow speak the same language as the system you are building today.

    Our Official Channels

    Follow the Neuron channels to stay up to date:

    Start With One Prompt

    Copy & paste this initial prompt to tell your coding agent how to install and configure Neuron AI in your project.

    You are going to set up Neuron AI, a PHP framework for building agentic applications,
    in this project, and you must follow three steps in order.
    
    - First: install the framework: check composer.json, and if neuron-core/neuron-ai is not
    already required, run `composer require neuron-core/neuron-ai`;
    
    - Second: install the agent skills that ship
    with the package by running `npx --yes skills add ./vendor/neuron-core/neuron-ai/skills -y` from
    the project root. Add this command to `post-update-cmd` in the composer.json file, so they
    stay updated whenever Neuron is updated through Composer. From then on, load the relevant
    skill before you write any Neuron code instead of relying on what you remember about
    the framework;
    
    - Third: work out what kind of app this is. Look at composer.json
    and the project structure to see whether it is an application based on Laravel, Symfony, or another framework,
    then activate the matching skill: neuron-laravel-integration or neuron-symfony-integration.
    If Neuron is already part of the app go through the skill's foundations checklist
    item by item. Report what differs from the recommended setup;
    
    If Neuron is not in the app yet, follow the same checklist to do the first setup.
    If the app uses neither framework, start from a plain PHP agent using
    the neuron-agent skill. Finish with a short summary of what you installed
    and what you found.
    

    Requirements

    • PHP: ^8.1

    How To

    1) Install

    composer require neuron-core/neuron-ai
    

    2) Create an Agent

    Neuron provides you with the Agent class you can extend to inherit the main features of the framework and create fully functional agents. This class automatically manages some advanced mechanisms for you, such as memory, tools, up to RAG (Retrieval Augmented Generation). You can go deeper into these aspects below.

    Let's create an Agent with the command below:

    vendor/bin/neuron make:agent DataAnalystAgent
    
    <?php
    
    namespace App\Neuron;
    
    use NeuronAI\Agent\Agent;
    use NeuronAI\Chat\Messages\SystemMessage;
    use NeuronAI\Providers\AIProviderInterface;
    use NeuronAI\Providers\Anthropic\Anthropic;
    
    class DataAnalystAgent extends Agent
    {
        protected function provider(): AIProviderInterface
        {
            return new Anthropic(
                key: 'ANTHROPIC_API_KEY',
                model: 'ANTHROPIC_MODEL',
            );
        }
    
        protected function instructions(): SystemMessage
        {
            return new SystemMessage(
                "You are a data analyst expert in creating reports from SQL databases."
            );
        }
    }
    

    3) Talk to the Agent

    Bind the agent to a conversation thread, then send it a message and get a response:

    
    $agent = DataAnalystAgent::make()->setThreadId('user-42');
    
    
    $response = $agent->chat(
        new UserMessage("Hi, I'm Valerio. Who are you?")
    )->getMessage();
    echo $response->getContent();
    // I'm a data analyst. How can I help you today?
    
    
    $response = $agent->chat(
        new UserMessage("Do you remember my name?")
    )->getMessage();
    echo $response->getContent();
    // Your name is Valerio, as you said in your introduction.
    

    As you can see in the example above, the Agent has memory of the ongoing conversation. Learn more about memory in the documentation.

    Supported LLM Providers

    With Neuron, you can switch between LLM providers with just one line of code, without any impact on your agent implementation. Supported providers:

    Tools & Toolkits

    Make your agent able to perform concrete tasks, like reading from a database, by adding tools or toolkits (collections of tools).

    <?php
    
    namespace App\Neuron;
    
    use NeuronAI\Agent\Agent;
    use NeuronAI\Chat\Messages\SystemMessage;
    use NeuronAI\Providers\AIProviderInterface;
    use NeuronAI\Providers\Anthropic\Anthropic;
    use NeuronAI\Tools\Toolkits\MySQL\MySQLSchemaTool;
    use NeuronAI\Tools\Toolkits\MySQL\MySQLSelectTool;
    use NeuronAI\Tools\Toolkits\MySQL\MySQLToolkit;
    
    class DataAnalystAgent extends Agent
    {
        protected function provider(): AIProviderInterface
        {
            return new Anthropic(
                key: 'ANTHROPIC_API_KEY',
                model: 'ANTHROPIC_MODEL',
            );
        }
    
        protected function instructions(): SystemMessage
        {
            return new SystemMessage(
                "You are a data analyst expert in creating reports from SQL databases."
            );
        }
    
        protected function tools(): array
        {
            return [
                MySQLToolkit::make(
                    \DB::connection()->getPdo()
                )->only([MySQLSchemaTool::class, MySQLSelectTool::class]),
            ];
        }
    }
    

    The select tool runs each query in a read-only transaction, so the database refuses any write. It can still read everything the connection's user can read. For production, consider giving the toolkit its own connection, with a user that can only SELECT the tables the agent needs and a statement timeout.

    Ask the agent something about your database:

    $response = DataAnalystAgent::make()->setThreadId('demo')->chat(
        new UserMessage("How many orders we received today?")
    )->getMessage();
    
    echo $response->getContent();
    

    Learn more about Tools in the documentation.

    MCP Connector

    Instead of implementing tools manually, you can connect tools exposed by an MCP server with the McpConnector component:

    <?php
    
    namespace App\Neuron;
    
    use NeuronAI\Agent\Agent;
    use NeuronAI\MCP\McpConnector;
    
    class DataAnalystAgent extends Agent
    {
        ...
    
        protected function tools(): array
        {
            return [
                // Connect to an MCP server
                ...McpConnector::make([
                    'command' => 'npx',
                    'args' => ['-y', '@modelcontextprotocol/server-everything'],
                ])->tools(),
            ];
        }
    }
    

    Learn more about MCP connector in the documentation.

    Structured Output

    There are scenarios where you need Agents to understand natural language, but output in a structured format, like business processes automation, data extraction, etc. to use the output with other downstream systems.

    use App\Neuron\MyAgent;
    use NeuronAI\Chat\Messages\UserMessage;
    use NeuronAI\StructuredOutput\SchemaProperty;
    
    /*
     * Define the output structure as a PHP class.
     */
    class Person
    {
        #[SchemaProperty(
            description: 'The user name',
            required: true
        )]
        public string $name;
    
        #[SchemaProperty(
            description: 'What the user love to eat'
        )]
        public string $preference;
    }
    
    /*
     * Talk to the agent requiring the structured output
     */
    $person = MyAgent::make()->setThreadId('demo')->structured(
        new UserMessage("I'm John and I like pizza!"),
        Person::class
    );
    
    echo $person->name ' like '.$person->preference;
    // John like pizza
    

    Learn more about Structured Output on the documentation.

    RAG

    To create a RAG, you need to attach some additional components other than the AI provider, such as a vector store, and an embeddings provider.

    Let's create a RAG with the command below:

    vendor/bin/neuron make:rag MyChatBot
    

    Here is an example of a RAG implementation:

    <?php
    
    namespace App\Neuron;
    
    use NeuronAI\Providers\AIProviderInterface;
    use NeuronAI\Providers\Anthropic\Anthropic;
    use NeuronAI\RAG\Embeddings\EmbeddingsProviderInterface;
    use NeuronAI\RAG\Embeddings\VoyageEmbeddingProvider;
    use NeuronAI\RAG\RAG;
    use NeuronAI\RAG\VectorStore\PineconeVectorStore;
    use NeuronAI\RAG\VectorStore\VectorStoreInterface;
    
    class MyChatBot extends RAG
    {
        protected function provider(): AIProviderInterface
        {
            return new Anthropic(
                key: 'ANTHROPIC_API_KEY',
                model: 'ANTHROPIC_MODEL',
            );
        }
    
        protected function embeddings(): EmbeddingsProviderInterface
        {
            return new VoyageEmbeddingProvider(
                key: 'VOYAGE_API_KEY',
                model: 'VOYAGE_MODEL'
            );
        }
    
        protected function vectorStore(): VectorStoreInterface
        {
            return new PineconeVectorStore(
                key: 'PINECONE_API_KEY',
                indexUrl: 'PINECONE_INDEX_URL'
            );
        }
    }
    

    Learn more about RAG in the documentation.

    Workflow

    Think of a Workflow as a smart flowchart for your AI applications. The idea behind Workflow is to allow developers to use all the Neuron components like AI providers, embeddings, data loaders, chat history, vector store, etc., as standalone components to create totally customized agentic systems.

    Agent and RAG classes represent a ready to use implementation of the most common patterns when it comes to retrieval use cases, or tool calls, structured output, etc. Workflow allows you to program your agentic system completely from scratch. Agent and RAG can be used inside a Workflow to complete tasks as any other component if you need their built-in capabilities.

    Neuron Workflow

    Neuron Workflow supports a robust human-in-the-loop pattern, enabling human intervention at any point in an automated process. This is especially useful in large language model (LLM)-driven applications where model output may require validation, correction, or additional context to complete the task.

    Learn more about Workflow on the documentation.

    AI Assisted Development

    When working with AI coding assistants like Claude Code, Opencode, Cursor, or other similar tools, you have two options to give the AI deep context about Neuron components. This leads to more accurate code suggestions, better understanding of component APIs, and fewer hallucinations when generating Neuron code:

    Security Vulnerabilities

    If you discover a security vulnerability within Neuron, please send an e-mail to the Inspector team via [email protected]. All security vulnerabilities will be promptly addressed.

    Official documentation

    Go to the official documentation

    Development

    To run the full test suite locally, use Docker Compose to spin up all the services required by the CI environment:

    # Start all services
    docker compose up -d
    

    Run the test suite:

    # Install dependencies and run tests
    docker compose run --rm php composer update --prefer-stable
    docker compose run --rm php vendor/bin/phpunit
    

    To stop all services:

    docker compose down