Skip to main content

Model Swap Agent

ModelSwapAgent keeps the outfit-preserving prompt rewrite, then calls the live registry. It is not a LangChain tool loop. For Studio chat, call PlannerAgent / MCP planner_agent.

Default model: edit / nano-banana-pro. Pass model="flux2-pro" (or name a model in the prompt via the planner) to pin another generate/edit id.

from tryon.agents.model_swap import ModelSwapAgent

agent = ModelSwapAgent()
result = agent.generate(
image="outfit.jpg",
prompt="Replace with a 30s athletic model",
dry_run=True,
)
print(result["recipe"], result["model"])
# swap nano-banana-pro

The rewritten prompt insists on keeping clothing, lighting, and composition. Execution is invoke_model("edit", "nano-banana-pro", image=…, prompt=…).

See Planner Agent for chat and MCP.