Skip to content

API Reference parrot_tools.think

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.think

View source

ThinkTool - A metacognitive tool for explicit agent reasoning.

This tool implements the "Thinking as a Tool" pattern, a simplified version of the ReAct (Reasoning + Acting) paradigm. By converting the agent's internal reasoning into an explicit, observable action, it forces Chain-of-Thought reasoning and improves decision-making quality.

Key benefits:

  • Forces explicit reasoning before complex actions
  • Makes the decision-making process observable and auditable
  • Prevents impulsive actions by requiring deliberation
  • Improves response quality through structured thinking

Alias AbstractTool

Re-exported from parrot_tools.abstract.AbstractTool.

Alias AbstractToolArgsSchema

Re-exported from parrot_tools.abstract.AbstractToolArgsSchema.

Class DataAnalysisThinkTool

Specialized thinking tool for data analysis tasks.

Guides the agent to consider data quality, transformations, and analysis strategy before executing data operations.

Attributes:

Attribute Type Description
name str
description str

Class QueryPlanTool

Specialized thinking tool for database query planning.

Guides the agent to consider query optimization, table relationships, and potential performance issues.

Attributes:

Attribute Type Description
name str
description str

Class RAGRetrievalThinkTool

Specialized thinking tool for RAG retrieval strategy.

Guides the agent to plan retrieval approach based on query type, expected document relevance, and retrieval method selection.

Particularly useful for Adaptive Agentic RAG implementations.

Attributes:

Attribute Type Description
name str
description str

Class ScrapingPlanTool

Specialized thinking tool for web scraping tasks.

Guides the agent to plan scraping strategy considering page structure, anti-bot measures, and selector reliability.

Attributes:

Attribute Type Description
name str
description str

Class ThinkInput

Input schema for the ThinkTool.

The thoughts field captures the agent's reasoning process, including:

  • Problem analysis and clarification
  • Assumptions being made
  • Planned approach or strategy
  • Potential issues or edge cases to consider

Note: A 'next_step' field was intentionally omitted as it tends to cause hallucinations and rigid behavior in practice.

Attributes:

Attribute Type Description
thoughts str

Class ThinkTool

A metacognitive tool that forces explicit reasoning before action.

This tool implements the "Thinking as a Tool" pattern, which converts the agent's internal reasoning into an observable, recorded action. The primary value is in the process (forcing deliberation) rather than the output.

Use cases:

  • Complex multi-step tasks requiring careful planning
  • Debugging agent decision-making processes
  • Improving response quality through deliberate thinking
  • Auditing and understanding agent reasoning

When NOT to use:

  • Simple, straightforward tasks where it adds unnecessary latency
  • When using LLM's native extended_thinking (would be redundant)
  • Highly structured workflows with predetermined reasoning
Parameter Type Default Description
name Optional[str] None Custom tool name (default: "think")
description Optional[str] None Custom description (appends extra_context if provided)
extra_context str '' Additional instructions appended to the description. Useful for domain-specific thinking guidance.
output_handler Optional[Union[str, Callable[[ThinkInput], str]]] None Either a static string response or a callable that receives ThinkInput and returns a string. The callable can be used for logging, metrics, or custom processing.
**kwargs {} Additional arguments passed to AbstractTool

Attributes:

Attribute Type Description
name str Tool identifier ("think" by default)
description str Tool description for the LLM
args_schema Type[AbstractToolArgsSchema] Pydantic model for input validation (ThinkInput)

Alias ToolResult

Re-exported from parrot_tools.abstract.ToolResult.

Function create_think_tool

Factory function to create domain-specific ThinkTool instances.

create_think_tool(domain: Optional[str] = None, name: Optional[str] = None, extra_context: str = '', output_handler: Optional[Union[str, Callable[[ThinkInput], str]]] = None) -> ThinkTool

Parameter Type Default Description
domain Optional[str] None Predefined domain ('data', 'scraping', 'query', 'rag') or None for generic ThinkTool
name Optional[str] None Custom tool name (overrides domain default)
extra_context str '' Additional context appended to description
output_handler Optional[Union[str, Callable[[ThinkInput], str]]] None Custom output handler

Returns: ThinkTool — Configured ThinkTool instance

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally