Skip to content

Conversation

@Tanuj-Taneja1
Copy link
Collaborator

@Tanuj-Taneja1 Tanuj-Taneja1 commented Nov 14, 2025

Description

Fixes #3201
Hi @Wendong-Fan
I have completed the mail actions part of Outlook toolkit and this pr is ready to review.
Also I wanted to split other outlook related actions (like calender) into seperate file, so if that is ok we can rename this file to something mail related.

Reference:
msgraph
msgraph (some docs like send mail are in users section for some reason)
authorizationcodecredential for auth

(This is a edited conversation, older conversation was draft related)

 Created _create_message function to compose emails with Graph APIh

Added send mail function
…tionality

Removed content_bytes from filter query as Microsoft uses queries on base attachment file which does have content_bytes and is specific to fileattachments

Also fixed some mypy type issues
- Improved email validation logic and reduced bloated code

- Add _create_recipients() to allow both 'email' and 'Name <email>' formats

- Switched BeautifulSoup to html2text

- Rename 'id' to 'message_id'

- Add server_close()

- Add dependency to  pyproject.toml

Fixed some docstring
@Tanuj-Taneja1 Tanuj-Taneja1 self-assigned this Nov 14, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/outlook-toolkit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the Review Required PR need to be reviewed label Nov 14, 2025
@Tanuj-Taneja1 Tanuj-Taneja1 changed the title Feat/outlook toolkit [Feat] Add Microsoft Outlook - Mail Actions Nov 15, 2025
Tanuj-Taneja1 and others added 5 commits November 15, 2025 07:51
Add fixtures and tests covering send_email, create_draft_email, and send_draft_email with success, failure, and validation scenarios.
…tachments methods covering success, failure, and edge cases including metadata-only retrieval and file saving functionality.
@Tanuj-Taneja1
Copy link
Collaborator Author

Hi @Wendong-Fan
Sorry to bother you but i was getting some error during setup env in the above tests
Is this related to me pushing uv.lock or in general ( I didnt see anyone else getting this error)

Run source .venv/bin/activate
  × No solution found when resolving dependencies:
  ╰─▶ Because fish-audio-sdk==2024.12.5 was yanked (reason: Break Change) and
      only the following versions of fish-audio-sdk are available:
          fish-audio-sdk<=2024.12.5
          fish-audio-sdk>2025
      we can conclude that fish-audio-sdk>=2024.12.5,<2025 cannot be used.
      And because camel-ai[all]==0.2.79 depends on
      fish-audio-sdk>=2024.12.5,<2025, we can conclude that
      camel-ai[all]==0.2.79 cannot be used.
      And because only camel-ai[all]==0.2.79 is available and you require
      camel-ai[all], we can conclude that your requirements are unsatisfiable.

@Tanuj-Taneja1 Tanuj-Taneja1 marked this pull request as ready for review November 17, 2025 13:59
@Tanuj-Taneja1
Copy link
Collaborator Author

Hi @Wendong-Fan Sorry to bother you but i was getting some error during setup env in the above tests Is this related to me pushing uv.lock or in general ( I didnt see anyone else getting this error)

Run source .venv/bin/activate
  × No solution found when resolving dependencies:
  ╰─▶ Because fish-audio-sdk==2024.12.5 was yanked (reason: Break Change) and
      only the following versions of fish-audio-sdk are available:
          fish-audio-sdk<=2024.12.5
          fish-audio-sdk>2025
      we can conclude that fish-audio-sdk>=2024.12.5,<2025 cannot be used.
      And because camel-ai[all]==0.2.79 depends on
      fish-audio-sdk>=2024.12.5,<2025, we can conclude that
      camel-ai[all]==0.2.79 cannot be used.
      And because only camel-ai[all]==0.2.79 is available and you require
      camel-ai[all], we can conclude that your requirements are unsatisfiable.

Regarding this issue, I think this is unrelated to my pr and the reason I am getting this is because i pushed uv lock file due to which we tied creating new environment instead of one in cache

@Tanuj-Taneja1
Copy link
Collaborator Author

I have added the remaining tests and function
For now I have kept the reply_to_email and update_draft_message simple without attachment handling since their api dont support it directly.
I will be adding attachment post method in a seperate pr later and will update this code then

Also I choose update_draft_message instead of update_message as updating sent message only changes data on our side like changing cc recipients wont send them mail again, so it wouldnt be very helpful for a llm toolkit in my opinion or even in general other than faking a sent mail.

I have completed the mail part of actions for now but feel free to let me know if there are any suggestions or change either regarding this pr or in general that might help me.

Thanks
Will be working on calender part of toolkit in few days

@Tanuj-Taneja1
Copy link
Collaborator Author

Also to make reviewers life easier
Here is how you setup things at azure

