Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.41 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.41 KB

Agent Examples

This directory contains examples of implementing agent patterns with Mellea, specifically the ReACT (Reasoning and Acting) pattern.

Files

A complete implementation of the ReACT agent pattern that combines reasoning and action in an iterative loop. The agent:

  • Thinks about what to do next
  • Selects an appropriate tool/action
  • Generates arguments for the tool
  • Observes the result
  • Determines if the goal is achieved

Key Features:

  • Custom ReactTool and ReactToolbox classes for tool management
  • Dynamic tool selection using Pydantic schemas
  • Iterative thought-action-observation loop
  • Example with weather lookup tools

Usage:

python docs/examples/agents/react/react_from_scratch/react.py

An alternative implementation of the ReACT pattern using Mellea's instruct-validate-repair paradigm.

Concepts Demonstrated

  • Tool Management: Creating and organizing tools for agent use
  • Dynamic Prompting: Building system prompts with tool descriptions
  • Chat Context: Using ChatContext for multi-turn conversations
  • Structured Output: Using Pydantic models for type-safe responses
  • Iterative Reasoning: Implementing thought-action-observation loops

Related Documentation

  • See mellea/stdlib/requirements/tool_reqs.py for tool requirements