lyre / ai-agents
Forward-only Agents/Bots orchestration on top of Laravel + OpenAI Responses API.
Installs: 22
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/lyre/ai-agents
Requires
- php: ^8.1
- illuminate/cache: ^10.0|^11.0
- illuminate/database: ^10.0|^11.0
- illuminate/events: ^10.0|^11.0
- illuminate/http: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
Suggests
- laravel/ai: Optional: install if you want to integrate package internals with Laravel AI facade APIs.
README
Forward-only Agents/Bots package using OpenAI Responses API with first-class Laravel orchestration.
Install
composer require lyre/ai-agents php artisan vendor:publish --tag=ai-agents-config php artisan vendor:publish --tag=ai-agents-migrations php artisan migrate
Quick start
use Lyre\AiAgents\Facades\Agents; Agents::registerTool([ 'name' => 'lookup_customer', 'type' => 'function', 'description' => 'Lookup customer by phone', 'parameters_schema' => [ 'type' => 'object', 'properties' => [ 'phone' => ['type' => 'string'], ], 'required' => ['phone'], ], 'handler' => fn (array $args) => ['customer' => ['phone' => $args['phone'], 'tier' => 'gold']], ]); $agent = Agents::registerAgent([ 'name' => 'support-bot', 'model' => 'gpt-4.1-mini', 'instructions' => 'You are a support specialist.', 'temperature' => 0.2, 'max_output_tokens' => 800, ]); $result = Agents::run($agent->id, 'Find customer with phone +254700111222', [ 'user_id' => auth()->id(), 'ip' => request()->ip(), ]);
Streaming
$stream = Agents::stream('support-bot', 'Explain invoice #INV-22'); foreach ($stream as $chunk) { echo $chunk; }
Events dispatched
Lyre\AiAgents\Events\AgentRunStartedLyre\AiAgents\Events\AgentToolCalledLyre\AiAgents\Events\AgentRunCompletedLyre\AiAgents\Events\AgentRunFailedLyre\AiAgents\Events\ConversationUpdatedLyre\AiAgents\Events\UsageRecorded
Local development
"repositories": [ { "type": "path", "url": "../packages/lyre-ai-agents-laravel", "options": { "symlink": true } } ]
Frontend safety
- Frontend should call your backend proxy route, not OpenAI directly.
- If direct OpenAI is needed, use short-lived scoped credentials in trusted environments only.
Table naming
By default, the package uses these tables: agents, agent_tools, conversations, conversation_messages, agent_runs, usage_logs, events.
You can set a global prefix for multi-project flexibility:
AI_AGENTS_TABLE_PREFIX=axis_
Or override individual table names:
AI_AGENTS_TABLE_CONVERSATIONS=axis_conversations AI_AGENTS_TABLE_CONVERSATION_MESSAGES=axis_conversation_messages