Put two drawings of the same character on a board. In one, the jacket collar folds down. In the other, it stands up. Select the second drawing and ask, “Keep this jacket and give her a smile.” Now drag the selected drawing to the left, confirm the generation, and refresh the page before the result arrives.
Which drawing goes to the image model? Where should a caption land after the move? And when the page comes back, how does it find the smile you already asked for?
We built Studio at AI Anime Generator for this kind of work. The hard part was giving three ordinary actions—selecting a picture, approving a generation, and reopening a project—precise meanings that survive a slow model call. Here’s how the interface and the code fit together, including a small Node.js example you can run without an account or an API key.
The real Studio workspace. Relay is the character in our public walkthrough. The two collar designs below are a separate, worked example; their short IDs are invented so you can follow them on paper.
Inside the build
- Read the board like a user, then map it to the underlying records.
- Follow an edit from a pointer or chat message to a versioned scene.
- Follow a paid generation from selection to confirmation to delivery.
- Recover an interrupted turn and test the failures that matter.
1. Start with the board the artist can see
Look at the left side of Relay’s board. A portrait tells you what she looks like from the front. A turnaround sheet lets you check where her orange pouch sits in profile. The snowy rooftop scene answers a different question: how much of her silhouette reads against a bright background? Each picture can become the reference for a different request. If the user selects the turnaround, sending the most recently generated rooftop image would give the model the wrong evidence.
Detail from the same project. The arrangement communicates a relationship to a human reader. For software, the selected element supplies the reference.
A user can drag the sheet under the portrait, zoom in, and compare them without generating any new pixels. They can also start from an image and ask for a new variation. Those interactions happen centimetres apart on screen. One changes the layout of the project; the other can start a billable job and add an asset. The first can complete as a scene save. The second needs a quote, a confirmation and a way back to a job that may outlive the tab.
The same board through three interfaces
Pointer. Zoom in on the portrait, pan the board, then drag a library image onto it. The browser reports a point in viewport coordinates. Studio converts that point to Excalidraw scene coordinates using the current view state. Saving the raw mouse position as the element’s position would produce a particularly strange bug: the drag would land correctly at one zoom level and jump away from the pointer at another.
Chat. The right-hand panel on the Relay board preserves the sequence of requests. The crop below shows the progression from a turnaround to a rooftop scene to animation. This is the sample conversation from our walkthrough. Its sample-credit message describes that demo; the confirmation workflow for a live request is explained in section 5.
Read this panel top to bottom. The artist can go back to the canvas between requests and choose which artifact will supply the next reference.
Phone. On a 390-pixel screen, reserving a permanent column for that conversation would squeeze the artwork into a narrow strip. The mobile entry puts Chat behind its own control. The capture below is the actual signed-out entry, so the open work area is empty. It shows what a new visitor can see before putting private project media on the screen.
The dedicated Chat entry leaves room for the canvas. The open Relay project above was captured separately on desktop.
2. What belongs in the canvas, the agent and the application?
The React UI hosts an Excalidraw scene and a chat panel. In a chat turn, a Deep Agents agent can call a small set of LangChain tools with structured inputs. The application owns the project, decides which assets belong to the signed-in user, checks prices and records the effects of a confirmed action. A conversational model can suggest what should happen next. Only the application has enough information to decide whether the operation is still valid.
| Tool | A concrete request | What the app does |
|---|---|---|
inspect_canvas | “Which selected image are we working with?” | Reads the saved scene, its version and the supplied selection IDs; returns a bounded summary. |
manipulate_canvas | “Put a caption underneath this picture.” | Validates structured operations, checks their targets and applies them against the expected scene version. |
propose_image | “Make a smiling variation of this drawing.” | Resolves the source for the edit and records the model, parameters and credit quote for confirmation. |
propose_video | “Animate this rooftop scene.” | Builds a video proposal around an eligible starting image and the chosen video settings. |
Reading a scene is cheaper than sending a screenshot for every layout question. The inspector returns element types, IDs, positions, dimensions and selected metadata. In the implementation reviewed here, it takes up to 200 saved elements and truncates each text field to 300 characters. A saved board can contain up to 500 elements. On a crowded board an inspector response can therefore be incomplete. A count of all elements and a bounded list of their details answer different questions.
That distinction matters for visual reasoning as well. Width, height and a reference ID are enough to position a caption below a portrait. They say nothing about the shape of its collar. To preserve a costume while generating a variation, the generation path needs access to the selected image. A character description can add intent, but it cannot supply missing pixels.
3. What “this picture” means after it moves
Here is the vocabulary we use for the two-collar example. It is worth writing down before designing the API: the wrong ID will often still yield a perfectly plausible picture.
| Question | Example value | Its lifetime |
|---|---|---|
| Which object did the artist point to? | Element collar-b | Follows the object when the artist moves it on the board. |
| Which media will the generator read? | Owned asset portrait-b | Resolves to the source pixels independently of the element’s coordinates. |
| Which layout did the agent read? | Canvas version 17 | Becomes stale after a newer scene save. |
| Which turn are we continuing? | Request smile-turn | Preserved when the browser reconnects to this conversation turn. |
| Which action did the artist approve? | Proposal smile-proposal | Names the saved terms for this generation. |
| Which generation are we checking? | Operation or task associated with that proposal | Used to recover status and match the output to the originating action. |
The user selecting collar-b establishes intent. The application still checks that the element belongs to the project and that the referenced media is available to its owner. A string supplied by a model is insufficient evidence for either check. This is particularly important when a project contains older references or when the user removes an asset during a conversation.
The saved scene also has a boundary. We keep geometry, drawing information and supported asset references. View state can include pan, zoom and background color. An expiring signed image URL is a poor durable reference: a board saved today should still make sense after that URL expires. Restoring the scene and resolving the underlying private media are separate steps.
4. An edit can be valid and still be out of date
Suppose the artist asks for a caption 16 units below a picture. At version 17 the image is at y = 100 and its height is 240. The proposed caption position is 356. While the agent works, the artist moves the image down to y = 300 and saves version 18. The same calculation now gives 556. Both coordinates are valid numbers; only one describes the board in front of the artist.
Studio checks the expected version when writing a canvas change. If another edit has won, the stale operation encounters a conflict. A fresh read can establish where the caption belongs. Replaying the old coordinate would draw a technically valid caption underneath empty space. Within a single agent run, a queue serializes canvas tool calls so its own layout edits observe a consistent order.
Moving a selection also involves more than changing two numbers. A labeled rectangle can have a separate text element bound to it. An arrow connecting that rectangle to a second card has two independently bound ends. When our editing code removes the rectangle, its label is removed with it. The surviving arrow releases that end while retaining the binding at the other card. A screenshot taken immediately after deletion can hide a broken binding: move the surviving card and see whether its end follows. That extra gesture gives you a much better regression test than counting objects.
There is a second race even if nobody else touches the board. A save can succeed and its reply can be lost. If the agent responds by adding the caption again, the user sees two captions. Studio records an operation identity and fingerprints for the expected scene change. Recovery can compare the stored operation with the scene it finds and recognize work already applied. If the evidence conflicts, treating the edit as ambiguous protects the artist’s intervening work.
5. The button that changes the meaning of a request
Typing “make a smile” creates an opportunity to show the artist the terms. It doesn’t require them to have committed to the cost. Studio stores a proposal with the chosen model, source where applicable, parameters and credit quote. The UI presents that proposal for a decision. For this workflow, a single agent turn can reserve one generation proposal.
Confirmation names the proposal already on file. This matters if the user has since clicked the other portrait: changing the current selection should not silently substitute the source for a quote they already reviewed. Conversely, a frozen description is no guarantee that execution remains possible. The server rechecks the quote before starting a previously unconfirmed live proposal. A changed credit amount or price version can invalidate that confirmation. Supported image parameters and availability of required references matter too. The user needs a current, executable offer.
For video, the starting frame is part of the request’s meaning. If the artist selects Relay on the rooftop, the video proposal must preserve that choice. A text-only description such as “mechanic in snow” loses the exact pose and composition. Image and video can use the same conversation surface while keeping their own generation settings and status handling.
The confirmation step is also the right place to decide what happens on a double click. Disabling the button is good feedback, but two tabs can still send the same confirmation. The application claims the stored tool execution. The handler for a repeat inspects its existing state and associated operation. This provides a basis for recovery across processes; a React boolean lasts only until the tab is closed.
6. A stream, a turn and a media job have different endings
A chat stream tells the browser what it has heard so far. A saved turn records the application’s progress. An image or video job can keep running after the stream ends. Consider a disconnect immediately after confirmation. From the browser’s perspective, “the request never arrived” and “the provider accepted it, but the reply was lost” look identical.
On reconnect, start with the original turn and proposal. Look up the associated operation and determine which evidence exists. The response to a status check should drive what the artist sees:
| Evidence available | Useful UI behavior |
|---|---|
| The saved proposal is still awaiting approval | Show its terms and confirmation control. Let the artist continue the original decision. |
| The operation exists and is still processing | Show progress and poll that operation. HTTP 202 can describe accepted work without a finished image. |
| A completed result already exists | Recover that result and associate it with the original source. |
| A terminal failure is recorded | Show the known failure. Mention a refund only when the refund itself is confirmed. |
| The submission outcome cannot yet be established | Keep the pending or unknown state visible. Check the existing operation before offering a fresh generation. |
A useful edge case is a disagreement between two records. Suppose the chat turn still contains an old proposal, but its tool execution has finished and has a generation ID. Showing the confirmation button again invites a second action. Studio’s recovery tests cover promoting the completed tool result over that stale proposal. Another test distinguishes an interrupted agent turn, which may need an explicit resume, from a media task whose status should continue to be checked.
7. Run the identity test locally
Here is a standalone model of the two decisions most likely to go wrong. It uses invented records and one process. Save it as studio-trace.mjs and run node studio-trace.mjs. The assertions check the layout race and distinguish two generations from the same source from two reads of the same generation.
import assert from "node:assert/strict"; const scene = { version: 17, cards: new Map([["collar-b", { asset: "portrait-b", y: 100, height: 240 }]]) }; function captionY(expectedVersion, elementId) { if (scene.version !== expectedVersion) throw Error("layout changed"); const card = scene.cards.get(elementId); return card.y + card.height + 16; } const proposals = new Map([ ["smile", { asset: "portrait-b", expression: "smile" }], ["frown", { asset: "portrait-b", expression: "frown" }] ]); const jobs = new Map(); function confirm(id) { const proposal = proposals.get(id); if (!proposal) throw Error("unknown proposal"); if (!jobs.has(id)) jobs.set(id, { ...proposal, status: "running" }); return jobs.get(id); } function recover(id) { const job = jobs.get(id); if (!job) return "unknown"; if (job.status === "done") return job.result; return job.status; } assert.equal(captionY(17, "collar-b"), 356); scene.cards.get("collar-b").y = 300; scene.version++; assert.throws(() => captionY(17, "collar-b"), /layout changed/); assert.equal(captionY(18, "collar-b"), 556); assert.equal(recover("smile"), "unknown"); const first = confirm("smile"); assert.strictEqual(confirm("smile"), first); const second = confirm("frown"); Object.assign(second, { status: "done", result: "frown.png" }); assert.equal(recover("smile"), "running"); assert.equal(recover("frown"), "frown.png"); assert.equal(jobs.size, 2); console.log("OK: stale layout rejected; both expressions accounted for."); The example intentionally lets a proposal ID key an in-memory job. The real service needs durable records, authenticated ownership checks and an execution claim before an external side effect. The Map only illustrates how the keys behave. Try changing the job key to proposal.asset: both expressions now address the same record. Try removing the version check: the stale edit no longer signals that the artist moved the card. Both mistakes can go unnoticed on a board with one asset and one successful request.
8. Test with the gestures that change the answer
| Exercise | What to inspect |
|---|---|
| Select the second of two similar drawings, then swap their positions | The reference still resolves to the selected element’s owned media. |
| Move a card while a caption edit is in flight | A stale scene version surfaces a conflict; the newer arrangement survives. |
| Delete a captioned shape connected to another card, then move the surviving card | The label disappears with its shape; the remaining arrow end follows its card. |
| Stop at the proposal and reopen the project | The pending decision can be recovered without turning the quote into a completed generation. |
| Interrupt the response after confirmation | The page looks for the existing operation. The pending state must never masquerade as a finished picture. |
| Ask for two expressions using the same source | Each request can be tracked separately. The newer result cannot satisfy the older request by accident. |
| Return to a failed job | The failure stays associated with the correct job. Refund wording depends on the recorded refund outcome. |
For this article we ran five focused test files against the Studio implementation. All 34 tests passed: six for canvas operations, ten for generation adapters, twelve for chat recovery, one for resuming the original request, and five for isolation of simulated execution. They exercise application decisions with controlled inputs. We did not run a paid generation or audit a live billing ledger for this article.
Our most useful debugging question turned out to be: which fact does this part of the UI actually know? At selection time it knows the element. At edit time it needs the layout version. At confirmation it knows the offer the artist approved. On reconnect it needs a record of an execution. Once those four facts had homes, we could change the panel layout or add a new kind of reference without redefining what a click on “generate” meant.
Try the canvas. Open the AI Anime Generator homepage. Scroll down the left sidebar and click Studio, marked Beta, just below My space. On a phone, tap Open navigation in the upper-left corner to see the same entry. Sign in when you’re ready to save a project or generate an image.
Written by the AI Anime Generator team.









