PHPackages                             agentphp/sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. agentphp/sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

agentphp/sdk
============

A comprehensive PHP SDK for building AI conversational agents with support for multiple LLM providers (OpenAI, Anthropic, Google), tools, streaming, and human-in-the-loop workflows

v2.0.0(4mo ago)03MITPHPPHP &gt;=8.1CI passing

Since Dec 19Pushed 4mo agoCompare

[ Source](https://github.com/petersonsenadevs/agent-suite-php)[ Packagist](https://packagist.org/packages/agentphp/sdk)[ Docs](https://github.com/agentphp/sdk)[ RSS](/packages/agentphp-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (11)Versions (11)Used By (0)

AgentPHP SDK
============

[](#agentphp-sdk)

[![CI](https://github.com/agentphp/sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/agentphp/sdk/actions/workflows/ci.yml)[![Latest Stable Version](https://camo.githubusercontent.com/f922cdbebeb11de387c30e8c872d8842a2fa9fc59729ac9777eb50620be3ff63/68747470733a2f2f706f7365722e707567782e6f72672f6167656e747068702f73646b2f762f737461626c65)](https://packagist.org/packages/agentphp/sdk)[![Total Downloads](https://camo.githubusercontent.com/0633bcbd150e276f29424b92719538f87e396de1cc961c70453720787df94ddf/68747470733a2f2f706f7365722e707567782e6f72672f6167656e747068702f73646b2f646f776e6c6f616473)](https://packagist.org/packages/agentphp/sdk)[![License](https://camo.githubusercontent.com/8923e0803d3b350d54a4b16257ed23f525ca75b7372e84c0b78138b521a3e83d/68747470733a2f2f706f7365722e707567782e6f72672f6167656e747068702f73646b2f6c6963656e7365)](https://packagist.org/packages/agentphp/sdk)[![PHP Version](https://camo.githubusercontent.com/51db49c5957db77fa7d0300d79c535544df61babdde8b093e6b6ef2ffccaf572/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6167656e747068702f73646b)](https://packagist.org/packages/agentphp/sdk)

A comprehensive PHP SDK for building AI conversational agents with support for multiple LLM providers (OpenAI, Anthropic, Google), tools, streaming, and human-in-the-loop workflows.

Features
--------

[](#features)

- **Multiple LLM Providers**: OpenAI (GPT-4), Anthropic (Claude), Google (Gemini)
- **Tool System**: Define and execute custom tools with automatic validation
- **Streaming**: Real-time token streaming for responsive UIs
- **Middleware Pipeline**: Logging, retry, rate limiting, caching
- **Memory Management**: Conversation and sliding window memory
- **Human-in-the-Loop**: Approval workflows for sensitive operations
- **Framework Integration**: Laravel and Symfony support

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- Composer
- Guzzle HTTP client

Installation
------------

[](#installation)

```
composer require agentphp/sdk
```

Quick Start
-----------

[](#quick-start)

```
use AgentPHP\Core\AgentBuilder;

$agent = AgentBuilder::create()
    ->withOpenAI('your-api-key')
    ->withSystemPrompt('You are a helpful assistant.')
    ->build();

$response = $agent->chat('Hello, how are you?');
echo $response->getContent();
```

Table of Contents
-----------------

[](#table-of-contents)

- [Standalone Usage (Legacy PHP)](#standalone-usage-legacy-php)
- [Laravel Integration](#laravel-integration)
- [Symfony Integration](#symfony-integration)
- [Providers](#providers)
- [System Prompts](#system-prompts)
- [Tools](#tools)
- [Streaming](#streaming)
- [Middleware](#middleware)
- [Human-in-the-Loop](#human-in-the-loop)
- [Error Handling](#error-handling)

---

Standalone Usage (Legacy PHP)
-----------------------------

[](#standalone-usage-legacy-php)

### Basic Chat

[](#basic-chat)

```
