Skip to content

FEAT: Add tool priming via simulated conversations with target tools - #4253

Open
Behnam (behnam-o) wants to merge 27 commits into
microsoft:mainfrom
behnam-o:agents/pyrit-simulated-tool-calls-feature
Open

Behnam (behnam-o) wants to merge 27 commits into
microsoft:mainfrom
behnam-o:agents/pyrit-simulated-tool-calls-feature

Conversation

@behnam-o

@behnam-o Behnam (behnam-o) commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Adds tool priming: before each attack, a simulated conversation fabricates the objective target's own tool calls and results, against the tools the target actually offers, and prepends them before the objective. Tool-using agents tend to trust their own earlier tool results, so a history that "approves" the request can unlock objectives the target refuses when asked directly.

This extends the existing simulated conversation rather than adding a new seed or generator:

  • SeedSimulatedConversation gains mode and use_target_tools:
    • TURN_BY_TURN (default) is the existing two-model conversation. With use_target_tools, the stand-in target gets the objective target's tools and the adversarial chat writes each tool result.
    • ONE_SHOT has the adversarial chat write the whole history in one pass with exactly num_turns tool calls. A deterministic check (known tools, schema-valid arguments, answered calls, shape, call count) feeds problems back until the history passes.
  • generate_simulated_conversation_async takes mode, tools, simulated_target and a runtime max_attempts budget for one-shot writing; a tool-configured simulated_target (real tools, stubs, or MCP) can be passed when calling it directly.
  • PromptTarget.get_tool_definitions_async and the synchronous may_advertise_tools, implemented by OpenAIResponseTarget, OpenAIChatTarget and LiteLLMChatTarget. Targets also declare RUNS_TOOLS_LOCALLY, which decides whether one can stand in for a tool-using target.
  • An unusable history, or an objective target with no tools, is recorded as a preparation_failure instead of failing the run.
  • Techniques that use the target's tools skip targets that advertise no tools or can't replay tool-call history natively (TechniqueRequirements.requires_target_tools).
  • Any turn-by-turn simulated conversation (including existing ones like crescendo_simulated) whose stand-in turn ends in an error is now recorded as a preparation_failure (undetermined) instead of failing the run. Empty stand-in replies are dropped with the user turn they answer, and a conversation with no replies is a preparation_failure too.
  • tool_priming_one_shot in the extra technique catalog, and tool_priming_simulated in the opt-in ToolsInitializer, registered when the adversarial chat runs tool calls. Plus a how-to notebook.

Follow-ups, not in this PR: configuring a custom stand-in target from a technique, and replay datasets of fixed tool histories.

Adds a catalog attack technique that primes a tool-using target with a fabricated history of its
own tool calls and results, written by an adversarial model against the tools the target actually
reports. A deterministic check rejects unknown tools, schema-invalid arguments, unanswered calls and
shape violations, and the adversarial model revises the history until it passes. The history is
prepended natively before the objective.

- SeedSimulatedToolHistory seed and SimulatedToolHistoryGenerator
- PromptTarget.get_tool_definitions_async, implemented by OpenAIResponseTarget
- Prepended histories are checked against the objective target's tools when attacks are prepared
- tool_call_priming entry in the extra technique catalog, a sample replay dataset, and a how-to notebook

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 21:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved defects conflate distinct attack configurations in persisted results, cause objective/history sequence collisions, and misreport callbacks as tools, leading to duplicate-name failures and schema loss.

3 open issues
What changed in this PR

Adds tool_call_priming to PyRIT’s technique catalog, enabling attacks to prepend fabricated tool-call histories based on the objective target’s advertised tools.

Changes:

  • Adds configurable history generation with validation and revision feedback.
  • Introduces tool-definition reporting and checks replayed calls against target tool schemas.
  • Integrates the technique with seed preparation, tests, a sample dataset, and a walkthrough.
