Most "AI writes a story" demos are one model generating an entire book in asingle pass. That's not interesting — it's just a longer prompt. What'sactually interesting is how a real creative team works: a curriculumspecialist pushes back on a story editor's vocabulary choice, an editorsends a manuscript back to the writer over a specific transition that feelsabrupt, an art director rejects an illustration that's drifted off-style andasks for a redo. That's the Agent Society track's actual premise — agentsthat partition tasks, resolve conflicts, and negotiate — so we built thething the track description was asking for: a small studio of sevenspecialized AI agents that write, illustrate, and *argue with each other*about a children's book, with a teacher able to step into that process atany point.

The book is the demo. The multi-agent studio is the product.

What it does

A teacher gives a learning objective (e.g. "why leaves change color in thefall, for 8-9 year olds"), an age range, and a page count. From there,seven agents run the project turn by turn:

  • Curriculum Lead sets learning goals, vocabulary level, and constraints
  • Story Architect designs the outline, pacing, and world
  • Character Designer creates the cast and their recurring visual traits
  • Art Director maintains a visual bible and writes every illustrationprompt
  • Writer drafts the manuscript
  • Illustrator calls Qwen's image models to render each page
  • Editor reviews the whole project for pacing, clarity, and accuracy

Three of those pairs don't just hand off work — they negotiate. TheCurriculum Lead critiques the Story Architect's outline for age-appropriatelanguage and the outline gets revised in response. The Editor critiques themanuscript's pacing and the Writer revises specific pages. The Art Directorchecks whether a page can honestly be drawn as one illustrated moment and,if not, sends it back to be split into two. All of this streams live to thebrowser — you watch each agent "type" in real time, see the critique land,and watch the next agent respond to it.

A teacher can also toggle on human-in-the-loop checkpoints after theoutline, characters, or manuscript — approve, edit directly, retry, or leavefeedback for the agent to incorporate. With every checkpoint off, the samepipeline runs fully autonomously.

The finished book is viewable as a page-flip storybook in the browser orexported as a PDF.

How we built it

A FastAPI backend serves a small Jinja2 + vanilla JS/CSS frontend overplain HTTP and one WebSocket per run — deliberately no heavy frontendframework, no LangChain, no existing agent framework. Every agent is a thinPython class pairing a persona (system prompt) with the specific sharedartifact files it's allowed to read (Curriculum.md, StoryOutline.md,Characters.md, VisualBible.md, Story.md) — an MCP-style shared projectmemory instead of re-stuffing the whole project into every prompt. Aturn-based orchestrator (app/orchestrator/pipeline.py) runs the sevenagents strictly one at a time — deliberately never concurrently, sinceletting two agents reply to the same state at once just producescontradictory feedback and burns tokens for nothing.

Every model call — chat, vision, and image generation — goes through oneclient module (app/qwen_client.py) that talks directly to Qwen Cloud'sdashscope-intl.aliyuncs.com endpoints, with a cheapest-first fallbackchain across model tiers (qwen-flashqwen-turboqwen3-max fortext; qwen-image-plus-max for illustrations). Chat calls streamtoken-by-token over SSE, which is what powers the live "typing" indicatorper agent in the browser.

Illustrations go through their own quality loop: the Art Director writes aprompt grounded in the visual bible, the Illustrator generates the image,and then a vision-capable Qwen model (qwen-vl-plus) compares the resultagainst the page-1 reference image for style and character consistency,separately screening for garbled or inappropriate rendered text — if eithercheck fails, the Art Director revises the prompt and the Illustratorretries.

Challenges we ran into

The most instructive bug wasn't in the illustration pipeline — it was inthe negotiation itself. Several agents were calling .critique() on contentthey weren't actually allowed to read (each model call is stateless, so anagent only "knows" what's in its explicit reads list), which meant acritique could be entirely fabricated: the Curriculum Lead once produced adetailed, well-written critique about photosynthesis and predator/preyvocabulary for a story about brushing teeth, because it was judging blind.Fixing this — giving every revising agent visibility into its own currentartifact — was a bigger, more important fix than anything in the imagepipeline.

The image side had its own hard problem: getting the Art Director to stopasking the image model to render legible text (which it garbles unreliably,and once produced an inappropriate word from garbled letters on abackground sign). Three rounds of increasingly explicit prose instructionsdidn't fix it. Adding one concrete bad-example/good-example pair to thesystem prompt did, immediately. Lesson: for this class of instruction,examples beat rules.

Accomplishments that we're proud of

Watching two agents actually disagree and resolve it — live, streaming,with the resolution visibly changing the shared document — is the thingthat makes this feel like a team and not a pipeline. Getting theconsistency/safety vision-review loop to catch its own mistakes (styledrift, a stray inappropriate word) and self-correct within the same run,without a human in the loop, was the payoff of investing in an "AgentSociety" architecture instead of a simpler linear generator.

What we learned

Prompt-only guardrails have a ceiling. When an instruction is violatedrepeatedly despite being stated clearly and repeatedly, the fix usuallyisn't a longer or stricter instruction — it's either a concrete examplepair, or (when correctness genuinely matters, like safety) a realverification step after the fact rather than hoping the generation stepgets it right the first time.

What's next for Story Weavers

Interactive post-generation revisions, multiple illustration styles perbook, read-aloud narration, translated editions, and classroom lessonguides generated alongside the story itself.

Built With

Share this project:

Updates