mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
6089446f04
* wip * wip * wip * wip * wip * wip * Update docs/design/main.md Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com> * Update docs/design/main.md Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com> * wip * wip * wip * wip * wip * wip * wip * wip * wip * update * update * update * wip * wip * wip * wip * address comment * update * add custom agent example * address comment * update code teaser * Update docs/design/main.md Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com> * update * address comments * update guardrails * address some of mark's comments * add new separate sections for agents and workflows * update agent doc * Update agent.md Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com> * add foundry agent doc * wip * refine the component registration interface with agent runtime * update * workflows * update * update * Update * Update * update * Update design doc to remove runtime * Update * Update * Update * update * Add eval section notes (#9) * add notes on eval * remove duplicate title * update docs * update docs * save updates before merge * update evaluation script * Update agents.md * update workflows * Update Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com> * update workflow * Updated design doc * Update * Update * update * update * Update * update * update * Update * update * Update with agent abstraction alternatives * Update discussion * Update * update * Update * Update * Update * Update --------- Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com> Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com> Co-authored-by: Victor Dibia <chuvidi2003@gmail.com>
1.3 KiB
1.3 KiB
Guardrails
The design goal is to provide a flexible and extensible way to implement guardrails and a built-in set of guardrails that can be used for common use cases.
NOTE: this is work in progress.
Guardrails can be template-based to adapt to different input data types, which include:
Messagefor agent messages.ToolCallfor tool call requests.ToolResultfor tool call results.
Guardrails are added to other components such as ModelClient and MCPServer
as hooks that are called before and after the main logic of the component.
For example, the ModelClient has methods to add input and output guardrails.
model_client = ModelClient(...)
model_client.add_input_guardrails([
PIIGuardrail[Message](...),
SensitiveDataGuardrail[Message](...),
])
model_client.add_output_guardrails([
HarmfulContentGuardrail[Message](...),
])
Another example to show how to use a guardrail with an MCP server:
guardrail = PIIGuardrail(
config={
"rules": [
{
"type": "email",
"action": "block"
},
{
"type": "phone",
"action": "block"
}
]
}
)
mcp_server = MCPServer(...)
mcp_server.add_output_guardrail(guardrail)