$ show neuron-core/neuron-ai
Neuron AI is a PHP framework for building AI-powered applications with support for multiple large language model providers (OpenAI, Anthropic, Gemini, Mistral, Ollama, AWS Bedrock, etc.), tool integration, structured output, retrieval-augmented generation (RAG), and complex workflow orchestration. It provides a composable agent class that can operate in chat, stream, and structured output modes, a workflow engine with interrupt/resume and persistence, a built-in evaluation framework with LLM-based judges and assertions, and a Model Context Protocol (MCP) client for connecting to external tool servers. The architecture is modular: agents are built on top of workflows, tools are defined via PHP classes with JSON schema generation, and providers are abstracted behind a common interface with traits for shared logic.
The LLM identified 4 files worth highlighting for reuse:
Converts JSON to typed PHP objects using reflection and custom attribute annotations. Supports nested objects, arrays, union types, discriminators, and enum mapping. Can be extracted as a standalone library for JSON-to-DTO conversion.
Async HTTP client built on amphp that supports streaming responses. Handles request/response lifecycle, content types, and error handling. Reusable as a standalone async HTTP library for PHP projects requiring non-blocking I/O.
Test double for AI providers that records all requests and allows asserting on call counts, system prompts, tool configurations, and streamed content. Provides fluent assertion API. Can be extracted as a generic mock for HTTP-based service integrations.
Publish-subscribe event bus with scoped observers for lifecycle events (inference start/stop, tool calls, middleware hooks, errors). Supports multiple observers and priority ordering. Reusable as a lightweight event system for any PHP application.