1 Go to https://portal.azure.com/
2 Search for microsoft Entra ID and open it
3 Click on add button in horizontal menu and click app registeration
4 add name, supported account type and redirect uri (should be set to http://localhost:1000) and platform as web - this page should have client id
5 On the next page there should be a link for 'Add a certificate or secret' click on it then add a new secret , then copy the Value (Client secret) dont use Secret ID

Thats it
Now you just have to add the user that you want to sign in as
Go back to default directory overview page and add the user of your choice. For personal account select add external account

Now just add these creds to env (for personal account dont add tenant id or if you want add "common" ) and the code should work

Later we should also add all this to example file ( I didnt create it since i dont have open ai credits)

@waleedalzarooni
Copy link
Collaborator

Hi @Wendong-Fan Sorry to bother you but i was getting some error during setup env in the above tests Is this related to me pushing uv.lock or in general ( I didnt see anyone else getting this error)

Run source .venv/bin/activate
  × No solution found when resolving dependencies:
  ╰─▶ Because fish-audio-sdk==2024.12.5 was yanked (reason: Break Change) and
      only the following versions of fish-audio-sdk are available:
          fish-audio-sdk<=2024.12.5
          fish-audio-sdk>2025
      we can conclude that fish-audio-sdk>=2024.12.5,<2025 cannot be used.
      And because camel-ai[all]==0.2.79 depends on
      fish-audio-sdk>=2024.12.5,<2025, we can conclude that
      camel-ai[all]==0.2.79 cannot be used.
      And because only camel-ai[all]==0.2.79 is available and you require
      camel-ai[all], we can conclude that your requirements are unsatisfiable.

Regarding this issue, I think this is unrelated to my pr and the reason I am getting this is because i pushed uv lock file due to which we tied creating new environment instead of one in cache

Hey @Tanuj-Taneja1, I will have a look at this issue and see why this may be happening, also moving forward feel free to message me with any concerns or issues you may face!

@Tanuj-Taneja1
Copy link
Collaborator Author

Hi @Wendong-Fan Sorry to bother you but i was getting some error during setup env in the above tests Is this related to me pushing uv.lock or in general ( I didnt see anyone else getting this error)

Run source .venv/bin/activate
  × No solution found when resolving dependencies:
  ╰─▶ Because fish-audio-sdk==2024.12.5 was yanked (reason: Break Change) and
      only the following versions of fish-audio-sdk are available:
          fish-audio-sdk<=2024.12.5
          fish-audio-sdk>2025
      we can conclude that fish-audio-sdk>=2024.12.5,<2025 cannot be used.
      And because camel-ai[all]==0.2.79 depends on
      fish-audio-sdk>=2024.12.5,<2025, we can conclude that
      camel-ai[all]==0.2.79 cannot be used.
      And because only camel-ai[all]==0.2.79 is available and you require
      camel-ai[all], we can conclude that your requirements are unsatisfiable.

Regarding this issue, I think this is unrelated to my pr and the reason I am getting this is because i pushed uv lock file due to which we tied creating new environment instead of one in cache

Hey @Tanuj-Taneja1, I will have a look at this issue and see why this may be happening, also moving forward feel free to message me with any concerns or issues you may face!

Hi @waleedalzarooni, I think the issue has been fixed in pr #3427
I think that is the reason my branch has conflict in uv lock file, I will fix it in some time

@Tanuj-Taneja1
Copy link
Collaborator Author

Tanuj-Taneja1 commented Nov 20, 2025

Hi @waleedalzarooni, I think the issue has been fixed in pr #3427 I think that is the reason my branch has conflict in uv lock file, I will fix it in some time

I have resolved the merge conflict and now all the tests seems to be running fine
But I think there are some mypy issues in my recent commits, I will fix those

Also I face following issue with mypy, if there is a solution to these do let me know
I always get pre-commit mypy errors (unrelated to my changes) while commiting so I just have to skip them.
The mypy -pre commit test take way too long in my system, my laptop is kind of slow but i think it takes around 20-30 minutes for pre-commit tests if i dont skip mypy

@Tanuj-Taneja1
Copy link
Collaborator Author

Hi @waleedalzarooni , I will start working on calender actions soon and was thinking about keeping it in seperate file, will that be alright.
Also if you need any help to review this pr do let me know

@waleedalzarooni
Copy link
Collaborator

Hey @Tanuj-Taneja1,

No problem go ahead with the separate calendar functionality, thanks again for your effort on the PR. I will be passing it to reviewers promptly so we can put your hard work to use!

Copy link
Collaborator

@MuggleJinx MuggleJinx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @Tanuj-Taneja1 ! The overall implementation looks good, I found some small issues!

@fengju0213 fengju0213 added this to the Sprint 43 milestone Nov 24, 2025
Added reply and update function to get tools

Removed api_key_required decorator
@waleedalzarooni
Copy link
Collaborator

Hey @Tanuj-Taneja1,

I am currently working on reviewing your implementation, one thing to note for toolkits is that we typically have example files for each toolkit to demonstrate usage, would you mind creating one for the Microsoft toolkit (use the gmail_toolkit.py for reference)

Copy link
Collaborator

@waleedalzarooni waleedalzarooni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good implementation @Tanuj-Taneja1,

Previous reviewers have touched one all the points I had, once the example file is ready I will do some rigorous OAUTH testing and we should be good to go!

@Tanuj-Taneja1
Copy link
Collaborator Author

Tanuj-Taneja1 commented Nov 25, 2025

Hey @Tanuj-Taneja1,

I am currently working on reviewing your implementation, one thing to note for toolkits is that we typically have example files for each toolkit to demonstrate usage, would you mind creating one for the Microsoft toolkit (use the gmail_toolkit.py for reference)

Hi @waleedalzarooni
I think I mentioned in a earlier conversation, but I dont currently have any openai credits, so wont be able to create a example file with default model.

I think I can give you a notebook file which runs all the functions and setup instructions , would that be helpful?

If yes heres the link:
https://colab.research.google.com/drive/1jgJVfljz2HfdmgcmDZclhfdybCYNdi3u?usp=sharing
It is mostly ai generated but everything works, I had to hide the cell ouputs though since they contain important message id and stuff.
If it doesnt work for you feel free to let me know

 Moved previous auth logic to  _authenticate_using_browser

Created CustomAzureCredential which handles refresh and access token management

Added _authenticate_using_refresh_token function which uses refresh token to return custom credential object for msgraph client
Tanuj-Taneja1 and others added 2 commits November 26, 2025 14:16
… network interfaces


Changes host from "" to "127.0.0.1"

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review Required PR need to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Integrate Microsoft Outlook (Actions & Triggers)

5 participants