google / google/adk-python

feat(model_armor): screen tool output in ModelArmorPlugin (or companion plugin)

Offen
#6,966 4 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @sanketpatil06 Auf GitHub ansehen
models needs review spam
Vorherrschende Sprache
Python
Sterne
21.5k
Forks
4k
Ø Merge
1 T. 14 Std.
Gemergte PRs (30 T.)
37

Beschreibung

### Is your feature request related to a specific problem?

Same problem as #6964: the documented limitation that tool output is not screened by `ModelArmorPlugin`. For agents that load untrusted text through tools, screening only user prompts and model output leaves a documented security gap.

https://github.com/google/adk-python/blob/main/docs/guides/integrations/model_armor/index.md#limitations

### Describe the Solution You'd Like

One of (maintainer choice):

1. Extend `ModelArmorConfig` with e.g. `screen_tool_output: bool = False` and implement screening in `ModelArmorPlugin.after_tool_callback`, reusing the prompt template; or
2. Ship `ToolOutputModelArmorPlugin` in `google.adk.integrations.model_armor` as an optional companion with shared config/client.

Either approach should mirror fail-closed semantics of the existing plugin and include unit tests in `tests/unittests/integrations/model_armor/`.

### Impact on your work

Production agent pipelines where tool output is the dominant untrusted input channel. Reference sample implementation: #6964 / #6965.

### Willingness to contribute

Yes. Sample PR #6965 is open; happy to contribute a core plugin PR after design alignment.

### Describe Alternatives You've Considered

- Document-only workaround: insufficient; limitation is already documented but not addressed.
- Per-app custom plugins forever: duplicates logic across every ADK 2.8 adopter with tool-heavy threat models.

### Proposed API / Implementation

```python
@dataclass
class ModelArmorConfig:
...
screen_tool_output: bool = False
tool_output_blocked_message: str = "Tool output was blocked by Model Armor."
```

```python
async def after_tool_callback(self, *, tool, tool_args, tool_context, result, **kwargs):
if not self._config.screen_tool_output:
return None
...
```

### Additional context

- Not requesting Workflow-as-sub-agent (#5872 closed; Workflow-as-Tool is the supported orchestration path).
- Separate from #6224 (durable execution hooks).

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.