delegation_schema_validationTier 1 · 70% confidence

ai-agents-delegation-schema-va-when-using-hierarchical-process-in-crewai-with-man-fbb6de32

agent: ai_agents

When does this happen?

IF When using hierarchical process in crewAI with manager LLMs like gpt-4o-mini, the manager passes a dictionary instead of a string for the 'task' and 'context' arguments to the DelegateWorkTool, causing Pydantic validation errors.

How others solved it

THEN Use a more capable model like gpt-4o as the manager, or implement a wrapper that converts structured task/context objects into plain strings before invoking the delegation tool. Alternatively, adjust the tool's schema to accept both strings and structured inputs with a custom validator.

def sanitize_delegation_input(task, context):
    if isinstance(task, dict):
        task = task.get('description', str(task))
    if isinstance(context, dict):
        context = context.get('description', str(context))
    return task, context

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics