{"id":21174644,"url":"https://github.com/llm-agents-php/sample-app","last_synced_at":"2025-07-09T21:30:59.529Z","repository":{"id":254736995,"uuid":"847395820","full_name":"llm-agents-php/sample-app","owner":"llm-agents-php","description":"This sample application demonstrates the practical implementation and usage patterns of the LLM Agents library.","archived":false,"fork":false,"pushed_at":"2024-09-07T10:48:37.000Z","size":203,"stargazers_count":14,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T07:11:48.473Z","etag":null,"topics":["chatgpt","chatgpt-tools","llm","llm-agents","llm-tool-call","llm-tools","php","spiral","spiral-framework"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/llm-agents-php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"butschster"}},"created_at":"2024-08-25T17:48:28.000Z","updated_at":"2024-11-13T07:48:08.000Z","dependencies_parsed_at":"2024-11-20T16:55:39.503Z","dependency_job_id":"2a35450a-fa15-4dc1-9870-4b5caff7019c","html_url":"https://github.com/llm-agents-php/sample-app","commit_stats":null,"previous_names":["llm-agents-php/sample-app"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/llm-agents-php/sample-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llm-agents-php%2Fsample-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llm-agents-php%2Fsample-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llm-agents-php%2Fsample-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llm-agents-php%2Fsample-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/llm-agents-php","download_url":"https://codeload.github.com/llm-agents-php/sample-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llm-agents-php%2Fsample-app/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264503949,"owners_count":23618762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","chatgpt-tools","llm","llm-agents","llm-tool-call","llm-tools","php","spiral","spiral-framework"],"created_at":"2024-11-20T16:55:31.913Z","updated_at":"2025-07-09T21:30:59.247Z","avatar_url":"https://github.com/llm-agents-php.png","language":"PHP","funding_links":["https://patreon.com/butschster"],"categories":[],"sub_categories":[],"readme":"# LLM Agents Sample App\n\nThis sample application demonstrates the practical implementation and usage patterns of the LLM Agents library.\n\n\u003e For more information about the LLM Agents package and its capabilities, please refer to\n\u003e the [LLM Agents documentation](https://github.com/llm-agents-php/agents).\n\nIt provides a CLI interface to interact with various AI agents, showcasing the power and flexibility of the LLM Agents\npackage.\n\n![image](https://github.com/user-attachments/assets/53104067-d3df-4983-8a59-435708f2b70c)\n\n## Features\n\n- Multiple pre-configured AI agents with different capabilities\n- CLI interface for easy interaction with agents\n- Integration with OpenAI's GPT models\n- Database support for session persistence\n\n## Prerequisites\n\n- PHP 8.3 or higher\n- Composer\n- Git\n- OpenAI API key\n\n## Quick Start with Docker\n\nThe easiest way to run the app is using our pre-built Docker image.\n\n**Follow these steps to get started:**\n\n1. Make sure you have Docker installed on your system.\n\n2. Run the Docker container with the following command:\n\n```bash\ndocker run --name chat-app -e OPENAI_KEY=\u003cyour_api_key\u003e ghcr.io/llm-agents-php/sample-app:1.0.0\n```\n\nor if you want to get environment variables from a file:\n\n```bash\ndocker run --name chat-app --env-file .env ghcr.io/llm-agents-php/sample-app:1.0.0\n```\n\nand `.env` file should look like this:\n\n```bash\nOPENAI_KEY=your_api_key_here\n```\n\n\u003e Replace `\u003cyour_api_key\u003e` with your OpenAI API key.\n\n3. Once the container is running, you can interact with the app using the following command:\n\n## Usage\n\n### Chatting with Agents\n\nTo start a chat session with an AI agent:\n\n1. Run the following command:\n\n**Using docker container**\n```bash\ndocker exec -it chat-app php app.php chat\n```\n\n**Using local installation**\n```bash\nphp app.php chat\n```\n\n2. You will see a list of available agents and their descriptions. Choose the desired agent by entering its number.\n\n![image](https://github.com/user-attachments/assets/3cd223a8-3ab0-4879-9e85-83539c93003f)\n\n3. After selecting an agent, you will see a message like this:\n\n![image](https://github.com/user-attachments/assets/0d18ca6c-9ee9-4942-b383-fc42abf18bc7)\n\n```bash\n************************************************************\n*     Run the following command to see the AI response     *\n************************************************************\n\nphp app.php chat:session \u003csession_uuid\u003e -v\n```\n\n**Using docker container**\n```bash\ndocker exec -it chat-app php app.php chat:session \u003csession_uuid\u003e -v\n````\n\u003e Replace `\u003csession_uuid\u003e` with the actual session UUID.\n\n\n4. Copy the provided command and run it in a new terminal tab. This command will show the AI response to your message.\n\n![image](https://github.com/user-attachments/assets/1dfdfdd1-f69d-44af-afb2-807f9fa2da84)\n\n## Available CLI Commands\n\nThe sample app provides several CLI commands for interacting with agents and managing the application:\n\n- `php app.php agent:list`: List all available agents\n- `php app.php tool:list`: List all available tools\n- `php app.php chat`: Start a new chat session\n- `php app.php chat:session \u003csession-id\u003e`: Continue an existing chat session\n- `php app.php migrate`: Execute database migrations\n\nUse the `-h` or `--help` option with any command to see more details about its usage.\n\n## Available Agents\n\nThe sample app comes with several pre-configured agents, each designed for specific tasks:\n\n### Site Status Checker\n\n- **Key**: `site_status_checker`\n- **Description**: This agent specializes in checking the online status of websites. It can verify if a given URL is\n  accessible, retrieve basic information about the site, and provide insights on potential issues if a site is\n  offline.\n- **Capabilities**:\n    - Check site availability\n    - Retrieve DNS information\n    - Perform ping tests\n    - Provide troubleshooting steps for offline sites\n\n### Order Assistant\n\n- **Key**: `order_assistant`\n- **Description**: This agent helps customers with order-related questions. It can retrieve order information, check\n  delivery status, and provide customer support for e-commerce related queries.\n- **Capabilities**:\n    - Retrieve order numbers\n    - Check delivery dates\n    - Access customer profiles\n    - Provide personalized assistance based on customer age and preferences\n\n### Smart Home Control Assistant\n\n- **Key**: `smart_home_control`\n- **Description**: This agent manages and controls various smart home devices across multiple rooms, including\n  lights, thermostats, and TVs.\n- **Capabilities**:\n    - List devices in specific rooms\n    - Control individual devices (turn on/off, adjust settings)\n    - Retrieve device status and details\n    - Suggest energy-efficient settings\n\n### Code Review Agent\n\n- **Key**: `code_review`\n- **Description**: This agent specializes in reviewing code. It can analyze code files, provide feedback, and\n  suggest improvements.\n- **Capabilities**:\n    - List files in a project\n    - Read file contents\n    - Perform code reviews\n    - Submit review comments\n\n### Task Splitter\n\n- **Key**: `task_splitter`\n- **Description**: This agent analyzes project descriptions and breaks them down into structured task lists with\n  subtasks.\n- **Capabilities**:\n    - Retrieve project descriptions\n    - Create hierarchical task structures\n    - Assign task priorities\n    - Generate detailed subtasks\n\n\n## Dev installation\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/llm-agents-php/sample-app.git\ncd sample-app\n```\n\n2. Install dependencies:\n\n```bash\ncomposer install\n```\n\n3. Set up the environment:\n\n```bash\ncp .env.sample .env\n```\n\nOpen the `.env` file and add your OpenAI API key:\n\n```bash\nOPENAI_KEY=your_api_key_here\n```\n\n4. Initialize the project:\n\n```bash\nmake init\n```\n\nThis command will download and set up all required binaries, including:\n\n- Dolt: A SQL database server\n- RoadRunner: A high-performance PHP application server\n\n### Starting the Server\n\nTo start the RoadRunner server and the Dolt database, run:\n\n```bash\n./rr serve\n```\n\n## Knowledge Base\n\nThis sample project includes a console command to generate a knowledge base, which can be useful for creating project\ndocumentation or training data for AI models like Claude.\n\n### Creating a Project in Claude\n\nFollow these steps to create a new project in Claude using the generated knowledge base:\n\n1. Create a New Project\n    - Go to the Claude interface (e.g., chat.openai.com for ChatGPT).\n    - Create a new project.\n\n2. Add Instructions from README below\n\n3. Upload Knowledge Base Files\n    - Locate the `./knowledge-base` directory on your local machine.\n    - Upload all files from this directory to Claude.\n    - Ensure all relevant PHP files, documentation, and any other project-related files are included.\n\n4. Test Your Project\n    - To test if everything is set up correctly, ask Claude to create a \"Weather Checker\" agent.\n    - Review the generated code and explanations provided by Claude.\n\n### Instructing an AI with\n\nOnce you've generated the knowledge base, you can use it to create new agent codebases or to provide context for\nAI-assisted development. Here's an example of how you might use the generated knowledge base to instruct an AI:\n\n```prompt\nCreate a new AI agent with the following specifications:\n\n1. Agent Name: [Provide a descriptive name for the agent]\n2. Agent Unique Key: [Provide a unique identifier for the agent, using lowercase letters, numbers, and underscores]\n3. Agent Description: [Provide a detailed description of the agent's purpose, capabilities, and use cases]\n4. Agent Instruction: [Provide a detailed instruction for the agent, explaining how it should behave, what its primary goals are, and any specific guidelines it should follow]\n5. Tools: List the tools that would be useful for this agent. For each tool, provide:\n   a. Tool Key: [A unique identifier for the tool]\n   b. Tool Description: [A concise yet comprehensive explanation of the tool's functionality]\n   c. Tool Input Schema: [Describe the input parameters for the tool in JSON format]\n\nExample Tool Format:\n{\n    \"key\": \"example_tool\",\n    \"description\": \"This tool performs X function, useful for Y scenarios. It takes A and B as inputs and returns Z.\",\n    \"input_schema\": {\n        \"type\": \"object\",\n        \"properties\": {\n            \"param1\": {\n                \"type\": \"string\",\n                \"description\": \"Description of param1\"\n            },\n            \"param2\": {\n                \"type\": \"integer\",\n                \"description\": \"Description of param2\"\n            }\n        },\n        \"required\": [\"param1\", \"param2\"]\n    }\n}\n\n6. Agent Memory: [List any specific information or guidelines that the agent should always keep in mind]\n7. Agent example prompts\n8. Always use gpt-4o-mini model as a bae model for the agent\n\nYour tasks:\n* Generate all necessary PHP classes for Agent\n\t* Agent\n\t* AgentFactory\n\t* All necessary tools\n\t* All necessary Tool input shemas\n- You use PHP 8.3 with Constructor property promotion, named arguments, and do not use annotations.\n```\n\nBy providing such instructions along with the generated knowledge base, you can guide AI models like Claude to create\nnew components that align with your project's structure and coding standards.\n\n### Generating the Knowledge Base\n\nTo generate the knowledge base, run the following command:\n\n```bash\nphp app.php kb:generate\n```\n\nThis command will create a knowledge base in the `./knowledge-base` directory. The generated knowledge base contains\ndocumentation and codebase examples that can be used, for instance, to create a project for Claude AI.\n\n### Extending the Knowledge Base\n\nAs your project grows, you may want to update the knowledge base to include new features, agents, or tools. Simply run\nthe `kb:generate` command again to refresh the knowledge base with the latest changes in your project.\n\nThis approach allows for an iterative development process where you can continuously improve and expand your agent\necosystem, leveraging both human expertise and AI assistance.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis sample app is open-source software licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllm-agents-php%2Fsample-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllm-agents-php%2Fsample-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllm-agents-php%2Fsample-app/lists"}