Skip to content

Integrate convert_to_markdown() utility in Agents before invoking LLM #17

@bedead

Description

@bedead

Now that we have the convert_to_markdown(data) utility function available,
we need to integrate it into the Agent pipeline so that all data passed to the LLM is automatically formatted into Markdown.

Currently, agents (especially ChatbotAgent and MailProcessingAgent) send raw data or JSON-like structures to the LLM.
This often leads to:

  • Messy or inconsistent prompt structures
  • Reduced model comprehension and formatting errors in output
  • Increased token usage due to redundant or unstructured input

By applying convert_to_markdown() right before the LLM call, we can ensure:

  • Cleaner and more structured prompts
  • Consistent formatting across all agent interactions
  • Improved model interpretability and cost efficiency

✅ Tasks / Acceptance Criteria:

  • - Import and use convert_to_markdown() in all agent classes that prepare input for the LLM (e.g., chatbot_agent.py, email_agent.py, etc.)
  • - Apply the conversion step right before invoking the LLM’s generate() / run() / invoke() methods
  • - Ensure no double-conversion (skip if already Markdown)
  • - Add debug logs to confirm data is successfully converted before sending
  • - Test LLM outputs before and after integration to verify improvement in formatting and response quality
  • - Update related documentation or agent comments

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions