IBSEN : Director-Actor Agent Collaboration for Controllable and Interactive Drama Script Generation (2024)

Abstract: Large language models have demonstrated their capabilities in storyline creation and human-like character role-playing. Current language model agents mainly focus on reasonable behaviors from the level of individuals, and their behaviors might be hard to constraint on the level of the whole storyline. In this paper we introduce IBSEN, a director-actor coordinate agent framework that generates drama scripts and makes the plot played by agents more controllable. The director agent writes plot outlines that the user desires to see, instructs the actor agents to role-play their characters, and reschedules the plot when human players participate in the scenario to ensure the plot is progressing towards the objective. To evaluate the framework, we create a novel drama plot that involves several actor agents and check the interactions between them under the instruction of the director agent. Evaluation results show that our framework could generate complete, diverse drama scripts from only a rough outline of plot objectives, meanwhile maintaining the characteristics of characters in the drama. Our codes and prompts are available at https://github.com/OpenDFM/ibsen.

## introduction language models learn the commonsense knowledge and reasoning ability from pre-trained text data, and they are suitable for many generation tasks such as role-playing @xcite and story creation @xcite . utilizing the knowledge stored in model parameters, using language models for story creation can rapidly and efficiently generate diverse storylines, potentially inspiring creators with new ideas. recently, the rapid progress of large language models (llms) greatly improved their reasoning ability, and capable llms like chatgpt foot_0 and gpt-4 (ope-nai, 2023) could be used to simulate human intelligence. this not only provides creators with more powerful story creation abilities via language models, but also enables llm to vividly role-play the characters in the story. a milestone to simulate believable human behavior using llm is generative agents @xcite . it created a virtual world where llm-based characters make their day and interact with each other. by combining llm's ability of storyline generation and agent role-playing, creators can easily bring a vivid story setting to life. however, as the previous research on llm agents concentrates on the framework of an individual agent, the multi-agent interactions could be greatly diverse and freestyle. the events between different characters are entirely based on their natural interactions, rather than a purposeful storyline. in some cases like drama playing, characters are expected to make certain decisions in a series of scenarios to normally push the plot de-velopment forward, and the interactions between agents should be constrained. only improving the architecture of agents hardly solves this problem, as the distributed agents lack a centralized component to regulate their behaviors. in other cases like adventure games or script role-playing games, the involvement of human players would make the plot development more unpredictable, and it is more necessary to ensure the plot develops towards the correct direction and will not deviate from the original plot too much. currently, the control of the generation process is mainly focused on controlling individual storyline llms @xcite , while the work on controlling generation in the form of character agents is still lacking. to realize both storyline generation and multiagent collaboration in the drama playing field, we propose the framework of ibsen (interactive-based playhouse for agents). ibsen focuses on the controllable generation of drama scripts in the form of agent dialogues. inspired by the roles of director and actor in films and theatres, we propose the director agent to serve as that centralized component. while character role-playing agents called actors have the freedom to generate responses, they are instructed by the director to make their responses follow the plot development (figure 1 ). the implementation of the ibsen framework is largely prompt-based, and one can easily construct ibsen agents on any publicly available general llms without fine-tuning. although we test and evaluate ibsen in a drama scenario, its framework design could be expanded to broader application cases, especially agent-based interactive games that contain specialized plot objectives. our contributions are summarized as follows: ## related work story-telling using language models previous works have attempted to create stories and control the generated plots using language models. users could use plain text to prompt the model, or inject story knowledge into model parameters to control the generation @xcite . for better story coherency, @xcite proposed a hierarchical story generation strategy to maintain the logic of the whole storyline. @xcite used language models to build an interactive drama script co-writing tool, and creators could directly interfere with the plot generation by prompting the model. as storylines are largely driven by the characters, controlling character scripts is an effective method to control the plot development @xcite . from this point, ibsen mainly uses agent-style characters to automatically build personalized drama dialogues and push the plot forward. role-playing using language models language models require character-related knowledge to output personalized responses. if the character is derived from real-world or fictional work, its documents and profiles could be collected to serve as a reference to the language model @xcite , or expand them into a training set to fine-tune the language model @xcite . compared to simply using llms to generate character's dialogues, another way to role-play is to have llm simulate the process of human thinking in the form of agents. prior works have tried using pre-trained language model agents to play text-based games @xcite @xcite , or using multi-agent collaboration to accomplish certain tasks @xcite . @xcite proposed generative agents to let llm agents vividly simulate human's daily life. later works mainly adopted and modified this architecture to enhance or broaden the ability of llm agents @xcite @xcite . in ib-sen, we use a specialized agent architecture to build characters in the drama. different from previous works, the behaviors of character agents are influenced and controlled by a storyline for a collaborated dialogue script generation. ## agent architecture to integrate story-telling and role-playing in an agent style, we introduce three types of agent architectures in ibsen: director, actor and player. director agent ( §3.1) creates and checks the current drama storyline, actor agent ( §3.2) generates director current directing: act. 1-1, objective. 1 characters on the stage actor george write outline generate script instruct actors check objective memory db character db "following helson's intrusive question, hedda deflects the question with grace and authority." "hedda. while eilert's passing is indeed a profound loss, today we honor his legacy and contributions. let's focus on his life's work and the respect he deserves in this moment of remembrance." "hedda should shifts the focus from the eilert luo's death to celebrating his life and achievements. the keywords are: diplomatic, reflective, …" "not completed: hedda and george have not talking the past for enough turns. " generate response top memories: 1. hedda once had a lingering ex-lover named eilert luo, but they eventually broke up … 2. … to helson: an adversary in the media landscape to eilert: a lost opportunity for control and influence to george: … 1 2 3 5 actor profile name: hedda gai description: hedda gai, welleducated and hailing from a onceprominent but now declining family, is vying for the presidency … stage [suddenly, journalist edward helson enters the lobby, seeming to eavesdrop on their conversation.] helson (player) mrs. gai, could you please share some inside stories about eilert's death? act. 1-1: place: lobby characters: hedda, george background: before the press conference commemorating eilert luo begins, in the hotel lobby. objectives: 1. hedda gai chatted casually with george dai about past events. 2. berta rushed into the lobby, informing hedda that the press conference was about to start. 3. … hedda edward, now is neither the time nor the place for such inquiries. we are here to honor eilert luo's legacy and contributions to our academic community, not to delve into personal tragedies. actor hedda 4 player helson figure 2: overall framework of ibsen and an illustration of director agent's controlling process in a certain scene. director agent 1 ⃝ writes an outline to continue the previous plot and 2 ⃝ translate it into the dialogue script, then 3 ⃝ instructs the actor agent to generate a proper response. actor agent in the next dialogue turn 4 ⃝ generates the response, and the director agent 5 ⃝ checks whether the dialogue has reached the current plot objective. figure 2 illustrates the overall framework of ib-sen. in this example, a player agent breaks into the dialogue between two actor agents. the director agent first generates a new storyline and script to handle player's involvement, then instructs the actor agent to make a response. the entire generation process is driven by pre-defined plot objectives, and the dialogues generated during reaching these objectives form the final drama script. ## experiments in this section, we introduce the experiments conducted on ibsen. we first describe our preparations for the drama script generation ( §4.1), then evaluate the performance of ibsen under different settings and scenarios ( §4.2). lastly, we discuss some potential findings in our experiments ( §4.3). current objective current storyline dialogue script next turn's character? actor player [narration] director instructor llm top memories character impressions self description script background director instruction dialogue log @xmath0. when human players involve in the storyline, director agent will actively generate new storylines to adapt to player actions. ## conclusion we present ibsen, a framework for llm-based interactive and controllable drama script generation in the form of agents. we propose the role of director to monitor the plot development and instruct actor agents to generate proper responses. by the collaboration between director and actor, ibsen enables the human player to join the interactions between agents, while maintaining the plot development at the same time. we use a drama plot outline to test ibsen, finding its practicability in controlled dialogue script generation with player involvement. our work can be extended to other llms, script settings and application scenarios, and we expect that ibsen could eventually bring us to achieve an immersive ai plot interaction experience in the future.