Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a sample to redact sensitive information after an agent generates a response #2927

Open
wants to merge 850 commits into
base: 0.2
Choose a base branch
from

Conversation

Git-Noob123
Copy link

Why are these changes needed?

There's a need for a way to redact sensitive data that is stored as env variables. Currently the only way to do this is to use transform_messages which ONLY redacts before an agent generates a response. However, if a user asks an agent to run a script that retrieves env data, it's still going to be revealed. So a way to hide sensitive data after a response is generated is needed. The sample here shows how can we do it using hooks

Related issue number

Checks

@Git-Noob123
Copy link
Author

@microsoft-github-policy-service agree

@ma-armenta ma-armenta removed the request for review from Knucklessg1 June 12, 2024 16:37
@sonichi
Copy link
Contributor

sonichi commented Jun 13, 2024

Would you like to render the notebook on the website? Please find instructions here: https://microsoft.github.io/autogen/docs/contributor-guide/documentation

@sonichi sonichi requested a review from WaelKarkoub June 13, 2024 05:24
Copy link
Contributor

@WaelKarkoub WaelKarkoub left a comment

Choose a reason for hiding this comment

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

@Git-Noob123 thank you for the notebook!

I like this notebook since it's a good example to show how process_message_before_send (hooks in general) works.

If we hook TransformMessages onto process_message_before_send it makes debugging these agents much more difficult, since you don't know the ground truth (as it gets modified before being stored in the context history). And as you may already know, it's already difficult to debug vanilla LLMs without any modifications.

In the intro, we should maybe explain the differences between each hookable method, and why you picked the process_message_before_send

notebook/agentchat_postresponse_secret_redaction.ipynb Outdated Show resolved Hide resolved
notebook/agentchat_postresponse_secret_redaction.ipynb Outdated Show resolved Hide resolved
notebook/agentchat_postresponse_secret_redaction.ipynb Outdated Show resolved Hide resolved
notebook/agentchat_postresponse_secret_redaction.ipynb Outdated Show resolved Hide resolved
notebook/agentchat_postresponse_secret_redaction.ipynb Outdated Show resolved Hide resolved
notebook/agentchat_postresponse_secret_redaction.ipynb Outdated Show resolved Hide resolved
notebook/agentchat_postresponse_secret_redaction.ipynb Outdated Show resolved Hide resolved
notebook/agentchat_postresponse_secret_redaction.ipynb Outdated Show resolved Hide resolved
notebook/agentchat_postresponse_secret_redaction.ipynb Outdated Show resolved Hide resolved
notebook/agentchat_postresponse_secret_redaction.ipynb Outdated Show resolved Hide resolved
@Git-Noob123
Copy link
Author

Git-Noob123 commented Jun 14, 2024

@WaelKarkoub Thanks for the comments! I have resolved all of them besides the regex one. I added a section at the beginning of the notebook to describe what's hooks in Autogen as well. Please review it and feel free to put in more comments & thoughts.

For debugging with the postprocess hook, I think we should add another section in the notebook to warn readers about how difficult it can be to debug with redacted message, and users can potentially add logging before redaction. On the other hand hiding sensitive information is more of a security concern, as you dont want users to see your secrets. Please let me know what you think

@ghost
Copy link

ghost commented Jun 14, 2024 via email

Copy link

gitguardian bot commented Jul 20, 2024

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@ekzhu ekzhu changed the base branch from main to 0.2 October 2, 2024 18:28
@ekzhu
Copy link
Collaborator

ekzhu commented Oct 2, 2024

@Git-Noob123 minor edits. Can you also run pre-commit run --all-files to fix the formatting

@jackgerrits jackgerrits added the 0.2 Issues which are related to the pre 0.4 codebase label Oct 4, 2024
@Git-Noob123
Copy link
Author

Thanks! I just added the fix and run precommit, should be good now

jackgerrits and others added 4 commits October 4, 2024 10:05
…osoft#3653)

* remove subscription on client disconnect in worker runtime

* address PR feedback

* remove outdated comment

* remove public properties

* fix mypy issue

* address PR feedback

---------

