Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

AI agents in Laravel with Laragents

Описание и применение

Laragents упрощает интеграцию ИИ‑агентов в Laravel, обеспечивая цикл вызовов инструментов, управление контекстом, памятью и правилами.

Задача

Integrating AI agents into Laravel applications requires handling tool loops, context management, memory, and rules beyond simple model calls.

Результат

Laragents streamlines AI agent integration in Laravel, reducing boilerplate, preventing infinite loops, managing context efficiently, and persisting memory and rules across sessions.

Рабочий процесс

  • Install Laragents via Composer and publish config/migrations
  • Define domain tools by extending the Tool class and implementing name, description, schema, and execute
  • Configure the loop with model, session, context, and tool registry
  • Run the loop to handle tool calls and generate responses
  • Implement context compression to keep conversation within token limits
  • Persist memory in a queued job after compression or on scheduled sweep
  • Read memory and rules into the prompt before each model call
  • Handle empty‑streaks and iteration caps to avoid infinite loops

Доказательства

I wrote all of that twice, in two applications, and the second time I extracted it. It is called laragents.

Источник

Two things in there are not obvious until they cost you something.

The third one reads like access control and is not.

  • Дата записи: 2026-09-05T16:33:02.907Z