resources/boost/skills/neuron-agent-builder/SKILL.md
Create and configure Neuron AI agents with providers, tools, instructions, and memory. Use this skill whenever the user mentions building agents, creating AI assistants, setting up LLM-powered chat bots, configuring chat agents, or wants to create an agent that can talk, use tools, or handle conversations. Also trigger for any task involving agent configuration, provider setup, tool integration, or chat history management in Neuron AI.
npx skillsauth add neuron-core/neuron-laravel neuron-agent-builderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill helps you create and configure Neuron AI agents for building agentic applications in PHP.
A Neuron agent extends the Agent class and implements key methods:
use NeuronAI\Agent;
use NeuronAI\Agent\SystemPrompt;
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',
);
}
protected function instructions(): string
{
return (string) new SystemPrompt(
background: [
"You are a helpful AI assistant."
]
);
}
}
For standard back-and-forth conversations:
$agent = MyAgent::make();
$response = $agent->chat(
new UserMessage("Hello!")
)->getMessage();
echo $response->getContent();
For streaming responses as chunks arrive. Chunks represents pieces of context that are generated by the model.
The TextChunk class is used to represent a piece of text, but there are other chunk types available:
NeuronAI\Chat\Messages\Chunks\TextChunkNeuronAI\Chat\Messages\Chunks\ImageChunkNeuronAI\Chat\Messages\Chunks\AudioChunkNeuronAI\Chat\Messages\Chunks\ToolCallChunkNeuronAI\Chat\Messages\Chunks\ToolResultChunk$handler = $agent->stream(new UserMessage("Hello"));
foreach ($handler->events() as $event) {
if ($event instanceof TextChunk) {
echo $event->content;
}
}
When connecting a frontend UI to an agent, use streaming adapters to format the response for specific protocols. This enables seamless integration with popular AI UI libraries.
When to use:
useChat hookAvailable adapters:
VercelAIAdapter - Compatible with Vercel AI SDK (useChat, useCompletion)AGUIAdapter - AG-UI protocol for agent interactionsLaravel example:
use NeuronAI\Chat\Messages\Stream\Adapters\VercelAIAdapter;
Route::post('/chat', function (Request $request) {
$handler = MyAgent::make()->stream(
new UserMessage($request->input('message'))
);
$stream = $handler->events(new VercelAIAdapter());
return response()->stream(
function () use ($stream) {
foreach ($stream as $line) {
echo $line;
ob_flush();
flush();
}
},
200,
$adapter->getHeaders()
);
});
For extracting structured data from a natural language:
class Person
{
#[SchemaProperty(description: 'The user name', required: true)]
public string $name;
#[SchemaProperty(description: 'What the user loves to eat')]
public string $preference;
}
$person = $agent->structured(
new UserMessage("I'm John and I like pizza!"),
Person::class
);
new Anthropic(
key: $_ENV['ANTHROPIC_API_KEY'],
model: 'claude-3-5-sonnet-20241022',
)
new OpenAI(
key: $_ENV['OPENAI_API_KEY'],
model: 'gpt-4',
)
new Ollama(
baseUrl: 'http://localhost:11434',
model: 'llama3',
)
Gemini - Google AI modelsVertexAI - Google Vertex AI platformMistral - Mistral AI modelsHuggingFace - Open models via HuggingFaceDeepseek - DeepSeek modelsGrok - XAI modelsAWSBedrockRuntime - AWS Bedrock inference platformCohere - Cohere modelsAzureOpenAI - Use OpenAI models on the Azure platformZAI - ZAI for GLM modelsuse NeuronAI\Tools\Toolkits\MySQL\MySQLToolkit;
use NeuronAI\Tools\Toolkits\Calculator\CalculatorToolkit;
protected function tools(): array
{
return [
MySQLToolkit::make(\DB::connection()->getPdo()),
CalculatorToolkit::make(),
];
}
use the neuron-tool-creator skills for more complex tool creation:
use NeuronAI\Tools\Tool;
use NeuronAI\Tools\ToolProperty;
class WeatherTool extends Tool
{
public function __construct()
{
parent::__construct(
name: 'get_weather',
description: 'Get the current weather for a location',
);
}
/**
* @return ToolProperty[]
*/
protected function properties(): array
{
return [
new ToolProperty(
name: 'location',
type: ToolPropertyType::String,
description: 'The city name',
required: true,
),
];
}
public function __invoke(string $location): mixed
{
// Call weather API and return result
return "The weather in {$location} is sunny, 72°F";
}
}
Use SystemPrompt for structured agent instructions:
new SystemPrompt(
background: [
"You are a data analyst expert in creating reports.",
],
steps: [
"Analyze the user's request",
"Query the database",
"Generate a summary",
],
output: [
"Always cite your sources",
"Never make up data",
]
)
Agents automatically maintain conversation history. For custom components:
use NeuronAI\History\FileChatHistory;
// In agent class
protected function chatHistory(): ChatHistoryInterface
{
return new FileChatHistory('/path/to/memory.json');
}
InMemoryChatHistory - Default, session-basedFileChatHistory - Persist to fileSQLChatHistory - Database-backedEloquentChatHistory - Laravel Eloquent integrationAgents support multiple content types:
use NeuronAI\Chat\Messages\ContentBlocks\TextContent;
use NeuronAI\Chat\Messages\ContentBlocks\ImageContent;
use NeuronAI\Chat\Enums\SourceType;
$message = new UserMessage([
new TextContent('Analyze this image:'),
new ImageContent(
content: 'https://example.com/image.jpg',
sourceType: SourceType::URL,
mediaType: 'image/jpeg'
),
]);
Use the Neuron CLI to generate an agent boilerplate:
vendor/bin/neuron make:agent MyCustomAgent
For human oversight of tool execution:
use NeuronAI\Agent\Middleware\ToolApproval;
use NeuronAI\Agent\Nodes\ChatNode;
use NeuronAI\Agent\Nodes\StreamNode;
use NeuronAI\Agent\Nodes\StructuredOutputNode;
// In agent constructor
$this->middleware([
ChatNode::class,
StreamNode::class,
StructuredOutputNode::class
], new ToolApproval());
Monitor agent execution:
# Set environment variable
INSPECTOR_INGESTION_KEY=your_key_here
Execute tools in parallel (requires pcntl):
$agent->parallelToolCalls(true);
When helping users build agents:
Choose execution mode based on requirements:
chat() for standard conversationsstream() for real-time streamingstructured() for data extractionAdd tools when the agent needs to:
Configure chat history when:
Use middleware for:
For Laravel projects:
namespace App\Neuron;
class MyAgent extends Agent { ... }
For Symfony projects:
development
Build custom Neuron AI workflows with nodes, events, middleware, and human-in-the-loop patterns. Use this skill whenever the user mentions workflows, orchestration, event-driven systems, custom agents, complex multi-step processes, human-in-the-loop patterns, or wants to build a custom agentic system from scratch. Also trigger for tasks involving node creation, event routing, workflow middleware, persistence, or interruption patterns.
tools
Create custom tools, toolkits, and MCP integrations for Neuron AI agents. Use this skill when the user mentions creating tools, building toolkits, extending Tool class, defining tool properties, implementing tool execution, MCP server integration, Model Context Protocol, connecting external tools, or tool guidelines. Also trigger for any task involving ToolProperty, ArrayProperty, ObjectProperty, AbstractToolkit, McpConnector, or StdioTransport/SseHttpTransport/StreamableHttpTransport.
tools
Write tests for Neuron AI agents, RAG systems, workflows, and tools using the built-in testing utilities. Use this skill when the user mentions testing agents, writing unit tests, mocking AI providers, testing tool execution, verifying RAG retrieval, testing workflow behavior, or creating test cases for Neuron AI components. Also trigger for any task involving PHPUnit tests, fake providers, test assertions, or quality assurance in Neuron AI projects.
data-ai
Design and implement structured output classes for Neuron AI agents using SchemaProperty attributes and validation rules. Use this skill when the user mentions structured output, JSON schema extraction, data validation, output classes, DTOs for AI responses, extracting structured data from LLM, or configuring property schemas. Also trigger for any task involving SchemaProperty attribute, validation rules like NotBlank/Email/Url, nested objects, arrays of objects, enums, polymorphic types with anyOf, or the Validator class.