Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
20.94k stars 1.93k forks source link

SDK not that good #2052

Open YbalaKing opened 1 week ago

YbalaKing commented 1 week ago

Hi, I really love your tool—I'm using it, and I think it's great. However, when I try to wrap it in Python, it's not as easy as I expected. While the documentation shows how to use coder.run() for simple tasks, which is great, I'd like to leverage more advanced features of Aider, like /ask, /architect, etc.

When I attempt to use these commands within coder.run("/ask"), the command runs, but I encounter a SwitchCoder exception. I understand that this exception signals when to switch between coders, but it results in an error, and it's not clear how to handle this in the Python environment.

Another issue arises when I try to give Aider a task that involves an MP3 file. It drops the file from the chat due to an encoding issue:


/Users/yuvalbalak/Desktop/Dev/agents/backend/playables-source-code/eatventure/assets/audio/country_background_music.mp3: 'utf-8' codec can't decode byte 0xff in position 45: invalid start byte Use --encoding to set the unicode encoding. Dropping assets/audio/country_background_music.mp3 from the chat.


This happens when I use coder.run(). It seems there is a difference in behavior between using Aider in chat mode and through Python scripting.

Suggested Improvements Handle SwitchCoder Exception: It would be helpful to have clearer documentation or functionality to handle the SwitchCoder exception when using advanced commands like /ask and /architect in Python scripts.

Support for File Types: Enhance the SDK to handle non-text files like MP3s, or at least provide better guidance on how to manage these files when they are part of a task.

Documentation: It would be amazing if you could expand the SDK documentation to include examples and use cases for these advanced features, making it easier to utilize Aider's full range of capabilities in Python scripts.

Thanks a lot for the great tool!

paul-gauthier commented 4 days ago

Thanks for trying aider and filing this issue.

Aider is primarily an interactive tool. It can be scripted, but doesn't currently offer a fully featured or documented API for this.

lee-b commented 4 days ago

Worth noting that you can just write a bash script, or from aider.main import main and call it with the same arguments that you would have on the command line. You can quite easily script it to do agentic workflows with multiple steps and agents, for example.