Skip to content

respect_context_window parameter not being read from agent configuration #28

@nehmetohmedb

Description

@nehmetohmedb

Bug Description

The respect_context_window parameter is not being properly read from the agent configuration when creating CrewAI agents. Instead, it's hardcoded to True.

Current Behavior

In src/backend/src/engines/crewai/helpers/agent_helpers.py (line 514), the parameter is hardcoded:

'respect_context_window': True,

Expected Behavior

The parameter should be read from the agent configuration:

'respect_context_window': agent_config.get('respect_context_window', True),

Impact

  • Users can set the respect_context_window value in the UI
  • The value is saved to the database
  • However, the CrewAI agent always uses True regardless of the saved setting

Additional Issue

The respect_context_window parameter is also missing from the additional_params list (lines 518-522), which may prevent it from being properly handled even if read from the config.

Files Affected

  • src/backend/src/engines/crewai/helpers/agent_helpers.py

Suggested Fix

  1. Change line 514 to read from agent_config
  2. Add 'respect_context_window' to the additional_params list

Context

The parameter is properly implemented in:

  • Database model (src/backend/src/models/agent.py:58)
  • Pydantic schemas with default value of True
  • Frontend TypeScript types (src/frontend/src/types/agent.ts:78)
  • Frontend forms allow configuration

But the actual usage in the CrewAI engine ignores the configured value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions