Poetry Analysis by a Swarm of AI Agents: A Multi-Agent Experiment

Poetry Analysis by a Swarm of AI Agents: A Multi-Agent Experiment

OpenAI recently introduced a framework called Swarm. While not a new concept, Swarm is designed primarily for educational purposes. It has some limitations, notably its simplicity and the fact that the agents in Swarm are stateless, making it less practical for complex applications.

Despite these limitations, I found the idea behind Swarm intriguing. Specifically, I liked the pattern where an agent acts as a kind of router for other subordinate agents. This got me thinking: why not apply the same concept using the Assistants API?

To explore this idea, I created a "router agent" that could perform function calls, where the functions were other agents. Essentially, the router could delegate tasks to specialized agents.

During development, I discovered that the router couldn't operate within the same thread as the analysts, so I set up a main thread for the router and another thread for the subordinate agents. This setup worked smoothly. In the Assistants API, each thread corresponds to a separate chat in ChatGPT.

The technical companion article is here:

For a test case, I set a goal of poetry analysis. The router's job was to determine which of the available analysts was best suited to analyze a given poem. In this example, there were two active threads: one for posting the goal and handling routing, and the other for the analysts to do their work.

The goal was to analyze a poem. The router, named Rhonda, had to determine which of three analysts—Kelly, Ann, and Elise—was best equipped for the task. Each analyst had different strengths. In this case, Rhonda read the poem and correctly identified it as a free verse, assigning it to Elise, who specializes in free-verse poetry.

The analysts operated in a separate thread, similar to specialists working in another room. Rhonda, acting as the router, made sure the right specialist was assigned based on the type of poem.

The generated output from both threads is shown below. As an aside, I found that actually naming the agents made reading the hand-offs from one agent to the next more interesting.

Main Thread

Goal: This is the poem to be analyzed by a selected analyst:

The city huddles beneath winter's unyielding breath,

where cold, a silent thief, seeps through my skin,

a chill that clings like the shadow of an invisible cloak—

unseen, relentless.

Towering silhouettes loom above, silent sentinels,

their windows pulsing with stories untold,

worlds cocooned in warmth, unyielding to the pleas

of the concrete cries below.

Life gathers in whispered clusters, concealed

beneath layers of tattered resolve,

dreams unravel like threads too thin

to weave a tapestry of warmth.

Figures move with the languor of heavy hearts,

palms cradling the world’s overlooked echoes,

as manifold eyes drift past, sight unseen,

to destinations where the warmth waits.

Below, steam rises—a transient embrace—

a mimicry of comfort that dissolves

into the indifference of the cityscape,

while above, stars are mere scars

on a cloud-silenced canvas.

Breath, a fragile artifact, hangs in glazed suspension,

each flake that falls a quiet testament to isolation,

each gust a stark reminder of an ongoing solitude.

Hope trickles through like a delicate wisp,

searching among unyielding stars

for a dawn promising not just warmth,

but the tender shelter of possibility.

In the city's brick-and-bone chorus,

life persists—a testament to endurance,

a testament to hope not as a memory,

but a light woven into the fibers

of an ever-stretching horizon.

The analyst will be selected by an expert then the poem will be analyzed.

Hello, I'm Rhonda, and I'll determine the best analyst to provide feedback on your poem. This poem beautifully captures the atmosphere of a city under the influence of winter, with vivid imagery and emotional depth. It features elements of free-verse with strong stylistic components, making an expert in readability and style the suitable choice.

Based on the attributes and themes, Elise, or "Ellie," seems to be the best fit for analyzing your poem. She specializes in free-verse poetry and can provide feedback with a focus on readability and style, which aligns well with the structure and artistic expression presented in your poem.

I'll proceed with Elise for a thoughtful analysis of your poem.

(See Analyst’s Thread below)

Elise, our expert in free-verse poetry, has provided an insightful analysis of your poem. She appreciated the vivid imagery and emotional depth, highlighting lines that effectively captured the essence of winter's grip on a city. The structure and flow of your poem, particularly the use of the free-verse format, were praised for enhancing emotional depth and allowing flexibility in thematic exploration.

Elise noted the poem's compelling motifs of isolation and hope, adding a rich layer of complexity. She advised that while the imagery is powerful, balancing intricate descriptions with simplicity could improve readability. She suggested introducing varied pacing for dynamic flow, incorporating more sensory details, and expanding on character exploration to enhance empathy.

Overall, Elise found your poem to be a hauntingly beautiful reflection of urban winter, and she encourages you to continue refining your creative expression.

Analyst’s Thread

Hello! I’m Elise, or Ellie, and I specialize in analyzing free-verse poetry with a keen focus on readability and style. I’m excited to delve into your evocative poem and provide some constructive feedback.

Imagery and Emotional Depth:

Your poem effectively captures the essence of a city gripped by winter, employing vivid imagery that allows the reader to feel the chill and solitude. Phrases like "the chill that clings like the shadow of an invisible cloak" and "stars are mere scars on a cloud-silenced canvas" are particularly striking, evoking a powerful sense of atmosphere and emotion.

Structure and Flow:

The free-verse format serves your poem well, enabling a natural and flowing exploration of themes without the constraints of rhyme or strict meter. This choice enhances the emotional depth by allowing flexibility in how the imagery unfolds. Your line breaks are thoughtfully placed, creating pauses that let the reader absorb the imagery and emotions before moving on.

Theme of Isolation and Hope:

The recurrent motif of isolation juxtaposed with glimpses of hope adds a rich layer of complexity. Lines such as "Hope trickles through like a delicate wisp" and "a dawn promising not just warmth, but the tender shelter of possibility" introduce a sense of yearning and resilience amid the cold and solitude, mirroring the human condition in urban winters.

Readability and Style:

While the vivid descriptions are effective, be mindful of ensuring that your language doesn't become too dense, which can hinder readability. Consider balancing intricate descriptions with moments of simplicity to provide the reader with anchors throughout the poem.

Suggestions for Enhancement:

1. Varied Pacing:

Introduce varying sentence lengths to create dynamic pacing. Short, abrupt lines can emphasize the harshness of winter, while longer sentences can convey the lingering cold or solitude.

2. Sensory Engagement:

Incorporate more sensory details beyond the visual and tactile, such as sounds or scents, to create a more immersive environment.

3. Exploration of Characters:

You touch on human elements with "Figures move with the languor of heavy hearts." Further developing these characters could enhance empathy and deepen the connection to their experiences in the cityscape.

Overall, your poem is a hauntingly beautiful reflection of winter's grip on an urban landscape, blending emotional depth with striking imagery. With slight refinements in pacing and readability, your poem can resonate even more profoundly with its audience. Keep pushing the boundaries of your creative expression!

Aside

In case you were wondering, the poem used was originally generated by a GPT-4o agent, a poet named William. I requested a free-verse poem about the plight of the homeless in a city during winter. After the initial draft, I had my three analysts—Kelly, Ann, and Elise—review William's work and provide feedback, which led to a revised version by William. It still feels strange describing the process of creating a poem in this way.

Conclusion

We are likely to see more and more software patterns emerge for the development of LLM agents that work collaboratively towards a shared goal. While this example was intentionally kept simple, the same pattern could be expanded significantly. Using an LLM, it would be possible to generate code for hundreds of subordinate agents, each with specialized skills, effectively replicating the functionality of a small company if needed.

I have used a poetry analysis example, but this could have been the processing of a loan application or an insurance claim.






Hrijul Dey

AI Engineer| LLM Specialist| Python Developer|Tech Blogger

4 周

Wow, an AI agent swarm! Imagine ants working together, but these are intelligent units collaborating on complex tasks. This could revolutionize problem-solving efficiency in industries from manufacturing to cybersecurity! https://www.artificialintelligenceupdate.com/openai-agent-swarma-hive-of-intelligence/riju/ #learnmore #AI&U

Nilo Neil

Founder and CEO of Swivelneck Software & Services Inc. Product Management Consultant and Giant Hairball Untanlger

1 个月

Fascinating

回复
Godwin Josh

Co-Founder of Altrosyn and DIrector at CDTECH | Inventor | Manufacturer

1 个月

The OpenAI Assistants API's flexibility allows for custom routing logic, enabling the creation of specialized agent hierarchies similar to Swarm. You could leverage the API's `messages` parameter to define context and task delegation between agents, potentially incorporating techniques like reinforcement learning for dynamic specialization. How would you design a feedback mechanism within your API-based swarm to ensure continuous improvement and adaptation of agent specializations based on real-world interactions?

要查看或添加评论,请登录

Dennis Layton的更多文章

社区洞察

其他会员也浏览了