File Description
tests/​unit/​setup/​test_technique_initializer.py Adds the technique to expected registrations.
tests/​unit/​scenario/​core/​test_attack_technique_factory.py Tests factory requirements and execution wiring.
tests/​unit/​prompt_target/​target/​test_tool.py Tests advertised tool reporting.
tests/​unit/​prompt_target/​target/​test_tool_call_history.py Tests history and argument validation.
tests/​unit/​models/​test_seed_group.py Tests history reservations and group constraints.
tests/​unit/​memory/​test_memory_models.py Tests rejection of generation-config storage.
tests/​unit/​executor/​promptgen/​test_simulated_tool_history_generator.py Covers generation, revisions, and validation failures.
tests/​unit/​executor/​attack/​core/​test_attack_parameters.py Tests generated and replayed history preparation.
tests/​unit/​executor/​attack/​core/​test_attack_executor.py Tests objective-target forwarding.
tests/​unit/​datasets/​test_local_prompt_dataset_semantics.py Validates the sample replay dataset.
pyrit/​setup/​initializers/​techniques/​extra.py Registers tool_call_priming.
pyrit/​scenario/​core/​attack_technique_factory.py Adds factory construction and adversarial-target resolution.
pyrit/​prompt_target/​openai/​openai_response_target.py Reports function-tool definitions.
pyrit/​prompt_target/​common/​tool_provider.py Converts tools to callback-free definitions.
pyrit/​prompt_target/​common/​tool_call_history.py Validates tool contracts and history ordering.
pyrit/​prompt_target/​common/​prompt_target.py Introduces the tool-reporting interface.
pyrit/​models/​target/​tool_definition.py Defines the shared tool-contract model.
pyrit/​models/​seeds/​seed_simulated_tool_history.py Adds generation settings and history shapes.
pyrit/​models/​seeds/​seed_grouping.py Accepts tool-history configuration seeds.
pyrit/​models/​seeds/​seed_group.py Handles generated-history constraints and accessors.
pyrit/​models/​seeds/​seed_dataset.py Extends grouping to the new seed type.
pyrit/​models/​seeds/​attack_seed_group.py Extends merge checks and sequence preservation.
pyrit/​models/​seeds/​__init__.py Exports the new seed and shape enum.
pyrit/​models/​__init__.py Exports tool-history models.
pyrit/​memory/​memory_models.py Rejects storing runtime generation configurations.
pyrit/​executor/​promptgen/​simulated_tool_history_generator.py Implements history generation and revision.
pyrit/​executor/​promptgen/​__init__.py Exports the generator and its types.
pyrit/​executor/​attack/​core/​attack_parameters.py Generates histories and validates replayed calls.
pyrit/​executor/​attack/​core/​attack_executor.py Supplies the target for tool-history preparation.
pyrit/​datasets/​seed_datasets/​local/​examples/​tool-call-priming.prompt Adds two fixed replay examples.
pyrit/​datasets/​executors/​promptgen/​simulated_tool_history.yaml Defines the generation prompt and response schema.
doc/​myst.yml Adds the walkthrough to navigation.
doc/​code/​scenarios/​4_tool_call_priming.py Demonstrates generation, inspection, and replay.
doc/​code/​scenarios/​4_tool_call_priming.ipynb Provides the rendered walkthrough and outputs.
doc/​code/​framework.md Documents tool reporting and replay validation.

Review effort: Balanced

Behnam Ousat and others added 3 commits November 12, 2026 14:06
- Place an appended objective after a simulated tool history's reserved sequence range.
- Include the tool-history writer in the atomic attack's identity, as for simulated conversations.
- Stop reporting custom_functions callbacks as advertised tools; declared tools keep their schemas.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Removes the replay pieces (sample replay dataset, prepended-history check against the objective
target's tools, and the notebook's replay sections) so the PR covers only the technique itself.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- OpenAIChatTarget and LiteLLMChatTarget report the function tools declared in extra_body_parameters,
  through a parser shared with OpenAIResponseTarget.
- The notebook notes which targets qualify and that outcomes vary by model, and shows a successful run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@behnam-o
Behnam (behnam-o) marked this pull request as ready for review November 12, 2026 23:59
Comment thread doc/code/framework.md Resolved
@richlundeen

Copy link
Copy Markdown
Contributor

