token27/nexus-ai-agents 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

token27/nexus-ai-agents

最新稳定版本:v1.0.0

Composer 安装命令:

composer require token27/nexus-ai-agents

包简介

Autonomous AI agent framework — planning, reflection, memory, tools, and multi-agent coordination built on NexusAI Workflows. Framework-agnostic, PSR-only, PHP 8.2+.

README 文档

README

CI Latest Version PHP 8.2+ License: MIT

An autonomous agent framework for PHP 8.2+. Implements the Plan → Execute → Reflect loop with LLM-powered planning, workflow-based execution, and adaptive reflection. Built on NexusAI and NexusAI Workflows.

Features

  • Autonomous agent loop — Plan → Execute → Reflect with configurable strategies
  • 3 planning strategies — ReAct, Chain-of-Thought, Plan-and-Execute — all LLM-powered with static fallbacks
  • WorkflowRunner integration — each plan step executes as a workflow via StepMapper + WorkflowExecutor
  • LLM Reflection — dynamic decision-making: Continue, Finish, Replan, Retry, AskUser, Abort
  • AgentBuilder — fluent chainable API with auto-wiring of components
  • Multi-agent orchestration — OrchestratorAgent, AgentTeam, Handoff, MessageBus
  • Memory system — Working, Episodic, and Semantic memory with MemoryManager
  • Middleware pipeline — BudgetGuard, MemoryInjection, Planning middleware
  • Budget & step limits — configurable guardrails to prevent runaway agents
  • Observability — 6 typed Event DTOs (AgentStarted, AgentStep, AgentReflection, AgentCompleted, AgentFailed, AgentToolCall)
  • FakeAgent — deterministic test doubles with assertion helpers

Installation

composer require token27/nexus-ai-agents

Quick Start

Using AgentBuilder (recommended)

use Token27\NexusAI\Agents\AgentBuilder;
use Token27\NexusAI\Agents\Enum\PlanningStrategy;

$agent = AgentBuilder::named('researcher')
    ->withDescription('AI research assistant')
    ->withProvider('openai', 'gpt-4o')
    ->withStrategy(PlanningStrategy::ReAct)
    ->withDriver($driver)
    ->withWorkflowRunner($runner)
    ->withBudget(1.00)
    ->withMaxSteps(20)
    ->build();

$result = $agent->run('What are the latest trends in PHP?');

echo $result->output;       // Final answer
echo $result->totalSteps;   // Steps executed
echo $result->totalCost;    // Cost in USD

Minimal (no LLM, static planning)

$agent = AgentBuilder::named('simple')
    ->withStrategy(PlanningStrategy::ChainOfThought)
    ->build();

$result = $agent->run('Analyze this problem');

Architecture

AgentBuilder::named('agent')
    ->withDriver($driver)           ← LLM for planning + reflection
    ->withWorkflowRunner($runner)   ← Workflow engine for execution
    ->build()

Agent::run(input)
    ├── Planner::plan(input, ctx)          ← LLM generates Plan with steps
    │   └── ReAct | CoT | PlanAndExecute
    │
    ├── WorkflowExecutor::execute(step)    ← Each step runs as a workflow
    │   └── StepMapper → WorkflowBuilder → WorkflowRunner
    │
    └── LLMReflector::reflect(ctx, output) ← LLM evaluates results
        └── Continue | Finish | Replan | Retry | Abort

Documentation

Full documentation is available in the docs/ directory:

Requirements

License

MIT. Please see LICENSE for more information.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 29
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固