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 tell whether it is a Laravel app or a Symfony app, 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.namespace App\Neuron;
use NeuronAI\Agent\Agent;
use NeuronAI\Chat\Messages\UserMessage;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\Anthropic\Anthropic;
class MyAgent extends Agent
{
protected function provider(): AIProviderInterface
{
return new Anthropic(
key: 'ANTHROPIC_API_KEY',
model: 'ANTHROPIC_MODEL',
);
}
}
$message = MyAgent::make()
->setThreadId('chat_id')
->chat(new UserMessage("Hi!"))
->getMessage();
echo $message->getContent();
// Hi, how can I help you today?namespace App\Neuron;
use NeuronAI\Agent\Agent;
use NeuronAI\Chat\Messages\UserMessage;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\Ollama\Ollama;
class MyAgent extends Agent
{
protected function provider(): AIProviderInterface
{
return new Ollama(
url: 'OLLAMA_URL',
model: 'OLLAMA_MODEL',
);
}
}
$message = MyAgent::make()
->setThreadId('chat_id')
->chat(new UserMessage("Hi!"))
->getMessage();
echo $message->getContent();
// Hi, how can I help you today?namespace App\Neuron;
use NeuronAI\Agent\Agent;
use NeuronAI\Chat\Messages\UserMessage;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\OpenAI\OpenAI;
class MyAgent extends Agent
{
protected function provider(): AIProviderInterface
{
return new OpenAI(
key: 'OPENAI_API_KEY',
model: 'OPENAI_MODEL',
);
}
}
$message = MyAgent::make()
->setThreadId('chat_id')
->chat(new UserMessage("Hi!"))
->getMessage();
echo $message->getContent();
// Hi, how can I help you today?namespace App\Neuron;
use NeuronAI\Agent\Agent;
use NeuronAI\Chat\Messages\UserMessage;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\Gemini\Gemini;
class MyAgent extends Agent
{
protected function provider(): AIProviderInterface
{
return new Gemini(
key: 'GEMINI_API_KEY',
model: 'GEMINI_MODEL',
);
}
}
$message = MyAgent::make()
->setThreadId('chat_id')
->chat(new UserMessage("Hi!"))
->getMessage();
echo $message->getContent();
// Hi, how can I help you today?namespace App\Neuron;
use NeuronAI\Agent\Agent;
use NeuronAI\Chat\Messages\UserMessage;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\Gemini\Mistral;
class MyAgent extends Agent
{
protected function provider(): AIProviderInterface
{
return new Mistral(
key: 'MISTRAL_API_KEY',
model: 'MISTRAL_MODEL',
);
}
}
$message = MyAgent::make()
->setThreadId('chat_id')
->chat(new UserMessage("Hi!"))
->getMessage();
echo $message->getContent();
// Hi, how can I help you today?