Co-authored-by: Jack Gerrits <[email protected]>
…l events (microsoft#3665)

* Move tool to agent; refactor logging in agentchat

* Update notebook
@rysweet
Copy link
Collaborator

rysweet commented Nov 21, 2024

@Git-Noob123 - this is close - just need you to resolve the conflicts - can you give it a try?

colombod and others added 21 commits November 21, 2024 11:03
* Misc doc fixes

* Update _console.py

---------

Co-authored-by: Jack Gerrits <[email protected]>
* delete files and update dependencies

* add explicit config exports

* ignore mypy error on nb

---------

Co-authored-by: Leonardo Pinheiro <[email protected]>
Co-authored-by: Jack Gerrits <[email protected]>
…#4323)

* add roleplay tool call orchestrator

* add chinese business workflow test

* update
…osoft#4149)

* task: added warning when none is called in intervention handler

* add leading underscore to indicate private to _warn_if_none method in intervention.py

* address comment of returning Any for result in intervention.py

* Update intervention.py to remove redundant name change

* Format and lint

---------

Co-authored-by: Jack Gerrits <[email protected]>
Co-authored-by: Jack Gerrits <[email protected]>
…ices (microsoft#4253)

* Update README.md

Add more information about using Azure OpenAI services

* Update README.md

Adjust the formatting to improve readability of the steps, making them easier to follow.

---------

Co-authored-by: Hussein Mozannar <[email protected]>
* initial addition of a user proxy agent in agentchat, related to microsoft#3614

* fix typing/mypy errors

* format fixes

* format and pyright checks

* update, add support for returning handoff message, add tests

---------

Co-authored-by: Ryan Sweet <[email protected]>
Co-authored-by: Hussein Mozannar <[email protected]>
* Selector Group Chat Tutorial (microsoft#4112)

* update doc

* update

* Add custom selector function

* Update doc

---------

Co-authored-by: Eric Zhu <[email protected]>
* Make grpc an optional dependency

* add note to the runtime docs

* update version

---------

Co-authored-by: Eric Zhu <[email protected]>
…icrosoft#4329)

* ensure that cancellation token is passed in InvokeWithActivityAsync

* add comments and baggange is not nullable

* store ncrunch settings

* shange signature to have nullable activity at the end of Update

* correct spelling case

* primary contructor

* add docs and make async interface accept cancellation tokens

* address code ql error
* Readme edits to support the team

---------

Co-authored-by: Jack Gerrits <[email protected]>
* add tolerance for empty choices

Signed-off-by: Mohammad Mazraeh <[email protected]>

* address pr comments

Signed-off-by: Mohammad Mazraeh <[email protected]>

* Update python/packages/autogen-ext/src/autogen_ext/models/_openai/_openai_client.py

Co-authored-by: Jack Gerrits <[email protected]>

* Update python/packages/autogen-ext/src/autogen_ext/models/_openai/_openai_client.py

Co-authored-by: Jack Gerrits <[email protected]>

* address pr comments

Signed-off-by: Mohammad Mazraeh <[email protected]>

* Update python/packages/autogen-ext/src/autogen_ext/models/_openai/_openai_client.py

Co-authored-by: Jack Gerrits <[email protected]>

* Update _openai_client.py

---------

Signed-off-by: Mohammad Mazraeh <[email protected]>
Co-authored-by: Ryan Sweet <[email protected]>
Co-authored-by: Jack Gerrits <[email protected]>
* Add warnings for deprecated azure oai config changes

* Update docs and usages, simplify capabilities
@Git-Noob123
Copy link
Author

Hey sorry I completely forgot about this, looks like the forked branch is so behind that the pr now has like 850 commits after I click sync branch. What do we do in this case?

@github-actions github-actions bot removed the awaiting-op-response Issue or pr has been triaged or responded to and is now awaiting a reply from the original poster label Nov 26, 2024
@MohMaz
Copy link
Contributor

MohMaz commented Nov 27, 2024

Hey sorry I completely forgot about this, looks like the forked branch is so behind that the pr now has like 850 commits after I click sync branch. What do we do in this case?

Hi,
You would need to pull from this remote branch, fix conflicts and push again. Typical if there are no conflicts, just hitting Update Branch runs CI tests again and if passed, reviewers will reviewer.

@MohMaz MohMaz added the awaiting-op-response Issue or pr has been triaged or responded to and is now awaiting a reply from the original poster label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.2 Issues which are related to the pre 0.4 codebase awaiting-op-response Issue or pr has been triaged or responded to and is now awaiting a reply from the original poster
Projects
None yet
Development

Successfully merging this pull request may close these issues.