AWS Builder Center
Weekend Creative Agent Challenge: Kigo

Weekend Creative Agent Challenge: Kigo

An always-on agent that reads Tokyo's weather and the 72 microseasons of the Japanese almanac every morning, writes one haiku about the gap between them, paints it as a woodblock print, and critiques its own back catalogue before writing the next one.

Vision and what it does

Japan's traditional almanac splits the year into 72 microseasons, each roughly five days long. Every one is named after a single thing you are supposed to be able to walk outside and see. Today, the third microseason of Risshu, is called 蒙霧升降, "thick fog descends."
Tokyo this morning was 29.7°C and overcast, with no fog anywhere.
Here is what the agent made of that on its first scheduled run, with nobody watching:
曇天や / ガラス瓶に張る / 水の膜 donten ya / garasu bin ni haru / mizu no maku overcast— / clinging to the glass bottle / a film of water
Its own note on the poem: the fog the almanac promised never descended, so it put the moisture on a bottle instead, "as if the fog had fallen all the way down to cling to cold glass instead of hanging properly in the air where it belongs."
That gap is the whole idea. Kigo is an agent that wakes up on its own at 06:00 JST, reads what the almanac promised and what the weather actually did, and writes one haiku about the difference between them. Then it paints the poem as a woodblock print and publishes both to a public gallery. I never open it. By the time I look, the day's poem is already sitting there.
The problem I wanted to solve is smaller than "automate creativity." It is that a creative tool you have to launch is a creative tool you stop launching. So I did not start from an app and add a schedule to it. I started from the schedule and asked what is left when the person is removed, and whether the thing still has anything to say once nobody is there to prompt it.
There is one more loop, and it turned out to matter more than I expected. Before writing anything, the agent reads back its own last seven poems and rewrites a style memo addressed to itself. That memo is the first thing tomorrow's poet reads. So the poems are not 365 independent samples from a model. They are a sequence, and each one is written under constraints the previous ones earned.
That loop is visible in the output. These two runs happened while I was still building, so they are gone from the live gallery now, but they are what convinced me the loop was doing something. Here is what the agent told itself after its first poem, which had opened with an absence:
The first poem followed all five craft rules. You found the bottle, the sweating asphalt, the cut, the present-tense verb. But you led with absence, which makes the reader wait through a negation to reach the image. The bottle arrived last, like a punchline. Tomorrow: enter through presence.
And here is the poet on the next run, catching itself in its own draft:
曇り空に / 傘のしずく落ちず / 霧は来ぬ Wait, I have opened with absence again. Let me begin with presence. 畳まぬ傘 / 三十度の曇り / 霧は遠し
I did not write that correction. I did not even expect to be able to read it.

How I built it

The first decision was where the season comes from. The easy version is a lookup table of 72 date ranges, which is wrong every leap year and needs maintaining forever. Instead the agent computes the sun's ecliptic longitude for the day and slices the circle. Risshun sits at 315°, each microseason is exactly 5° of arc, so the index is one floor division. I checked it against the published 2026 dates: Risshun on 4 February, the winter solstice on 22 December, and both of the awkward boundary cases where the term changes late in the afternoon Japan time. It agreed on all of them, with no data to keep up to date.
The agent itself is Strands Agents running on Lambda, and it runs twice per invocation. The first pass is an editor with two tools,  get_past_work  and  get_style_memo , which reads the back catalogue and writes the new memo. The second pass is the poet, with  get_microseason  and  get_weather , which composes under that memo.
That split was not the original design. I wanted one agent that called its tools and returned a typed object in a single turn, and Strands would not do it:
ValueError: No valid tool use or tool use input was found in the Bedrock response.
 structured_output()  forces the model to emit one specific tool call. If the agent decides to call a real tool first, that forced-output path finds a tool use it was not expecting and gives up. The fix is to stop asking for both at once: let a tool-using agent think in free text, then hand its answer to a second, tool-less agent whose only job is to transcribe it into the schema. Two extra model calls a day, and the failure mode is gone.
Structured output withholds one more guarantee, which I only found by invoking the deployed function by hand after everything looked finished. Forcing a tool call constrains which tool the model calls, not how faithfully it fills the arguments in. Bedrock handed back  "[\"Place one concrete object...\", ...]" , a JSON-encoded string, for a field the schema declared as a list of strings, and Pydantic threw out the entire run over it. A  mode="before"  validator that parses the string form when it sees one is four lines, and it turns a hard daily failure into a shrug. A schema is a request, not a contract.
Image generation was the part I got wrong the most times. I planned on Amazon Nova Canvas and found it returns  ResourceNotFoundException  on this account, marked legacy for inactivity, so I moved to Stability's Stable Image Ultra on Bedrock instead. Then the prints came back looking like photographs. Two causes. First, I had appended the style instruction to the end of the prompt, where it loses to the subject; moving it to the front fixed most of it. Second, "ukiyo-e" pulls toward Edo-period subjects, and a poem about wet asphalt and street lamps fights that. Naming shin-hanga instead, the twentieth-century movement that put exactly these subjects on woodblocks, held the style without arguing with the content.
The last problem was text. The model kept printing a title cartouche along the bottom margin in glyphs that are not real kanji. I pushed harder on the negative prompt and it threw away the subject before it threw away the text: I asked for a bottle on a road and got a generic moonlit landscape with the fake calligraphy still in place. So I stopped fighting it and cropped the bottom 9% of the image in code. Nine per cent is cheaper than a fourth prompt rewrite, and it works every time.
The first real scheduled run failed three times: once, then twice more because I had told the schedule to retry. Two things were wrong, and neither of them was reachable from my laptop. Strands calls  ConverseStream  rather than  Converse , so the Lambda role needed  bedrock:InvokeModelWithResponseStream  and not only the  bedrock:InvokeModel  I had granted it. And the container overran Lambda's ten-second initialisation budget importing Strands and its OpenTelemetry instrumentation. Init is CPU-bound, Lambda scales CPU with memory, so 1024 MB became 2048 MB and the timeout went away. Local testing had told me the agent worked. It could not tell me the agent worked as somebody else.
One CDK detail worth flagging, because it would have quietly deleted the gallery: the agent writes its output into the same S3 bucket that serves the front end, and  BucketDeployment  prunes by default. Every redeploy of the HTML would have taken every poem with it.  prune: false  is load-bearing here.

AWS services used and architecture overview

Amazon EventBridge Scheduler wakes an AWS Lambda function every morning. It runs two Strands Agents passes, an editor that rewrites the style memo and a poet that composes, both calling Amazon Bedrock. Results are written to Amazon S3 and served through Amazon CloudFront, and the style memo loops back into the next run.

Amazon EventBridge Scheduler is the alarm clock, with a native  Asia/Tokyo  timezone so the schedule reads as 06:00 rather than as a UTC offset I would have to re-derive. AWS Lambda runs the agent as an arm64 container image, since Strands and Pillow are easier to ship that way than as a layer. Amazon Bedrock serves both models. Amazon S3 holds every entry as JSON plus its PNG, and stays private. Amazon CloudFront is the only thing that can read it, through Origin Access Control. The whole stack is AWS CDK in TypeScript, one  cdk deploy .
A run takes about a minute: one Stable Image Ultra generation at eight cents plus four Claude Sonnet 4.5 calls on a few thousand tokens each. Well under a dollar a day, and everything else in the stack sits inside the free tier.

What I learned

Two things I did not know this morning.
The first is how much less "structured output" promises than the name suggests. It does not compose with tool use, because both want the same slot in the model's response. And even alone it constrains the shape the model aims at, not the shape it hits. I now write the schema and the coercion together, as one thing, and treat a validation error as a bug in my parsing rather than a bug in the model.
The second is about negative prompts. My instinct when an image is wrong is to add more words telling the model what not to do. Watching a prompt lose its subject while keeping the exact artefact I was trying to remove was a useful correction. The negative prompt does not subtract one thing; it moves the whole generation somewhere else. Fixing the output afterwards, deterministically, was both cheaper and more reliable.
The thing I did not expect to learn anything about was the self-critique loop, which I added mostly because the challenge prompt suggested it. It is the part I now find most interesting. Giving an agent a file that it both writes and reads, one run apart, is a very small amount of machinery for something that behaves a lot like having a practice.

Link to app and repo

Every entry in the gallery records the Lambda request ID that produced it and the trigger that started the run. Nothing there was made by a person pressing a button.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article