Generate graphs and optimize prompts
Draft an Agent graph with Canvas Copilot, improve node prompts, and validate the generated result.
Use Canvas Copilot to turn a workflow description into an editable graph, then optimize its agent or supervisor prompts and validate the result. AI-generated structure and text remain a draft: inspect them before you preview or rely on the workflow.
Before you begin
You must be signed in and have a skill version open in the canvas. The configured large language model (LLM) provider must be available because graph generation and prompt optimization call it.
Generate and refine a graph
In Talk to graph…, enter a concrete description that names the entry, processing stages, decisions, tools, human approvals, and final result. For example:
Build a support-ticket workflow. Start with an agent that classifies urgency,
route high-risk tickets to human approval, draft a response for approved or
normal tickets, and finish with an output node containing the response.A complete description gives Canvas Copilot enough context to generate node prompts, routes, and a left-to-right layout. You can also select Show examples to load an example prompt and then adapt it.
Select GENERATE. While the request runs, the control displays GENERATING… and prevents a duplicate submission.
On success, the canvas replaces its current contents with the generated graph and reports Graph generated with the number of created nodes. The service supplies missing node IDs, positions, labels, and edge IDs, but those normalizations do not prove that the workflow is correct.
Trace the graph from START to END. Confirm that each work node is reachable, each intended outcome can reach END, and every router edge has the branch label its decision requires. Check that generated tool names, actions, and prompt variables match resources available in your environment.
Compare every node type and limit with Graph nodes and validation reference. Canvas Copilot performs a basic response-shape check, but malformed semantics can still require correction on the canvas.
Select an agent or supervisor node to open its inspector. Review Agent Prompt or Supervisor Prompt and correct the node label and surrounding graph context first; the optimizer sends the node type, label, and available condition or tool name as context.
The OPTIMIZE PROMPT control appears only when the existing prompt contains more than 20 characters.
Select OPTIMIZE PROMPT. The control changes to OPTIMIZING… while the request runs. On success, Agent Studio replaces the current prompt with structured text that targets a role, input contract, output contract, numbered instructions, constraints, and examples.
The inspector also displays estimated original and optimized token counts. These values are approximations derived from character length; a positive percentage can mean the optimized prompt is longer, not necessarily less effective.
Read the replacement prompt before using it. Confirm that it preserves the original intent, refers only to real input or results variables, gives an output shape downstream nodes can consume, and does not grant tools or authority the node should not have.
Start a preview with representative synthetic input. Follow Preview and debug a graph to verify structural validation, input validation, node events, and the terminal status.
Verify the draft
START and END, every intended branch is connected and labeled, optimized prompts still express the intended constraints, and a preview reaches the expected terminal state.Troubleshooting
Next, preview and debug the graph with realistic synthetic input, then revise any node whose event or output differs from the intended workflow.