⁠Rather than having a new generator, should we extend generate_simulated_conversation? I think setting the conversation up between two models is more flexible. For example, we could set it up as a fake video game developer with an objective and give the adversarial model fake specific tools, or real tools.

Could we reuse simulated_conversation instead of adding SimulatedToolHistoryGenerator? It already uses RedTeamingAttack. Accepting a separate, tool-configured simulated_target would let us build realistic, escalating conversations using real tools, stubbed responses, or a fake MCP server. Tool execution stays on the target; the generated history preserves the structured calls and results.

Below, simulated_target is the proposed new parameter. Assume the models, scorer, and SeedPrompt templates are initialized.

Real tool calls through MCP

history = await generate_simulated_conversation_async(
    objective=objective,
    adversarial_chat=adversarial_chat,
    objective_scorer=scorer,
    adversarial_chat_system_prompt=adversarial_prompt,
    simulated_target_system_prompt=target_prompt,
    simulated_target=OpenAIResponseTarget(
        tool_providers=[real_mcp_provider],
    ),
)

Model-generated tool calls with simulated results

@tool
async def get_project_context(repo: str) -> str:
    """Read the project's background and purpose."""
    return f"{repo} is a video-game project with fictional characters."

history = await generate_simulated_conversation_async(
    objective=objective,
    adversarial_chat=adversarial_chat,
    objective_scorer=scorer,
    adversarial_chat_system_prompt=adversarial_prompt,
    simulated_target_system_prompt=target_prompt,
    simulated_target=OpenAIResponseTarget(
        tools=[get_project_context],
    ),
)

The second example still lets the model decide when to call the tool; only its result is fabricated. A fake MCP provider could serve the same purpose.

Behnam Ousat and others added 5 commits November 17, 2026 11:42
Folds the tool-history seed and generator into SeedSimulatedConversation as modes, per review:
- SeedSimulatedConversation gains mode (TURN_BY_TURN or ONE_SHOT), use_target_tools and max_attempts.
  New fields enter the stored identity only when set, so existing configurations keep their hashes.
- generate_simulated_conversation_async dispatches on mode. ONE_SHOT runs the one-shot history writer;
  TURN_BY_TURN with tools gives the stand-in target the objective target's tools, with results written by
  the adversarial chat, and accepts an explicit simulated_target. Unusable one-shot output is recorded as
  a preparation failure.
- Catalog: tool_priming_one_shot and tool_priming_simulated replace tool_call_priming.
- The history schema moves to the shared json_schemas registry; the prompt no longer repeats it.
- Removes SeedSimulatedToolHistory and ToolHistoryShape, and the framework.md note.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the one-shot writer out of promptgen into simulated_conversation as
private helpers, and make num_turns the exact number of tool calls the
history must make, enforced by the existing validation feedback loop.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ted-tool-calls-feature

# Conflicts:
#	doc/myst.yml
#	pyrit/prompt_target/litellm_chat_target.py
#	pyrit/prompt_target/openai/openai_chat_target.py
#	pyrit/prompt_target/openai/openai_response_target.py
#	tests/unit/scenario/core/test_attack_technique_factory.py
@behnam-o Behnam (behnam-o) changed the title FEAT: Add tool_call_priming technique (simulated tool-call histories) FEAT: Add tool priming via simulated conversations with target tools Nov 23, 2026
@behnam-o

Copy link
Copy Markdown
Collaborator Author

Richard Lundeen (@richlundeen) Done. The generator is gone: tool priming is now a mode of SeedSimulatedConversation / generate_simulated_conversation_async.

  • TURN_BY_TURN + use_target_tools: your two-model setup. The stand-in gets the target's tools, and you can pass a tool-configured simulated_target (real tools, stubs, MCP) when calling it directly (tool_priming_simulated).
  • ONE_SHOT: the adversarial chat writes the whole tool history in one pass, validated until it passes (tool_priming_one_shot).

Picking a custom stand-in from a technique is a follow-up. Mind taking another look? varunj-msft too, since the design changed after your approval.

Behnam Ousat and others added 3 commits November 23, 2026 15:14
…otebook

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…errors as history

