Extending Archon with Docling Documentation: Implementation Challenges

Thanks for creating Archon! I’ve successfully forked and deployed the project using Docker. I’m trying to add Docling documentation alongside Pydantic AI docs but facing some challenges.

Implementation Approach

  1. Custom Module Architecture
  • Created bg_modules directory for custom implementations
  • Modified archon/__init__.py with a custom module finder that prioritizes these modules
  • Added crawl_docling_docs.py and customized pydantic_ai_coder.py
  1. Documentation Storage
  • Extended Supabase with source field to differentiate documentation origins
  • Successfully crawling and storing Docling docs

Current Issue

While the UI shows both documentation sources correctly, the agent can’t seem to access the Docling documentation when asked. I’ve tried:

  1. Overriding the documentation retrieval functions in pydantic_ai_coder.py
  2. Using function interception by replacing the agent’s execute method
  3. Direct modification of module imports

However, I keep running into circular import issues or the agent simply using the original retrieval functions.

Questions

What’s the recommended approach for extending agent functionality to use additional documentation sources? Are there specific extension points I should be using instead of trying to override functions?

Any guidance would be appreciated!

2 Likes

You are very welcome! I appreciate you working on adding another documentation source as well!

I will be working on this more for one of the upcoming versions so I’ll have a lot more thoughts to share on this then.

But you’ll want to use the “source” metadata field and set that to docling like I currently set it to pydantic_ai_docs in my crawler script. Then for the RAG tool, you can either create a separate one for just Docling that will use this metadata value you set, or extend the existing RAG function to allow the LLM to choose the metadata value for “source” through a function parameter. I hope that makes sense!

1 Like