DocumentationNeuronAgent Documentation
Documentation Branch: You are viewing documentation for the main branch (3.0.0-devel). Select a branch to view its documentation:

Planning & Reflection

Overview

The planning and reflection system enables agents to create intelligent plans for complex tasks, decompose them into manageable sub-tasks, and reflect on their execution to improve future performance.

Key Features

  • LLM-Based Planning: Advanced planning with LLM-powered task decomposition
  • Task Decomposition: Automatic breakdown of complex tasks into manageable sub-tasks
  • Task Plans: Multi-step plan creation, validation, and execution
  • Plan Templates: Reusable plan templates for common task patterns
  • Async Tasks: Background task execution with PostgreSQL-based job queue
  • Task Prioritization: Priority-based task scheduling and execution
  • Agent Reflection: Agent self-reflection and quality assessment

LLM-Based Planning

LLM-based planning uses large language models to generate intelligent plans for complex tasks, taking into account context, constraints, and available resources.

Planning Process

The planning process involves analyzing the task, identifying required steps, determining dependencies, and creating an executable plan.

Plan Validation

Generated plans are validated for feasibility, completeness, and correctness before execution.

Task Decomposition

Complex tasks are automatically decomposed into manageable sub-tasks with clear dependencies and execution order.

Decomposition Strategies

  • Hierarchical Decomposition: Break tasks into hierarchical sub-tasks
  • Sequential Decomposition: Decompose into sequential steps
  • Parallel Decomposition: Identify parallelizable sub-tasks

Dependency Tracking

Task dependencies are automatically identified and tracked, ensuring correct execution order.

Plan Templates

Plan templates provide reusable patterns for common task types, enabling faster plan creation and consistency across similar tasks.

Template Types

  • Domain Templates: Templates for specific domains (e.g., data analysis, content creation)
  • Pattern Templates: Templates for common patterns (e.g., ETL, API integration)
  • Custom Templates: User-defined templates for specific use cases

Template Customization

Templates can be customized with parameters, enabling flexible plan generation while maintaining structure and best practices.

Async Tasks

Async tasks enable background execution of long-running operations, improving agent responsiveness and enabling parallel task execution.

Task Queue

Tasks are queued in PostgreSQL using SKIP LOCKED for efficient concurrent processing.

Task Monitoring

Async tasks are monitored for status, progress, and completion, with notifications for task events.

Agent Reflection

Agent reflection enables agents to analyze their own performance, identify areas for improvement, and adapt their behavior based on past experiences.

Reflection Process

Agents reflect on their execution by analyzing outcomes, identifying successes and failures, and generating insights for future improvements.

Quality Assessment

Reflection includes quality assessment using multiple metrics, providing comprehensive performance evaluation.

API Reference

Planning and reflection are accessible through the NeuronAgent REST API for creating, managing, and executing plans.

Planning Endpoints

  • POST /api/v1/plans - Create a plan
  • GET /api/v1/plans - List plans
  • POST /api/v1/plans/:id/execute - Execute a plan
  • POST /api/v1/plans/:id/reflect - Trigger agent reflection
  • GET /api/v1/tasks - List tasks
  • POST /api/v1/tasks - Create an async task