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

I built a PHP AI agent library with zero dependencies - here's the code

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

NanoAgent – это PHP‑библиотека, позволяющая создавать агенты LLM без сторонних языков и зависимостей, используя один Composer‑пакет и конфигурацию массива.

Задача

Adding an LLM agent to a PHP application typically requires a Python microservice, leading to extra runtimes, deployments, and network hops.

Результат

NanoAgent enables in-process PHP agents with tool-first design, persistent memory, and support for multiple LLM providers, all without external runtimes.

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

  • Install NanoAgent via Composer: composer require hammrouni/nanoagent
  • Instantiate an Agent with LLM configuration: new Agent(llm: ['provider'=>'groq','model'=>'llama-3.3-70b-versatile','api_key'=>getenv('GROQ_API_KEY')])
  • Register a PHP function as a tool: $agent->tool('weather', fn(string $city)=>"It is 22°C in {$city}.")
  • Invoke the agent: $agent->chat('How warm is it in Marrakech?')

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

If you've tried to add an LLM agent to a PHP application, you've probably hit the same wall: every serious library is Python.

Источник

I built NanoAgent: a PHP library that does agents natively. One composer require. Zero runtime dependencies. No Python.

Источник

One config array, any provider. OpenAI, Groq, Anthropic, DeepSeek, OpenRouter or a local model behind any OpenAI-compatible endpoint (Ollama, llama.cpp server). Swap with one line.

Источник

Tool-first. You map plain PHP functions as tools. Your agent can query your database, hit your internal APIs, read your device telemetry the code you already wrote.

Источник

Persistent memory. Conversations survive across requests via pluggable drivers: JSON files, SQLite, MySQL, PostgreSQL or your own.

Источник

The agent decides to call weather, your function runs in-process, the result comes back, and the reply is generated. No sidecar, no queue, no second language.

Источник

  • Дата записи: 2026-10-15T20:55:56.488Z