PHPackages                             utopia-php/agents - 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. utopia-php/agents

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

utopia-php/agents
=================

A simple PHP AI agents library

2.1.0(1w ago)995.9k↓17.9%2[2 PRs](https://github.com/utopia-php/agents/pulls)1MITPHPPHP &gt;=8.3

Since Mar 28Pushed 1w ago6 watchersCompare

[ Source](https://github.com/utopia-php/agents)[ Packagist](https://packagist.org/packages/utopia-php/agents)[ RSS](/packages/utopia-php-agents/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (16)Versions (50)Used By (1)

Utopia Agents
=============

[](#utopia-agents)

[![Build Status](https://camo.githubusercontent.com/1f0061ea6d75f7cd670017b8e240542d2fe7e9cd400a6536d659872d469e6123/68747470733a2f2f7472617669732d63692e6f72672f75746f7069612d7068702f6167656e74732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/utopia-php/agents)[![Total Downloads](https://camo.githubusercontent.com/d6d7b1f87c0bdf1f5439b8bc841cb8d7b4ecc0672575caf67eb8060d6299b020/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f75746f7069612d7068702f6167656e74732e737667)](https://camo.githubusercontent.com/d6d7b1f87c0bdf1f5439b8bc841cb8d7b4ecc0672575caf67eb8060d6299b020/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f75746f7069612d7068702f6167656e74732e737667)[![Discord](https://camo.githubusercontent.com/6e418910df1b6eb524c6cbd88dbaf5a5aa294316eeadcd963e11262a319f6321/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f3536343136303733303834353135313234343f6c6162656c3d646973636f7264)](https://appwrite.io/discord)

Utopia Agents is a simple and lite library for building and managing AI agents in PHP applications. This library provides a collection of tools and utilities for creating, managing, and orchestrating AI agents with support for multiple AI providers. This library is maintained by the [Appwrite team](https://appwrite.io).

Although this library is part of the [Utopia Framework](https://github.com/utopia-php/framework) project it is dependency free and can be used as standalone with any other PHP project or framework.

Getting Started
---------------

[](#getting-started)

Install using composer:

```
composer require utopia-php/agents
```

System Requirements
-------------------

[](#system-requirements)

Utopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.

Features
--------

[](#features)

- **Multiple AI Providers** - Support for OpenAI, Anthropic, Deepseek, Perplexity, XAI, Gemini, and OpenRouter APIs
- **Flexible Message Types** - Support for text and structured content in messages
- **Message Attachments** - Attach files (for example images) directly to conversation turns
- **Conversation Management** - Easy-to-use conversation handling between agents and users
- **Model Selection** - Choose from various AI models (GPT-4, Claude 3, Deepseek Chat, Sonar, Grok, etc.)
- **Parameter Control** - Fine-tune model behavior with temperature and token controls
- **Streaming Output** - Consume incremental model output through callback-driven Server-Sent Events (SSE) streams

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

```