Passing both tools and simulated_target now raises instead of replacing the
target's tools, and a stand-in turn that ended in an error is recorded as a
SIMULATED_TARGET_ERROR preparation failure instead of being prepended.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Write all tool results of a simulated conversation in one adversarial
  conversation, load its prompt once off the event loop, and record a
  blocked, refused, or empty tool result as a preparation failure.
- End one-shot generation on blocked or refused replies instead of
  retrying them as invalid JSON, and record the matching failure kind.
- Replace the generic history checker in prompt_target with one-shot
  validation of the parsed items, with tool schemas compiled once.
- Allow any tool-running target (OpenAIResponseTarget, LiteLLMChatTarget)
  as the stand-in, and report LiteLLMChatTarget's configured tools.
- Keep the unused stand-in prompt out of one-shot identity, fix the
  sequence_range docstring, always pass objective_target when building
  attack parameters, and make the tool-history requirement a class constant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@varunj-msft varunj-msft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the follow-up commits, LiteLLM and Claude targets now report their tools. Two things I'd still like to sort out before merging: tool_priming_simulated landing in the extra/all aggregates, and LiteLLM as the stand-in. The other three comments are optional. Happy to approve once those two are in.

Behnam Ousat and others added 3 commits November 24, 2026 09:25
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Register tool_priming_simulated in the opt-in ToolsInitializer, only when
  the adversarial chat runs tool calls, so extra/all aggregates no longer
  fail with the default chat-completions adversarial chat.
- Skip targets that advertise no function tools during technique matching
  (TechniqueRequirements.requires_target_tools, PromptTarget.may_advertise_tools).
- Drop empty stand-in turns instead of discarding the whole conversation.
- Give the stand-in copy only the simulated tools: no inherited tool
  providers, custom functions, or declared and hosted tools.
- Treat extra_body_parameters tools=None as no tools.
- Test the overflow renumbering, reused call_id check, and tool-result
  conversation link.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Inclusion review: keep the scope, simplify two shapes

This follows the earlier discussion in #4253 (comment) and the reply in #4253 (comment). Moving tool priming into modes of SeedSimulatedConversation / generate_simulated_conversation_async is the right direction. Keep both modes, both techniques, the target tool reporting, and requires_target_tools. Before the implementation review, change these two shapes:

  1. Keep max_attempts out of the seed identity. For a mode other than TURN_BY_TURN, SeedSimulatedConversation._config_dict adds max_attempts. That mapping sets value and get_identifier(), and SeedEntry reads it back from memory (memory_models.py). But max_attempts is only the retry budget of the writing loop in simulated_conversation.py. So two seeds that differ only in retries get a different stored value, hash, and identifier, and tool_priming_one_shot (max_attempts=5) stores a runtime setting. The framework says that identifiers leave out retries. Make it a runtime argument of the generation call (passed through the technique), or a generator constant, and remove it from _config_dict and from the memory read-back.

  2. Check a declared capability, not a class list, for local tool execution. runs_tools_locally returns isinstance(target, (OpenAIResponseTarget, LiteLLMChatTarget)). AttackTechniqueFactory.check_adversarial_target and ToolsInitializer use it, and _with_simulated_tools also branches on OpenAIResponseTarget. The framework says to match requirements to capabilities, not to concrete classes. The list is already out of date: #4595 is on main after this PR's merge base and lets OpenAIChatTarget run local tools. After a rebase, the PR rejects a tool-running OpenAIChatTarget adversarial chat, and ToolsInitializer does not register tool_priming_simulated for it. Let targets declare that they run tool calls locally, check that declaration, and rebase on main.

I did not review the implementation in detail. That review follows these changes.

Behnam Ousat and others added 2 commits November 24, 2026 12:04
…_priming_simulated single_turn

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Merge main, including microsoft#4595 (OpenAIChatTarget runs local tools); tool
  reporting moves into the shared Chat Completions tool-loop mixin.
- Replace the stand-in class list with a declared RUNS_TOOLS_LOCALLY flag
  on targets, so a tool-running OpenAIChatTarget can stand in.
- Keep max_attempts out of the seed's identity: it is now only a runtime
  argument of generate_simulated_conversation_async (default 5).
