This directory contains examples of implementing agent patterns with Mellea, specifically the ReACT (Reasoning and Acting) pattern.
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
ReactToolandReactToolboxclasses 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.pyAn alternative implementation of the ReACT pattern using Mellea's instruct-validate-repair paradigm.
- Tool Management: Creating and organizing tools for agent use
- Dynamic Prompting: Building system prompts with tool descriptions
- Chat Context: Using
ChatContextfor multi-turn conversations - Structured Output: Using Pydantic models for type-safe responses
- Iterative Reasoning: Implementing thought-action-observation loops
- See
docs/dev/tool_calling.mdfor more on tool integration - See
mellea/stdlib/requirements/tool_reqs.pyfor tool requirements