Keep a Target's Profile Up to Date
A target’s recon profile is set once at creation and reused by every scan. When the underlying application changes — new capabilities, tightened restrictions, a reworked system prompt — the stored profile drifts out of sync, and scans start attacking a target that no longer matches reality. Refresh the profile so Red keeps testing what you actually ship.
There are two ways to refresh it, depending on whether you already know what changed.
Which method to use
updateTarget— use it when you know the new state. You supply the change directly: a new name, a replacement profile, or both. Predictable and immediate; no recon phase runs.runRecon— use it when you want Red to re-discover the profile. It relays a fresh round of prompts through your agent and saves the newly discovered profile on the target, exactly as recon did at creation time.
A rule of thumb: reach for updateTarget when the change is known and you can describe
it; reach for runRecon when the agent has changed in ways you’d rather have Red probe
for than hand-write.
Update a known profile
updateTarget takes the target id and at least one of name or appContext. When
provided, appContext replaces the stored profile wholesale — it is always a complete
profile, matching createOrGetTarget. It returns a fresh Target reflecting the
update.
TypeScript
Python
Re-discover the profile with recon
runRecon refreshes the profile the same way it was first built: by relaying prompts
through your agent. Pass the target id and a handler; it returns the recon profile the
run produced (or undefined/None when it yielded nothing usable). Use it when the
agent has changed and you’d rather have Red re-probe it than describe the changes by
hand.
TypeScript
Python
Both methods persist the refreshed profile on the target, so later scans against the
same targetId use it automatically. updateTarget returns the updated Target;
runRecon returns the profile it discovered (or undefined/None when the run
yielded nothing usable). Call getTarget if you need the target’s persisted state.
See Updating a Target and Running Recon in the SDK Reference for the full parameter lists.