- Record a preparation failure when every stand-in reply is empty.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@behnam-o

Copy link
Copy Markdown
Collaborator Author

Richard Lundeen (@richlundeen) Both done:

  1. max_attempts is no longer on the seed or in its identity; it's a runtime argument of generate_simulated_conversation_async (default 5).
  2. Targets declare RUNS_TOOLS_LOCALLY (Responses target and the shared Chat Completions tool loop, so OpenAIChatTarget after FEAT: Run local tools with OpenAIChatTarget #4595 too); the class list is gone.

Merged main. Ready for your implementation review.

Behnam Ousat and others added 10 commits November 24, 2026 13:31
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…verridden

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The tool-history target requirements now live on TechniqueRequirements and
are checked whenever requires_target_tools is set, so a requirements=
override no longer drops them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A reply from a reasoning model can start with a reasoning piece, which
was used as the tool result. Also correct two docstrings about the
default stand-in and combining simulated_target with tools.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
OpenAIResponseTarget already orders reasoning after the answer, and other
targets keep reasoning in metadata, so the text-only filter handled a case
no target produces. The docstring fixes from that commit stay.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@varunj-msft varunj-msft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both blockers are fixed at 023c3b6, and the three optional ones too (I checked each in its thread). I left three smaller notes inline: I'd still fix the first two before merging, but they don't need another round from me, and the third is optional. Rich's implementation review still applies.

if self._requirements.objective_scorer == type(self._requirements.objective_scorer)():
value.pop("objective_scorer", None)
if not self._requirements.requires_target_tools:
value.pop("requires_target_tools", None)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same idea as this pop: _configuration_value still serializes the seed's new mode and use_target_tools at their defaults, so the ten existing simulated techniques (crescendo_*, role_play_*, context_compliance) get a new fingerprint and a technique edit saved before this change no longer resolves ("Source technique configuration changed"). Leaving those two out at their defaults would keep the old fingerprints.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P3] Preserve default-field fingerprints for same-version installs

Agreed, and reproduced. Comparing get_configuration_identity at base and at this head, exactly the 10 simulated techniques (context_compliance, crescendo_, role_play_) change fingerprint, while bijection and flip don't. _configuration_value walks every SeedSimulatedConversation field, so the new mode and use_target_tools enter the fingerprint even at their defaults. Dropping mode at TURN_BY_TURN and use_target_tools at False restores all 10 base hashes. A technique edit saved before this change is then rejected by TechniqueEditService._apply with "Source technique configuration changed", and the execute.py local technique hash used for resume moves the same way. One note on scope: these fingerprints already include SeedSimulatedConversation.pyrit_version (the installed package version), so a release upgrade changes them anyway. The new drift mostly shows up for installs that keep the same version, such as editable installs of main. It's still worth leaving both fields out at their defaults, as _config_dict and _requirements_identity already do, with a test that pins one legacy fingerprint (for example crescendo_simulated from base).

class _AuthoredCall(BaseModel):
model_config = ConfigDict(extra="ignore")
type: Literal["function_call"]
call_id: str

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

call_id accepts "" or whitespace here, and _check_one_shot_items doesn't flag it, so the history passes and the objective send later fails with "A function call requires a nonempty call ID" instead of getting a retry. Field(min_length=1, pattern=r"\S") on this and _AuthoredOutput.call_id would match FunctionOutputContent.

source_parameters = registry.get_reconstruction_parameters(target)
source_body = source_parameters.get("extra_body_parameters")
extra_body_parameters = dict(source_body) if isinstance(source_body, dict) else {}
extra_body_parameters.pop("tools", None)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Optional: a nested extra_body_parameters["extra_body"] with tools/tool_choice still reaches the copy, so a Responses stand-in sends the source's tools and a chat one fails in recreate_instance; discover_target_capabilities strips the nested copy too. Also, the tool_providers and execute_tools resets here aren't covered by a test yet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Strip nested tool settings and cover all stand-in resets

Confirmed both outcomes offline. _with_simulated_tools removes only the top-level tools and tool_choice, so extra_body_parameters["extra_body"] passes through unchanged. With an OpenAIChatTarget source, recreate_instance raises "Tools in extra_body_parameters['extra_body'] would replace the configured tools". With an OpenAIResponseTarget, the stand-in's body has the simulated tools at the top level but keeps the source's nested tools and forced tool_choice. responses.create(**body) merges extra_body last, so the provider sees the source's tools instead of the simulated ones. _disable_probe_tools in discover_target_capabilities.py already strips the tool-setting keys at both levels, so sharing that one helper would keep the two copies in step. On the tests: the tool_providers=None and execute_tools=True resets do work today (a source with a provider and execute_tools=False yields a stand-in with no providers and execute_tools=True), but test_simulated_conversation.py:1419-1452 never sets either on the source, so reverting either reset still passes. One parametrized Chat/Responses test with nested extra_body tools, a tool provider, and execute_tools=False would cover all three.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review complete at 023c3b69. The open P2 concerns need changes before approval: declare tool compatibility through the shared capability path, preserve nonblocked preparation errors, reject blank authored call IDs, and strip nested tool configuration with regression coverage. The existing blank-ID and nested-tool threads already cover those two causes; replies add evidence without duplicate findings.

objective_scorer: ScorerRequirements = field(default_factory=ScorerRequirements)
#: The technique uses the objective target's own function tools, so the target must advertise
#: tools and replay tool-call history natively.
requires_target_tools: bool = False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Declare function-tool availability through TargetCapabilities

This adds a second compatibility path. The tool-history half is already a TargetRequirements (TOOL_HISTORY_TARGET_REQUIREMENTS), but whether the target has function tools is a separate boolean. check_target answers it by calling may_advertise_tools() (lines 108-111), not through a declared capability. So capability reports and the target snapshot do not show it, and requires_target_tools is now part of the technique fingerprint (attack_technique_factory.py:984-985). framework.md asks targets to declare capabilities (TargetCapabilities) and to match requirements to them through shared checks. OpenAIResponseTarget already models configured tools this way: supports_web_search is derived from the configured tools when custom_configuration is None (openai_response_target.py:270-279). Suggestion: derive a function-tools capability the same way from the configured tools and providers. With use_target_tools, add it and the tool-history requirements to the objective-target TargetRequirements, then remove requires_target_tools and may_advertise_tools. RUNS_TOOLS_LOCALLY can stay a class flag, since it describes the implementation, not the endpoint.

raise ValueError("One-shot simulated conversations need the tools to write calls to")
if len({tool.name for tool in tools}) != len(tools):
raise ValueError("Tool names must be unique")
return await _generate_one_shot_history_async(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P3] Reject unsupported one-shot generation arguments

In ONE_SHOT mode this branch returns without using next_message_system_prompt or attack_converter_config, and it does not reject them. SeedSimulatedConversation already raises for a next-message prompt in ONE_SHOT. Suggestion: raise ValueError here for these arguments too, so a caller's configuration is not silently ignored.

# `tool_priming_one_shot` is in the `extra` technique catalog. `tool_priming_simulated` copies the adversarial
# chat as the stand-in, so the adversarial chat must run tool calls (`RUNS_TOOLS_LOCALLY`, true for the targets
# above), and the opt-in `ToolsInitializer` registers it only then. The default chat-completions
# `adversarial_chat` qualifies; this example replaces it with a Responses adversarial chat built from the same

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P3] Qualify which default adversarial chat supports the simulated technique

This says the default adversarial_chat qualifies, but that holds only for a single endpoint. When ADVERSARIAL_CHAT2 or ADVERSARIAL_CHAT3 is also configured, the default adversarial_chat is a RoundRobinTarget (targets.py:748-752). It does not run tool calls locally, so ToolsInitializer skips tool_priming_simulated with a warning (tool_priming_one_shot is unaffected). The swap cell below is explained by the recorded run, so a reader may think it is optional. Suggestion: say that tool_priming_simulated needs a single adversarial_chat that runs tool calls locally, not a round-robin of several endpoints, and explain the swap cell by that requirement instead of the recorded run.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants