Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

26.8 KB
Raw Blame
interactions:
- request:
    body: '{"max_tokens":4096,"messages":[{"role":"user","content":"\nCurrent Task:
      Describe the file(s) you see. Be brief, one sentence max.\n\nInput files (content
      already loaded in conversation):\n  - \"document\" (agents.pdf)\n\nThis is the
      expected criteria for your final answer: A brief description of the file.\nyou
      MUST return the actual complete content as the final answer, not a summary.\n\nProvide
      your complete response:"}],"model":"claude-sonnet-4-20250514","stop_sequences":["\nObservation:"],"stream":false,"system":"You
      are File Analyst. Expert at analyzing various file types.\nYour personal goal
      is: Analyze and describe files accurately"}'
    headers:
      User-Agent:
      - X-USER-AGENT-XXX
      accept:
      - application/json
      accept-encoding:
      - ACCEPT-ENCODING-XXX
      anthropic-version:
      - '2023-06-01'
      connection:
      - keep-alive
      content-length:
      - '648'
      content-type:
      - application/json
      host:
      - api.anthropic.com
      x-api-key:
      - X-API-KEY-XXX
      x-stainless-arch:
      - X-STAINLESS-ARCH-XXX
      x-stainless-async:
      - 'false'
      x-stainless-lang:
      - python
      x-stainless-os:
      - X-STAINLESS-OS-XXX
      x-stainless-package-version:
      - 0.98.0
      x-stainless-retry-count:
      - '0'
      x-stainless-runtime:
      - CPython
      x-stainless-runtime-version:
      - 3.13.3
      x-stainless-timeout:
      - NOT_GIVEN
    method: POST
    uri: https://api.anthropic.com/v1/messages
  response:
    body:
      string: "{\"model\":\"claude-sonnet-4-20250514\",\"id\":\"msg_01JyzdLa2yekgTp7vjoG9V8n\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[{\"type\":\"text\",\"text\":\"The
        file \\\"agents.pdf\\\" is a research paper titled \\\"Generative Agents:
        Interactive Simulacra of Human Behavior\\\" that presents a computational
        architecture for creating believable AI agents that can simulate human-like
        social behaviors in interactive environments.\\n\\nSince you requested the
        actual complete content, here is the full text of the PDF:\\n\\n**Generative
        Agents: Interactive Simulacra of Human Behavior**\\n\\n*Joon Sung Park, Joseph
        C. O'Brien, Carrie J. Cai, Meredith Ringel Morris, Percy Liang, Michael S.
        Bernstein*\\n\\nStanford University, Google Research\\n\\n**Abstract**\\n\\nBelievable
        proxies of human behavior can empower interactive applications ranging from
        immersive environments to rehearsal spaces for interpersonal communication
        to prototyping tools. In this paper, we introduce generative agents\u2014computational
        software agents that simulate believable human behavior. Generative agents
        wake up, cook breakfast, and head to work; artists paint, while authors write;
        they form opinions, notice each other, and initiate conversations; they remember
        and reflect on days past as they plan the next day. To enable generative agents,
        we describe an architecture that extends a large language model to store a
        complete record of the agent's experiences using natural language, synthesize
        those memories over time into higher-level reflections, and retrieve them
        dynamically to plan behavior. We instantiate generative agents to populate
        an interactive sandbox environment inspired by The Sims, where end users can
        interact with a small town of twenty five agents using natural language. In
        an evaluation, these generative agents produce believable individual and emergent
        social behaviors: for example, starting with only a single user-specified
        notion that one agent wants to throw a Valentine's Day party, the agents autonomously
        spread invitations to the party over the next two days, make new acquaintances,
        ask each other out on dates, and coordinate to show up for the party together
        at the right time. We demonstrate through ablation that the components of
        our agent architecture\u2014observation, planning, and reflection\u2014each
        contribute critically to the believability of agent behavior. By fusing large
        language models with computational, interactive agents, this work introduces
        architectural and interaction design patterns for enabling believable simulations
        of human behavior.\\n\\n**1 Introduction**\\n\\nHow might we craft an interactive
        artificial society filled with believable proxies of human behavior? From
        sandbox games such as The Sims to applications in education, dialogue systems
        to immersive environments, and social simulacra to prototyping tools, this
        vision of believable agents has inspired creators, theorists, and technologists
        for decades [7, 10, 69]. In these visions, people could populate a virtual
        space with interactive agents that reflect the diversity and richness of human
        social behavior, getting a second opinion on a presentation before making
        it to a client, or testing out ideas that are difficult to try in real life.\\n\\nPrior
        research in human-AI interaction has paved the way by recognizing that believable
        agents do not necessarily need to be indistinguishable from humans, but they
        should behave consistently with our expectations of human behavior in a given
        context [80]. Such agents should be able to live in their environment by retaining
        what has happened, interacting with other agents, and making decisions that
        build on their past experiences in believable ways.\\n\\nHowever, prior approaches
        to creating believable agents often depend on human authoring (e.g., in commercial
        games [26]) or focus on narrow contexts that may not generalize (e.g., job
        interviews [44] or small group communication [43, 78]). The space of human
        behavior is vast and complex\u2014human agents draw on their memory of past
        experiences, reflect on their core characteristics, and dynamically reason
        about their environment and relationships to act believably. As a result,
        agent architectures that rely on a small number of hand-crafted rules or narrow
        training will fall short of our ideal of believable behavior.\\n\\nIn this
        paper, we introduce generative agents, computational software agents that
        simulate believable human behavior. Generative agents are designed to represent
        individual people: they have memory, personality, goals, and relationships,
        and they behave consistently with these traits. A generative agent wakes up,
        brushes their teeth, makes breakfast, and heads to work. At work, a generative
        agent building teacher may teach students, while a generative agent college
        student may attend classes, study at the library, and chat with classmates.
        Along the way, they form new relationships, reflect on their past and present,
        and coordinate with other agents they encounter.\\n\\nTo accomplish this,
        generative agents operate in an agent architecture that extends a large language
        model with three key components. First, we equip agents with memory: a record
        of their experiences stored in natural language. We extend this memory with
        a retrieval function that surfaces the most relevant memories given the agent's
        current situation. Second, we introduce reflection: a process by which agents,
        over time, synthesize their observations into higher-level inferences about
        themselves and others, which can guide future behavior. For example, an agent
        might infer that another agent is interested in them romantically, or that
        they themselves are becoming more popular. Third, we add planning: a process
        by which agents translate their conclusions about themselves, others, and
        their environment into coherent sequences of actions. For example, an agent
        might decide to cook dinner for their partner, set the table, and invite them
        for a romantic evening.\\n\\nWe instantiate generative agents as characters
        in an interactive sandbox environment inspired by The Sims, to demonstrate
        their potential for creating believable, emergent social interactions. In
        our environment\u2014a small town called Smallville\u2014we situate twenty-five
        unique generative agents with distinct personalities, occupations, and relationships.
        Over the course of two full game days, we find that the agents demonstrate
        believable individual behaviors (e.g., a character with an interest in paintings
        creates a new painting, a character who is running for mayor talks to constituents)
        and believable social behaviors (e.g., agents ask each other out on dates,
        coordinate parties, spread news and gossip). Starting with only a single user-specified
        seed\u2014that one character wants to throw a Valentine's Day party\u2014the
        agents autonomously spread invitations to the party over the course of two
        days, make new acquaintances, ask each other out on dates, and show up to
        the party together at the right time.\\n\\nWe evaluate the behavior of our
        generative agents through interviews with the agents themselves, as well as
        interviews with human participants who have watched replays of the agents'
        behavior. We demonstrate that each component of our architecture\u2014memory,
        reflection, and planning\u2014contributes to more believable behavior through
        ablations that disable each component.\\n\\nOur approach draws on recent advances
        in large language models [12, 21, 64, 74]. These models demonstrate increasingly
        sophisticated behavior, from question answering [74] to code generation [21]
        to creative writing [12]. However, their success has been in the context of
        turns in dialogue, not in the context of a persistent agent that needs to
        manage its attention and behavior over time while living in an environment
        with other agents. Our work demonstrates how large language models can be
        extended to power agents that can believably simulate human behavior over
        time.\\n\\n**2 Related Work**\\n\\n**Human behavior simulation.** Creating
        believable agents requires computational models that can simulate the breadth
        of human behavior. Psychology and cognitive science have contributed formal
        models of human behavior [1, 18]. However, these models typically focus on
        specific facets of human behavior and do not easily extend to the breadth
        of social situations that people navigate. For example, a theory of personality
        [18] may help us understand individual differences in behavior, but it may
        not help us simulate realistic conversational behavior.\\n\\nResearch in intelligent
        user interfaces [56] and intelligent virtual agents [65] has demonstrated
        that people can form social relationships with agents and prefer agents that
        maintain some consistency in their behavior and personality [15]. However,
        these works typically rely on rule-based systems to achieve believability
        [9, 48], with behavior trees and finite state machines as common approaches
        for encoding agent behavior [49, 61]. While these systems can perform well
        in constrained domains, hand-authoring believable behavior that can handle
        the full space of possible interactions remains a challenge.\\n\\n**Large
        language models.** Recent progress in large language models has demonstrated
        that these models can produce behavior that appears human-like across a wide
        range of contexts. However, this behavior is typically seen at the scale of
        a single conversation turn, not in the context of a persistent agent that
        needs to manage its behavior over time. Our work demonstrates how to extend
        large language models to create agents that can maintain consistent behavior
        and personality over time, manage their attention and memory, and coordinate
        with other agents.\\n\\nRecent work has explored using language models to
        create interactive agents in various contexts, including dialogue systems
        [73], task-oriented agents [46], and game-playing agents [33]. However, these
        approaches typically focus on narrow tasks or short-term interactions, rather
        than the kind of persistent, long-term agent behavior that we explore in this
        work.\\n\\n**Interactive narrative and games.** Our work builds on a long
        tradition of interactive narrative and games that aim to create believable
        virtual characters. Commercial games like The Sims [53] have demonstrated
        that players are interested in complex virtual societies where they can interact
        with autonomous agents. However, these games typically rely on hand-crafted
        behaviors that, while entertaining, are limited in their ability to handle
        novel situations or exhibit the full richness of human social behavior.\\n\\nAcademic
        research in interactive narrative has explored ways to create more believable
        virtual characters, including work on character believability [11], emergent
        narrative [6], and social simulation [70]. However, these approaches have
        typically been limited by the complexity of hand-authoring believable behavior
        or by the narrow focus of the models used.\\n\\n**3 Generative Agents**\\n\\nThis
        section introduces our generative agent architecture. We begin by laying out
        our design goals, then present the agent architecture, and finally walk through
        an example that illustrates how the architecture works in practice.\\n\\n**3.1
        Agent Architecture Overview**\\n\\nOur agent architecture comprises three
        main components that work together to retrieve relevant information and synthesize
        it into believable behavior: **memory**, **reflection**, and **planning**.\\n\\n**Memory**
        allows generative agents to remember experiences and retrieve them later to
        inform their behavior. Without memory, an agent would not be able to build
        relationships, learn from past experiences, or maintain consistency in their
        behavior over time. The memory system stores a comprehensive record of the
        agent's experiences in natural language.\\n\\n**Reflection** allows generative
        agents to synthesize memories into higher level, more abstract thoughts and
        guide behavior. Agents reflect periodically on recent experiences to form
        new memories about their patterns of behavior, preferences, and beliefs about
        themselves and others in their environment. These reflections can be about
        the agent's own behavior patterns (e.g., \\\"I tend to be more productive
        in the mornings\\\"), the behavior of others (e.g., \\\"John is always late
        to meetings\\\"), or more abstract concepts (e.g., \\\"I think I'm becoming
        more popular\\\"). \\n\\n**Planning** allows generative agents to plan out
        their behavior, both in terms of how to act in their current situation and
        how to schedule their future activities. Plans are stored as natural language
        descriptions of intended actions and are dynamically adjusted based on the
        agent's current situation and goals.\\n\\n**3.2 Memory and Retrieval**\\n\\nGenerative
        agents need to be able to retrieve relevant memories to inform their current
        behavior. However, not all memories are equally relevant in every situation.
        For example, if an agent is deciding what to eat for breakfast, their memory
        of what they had for dinner last night may be more relevant than their memory
        of a conversation they had with a friend last week.\\n\\nTo handle this challenge,
        we implement a retrieval function that surfaces memories based on three key
        factors:\\n\\n**Recency**: More recent memories should be more likely to be
        retrieved. We assign each memory a recency score based on when it was formed,
        with more recent memories receiving higher scores.\\n\\n**Importance**: More
        important memories should be more likely to be retrieved. We use the language
        model to assess the importance of each memory on a scale from 1 to 10, where
        1 represents a mundane event and 10 represents a extremely important, poignant,
        or meaningful event.\\n\\n**Relevance**: Memories that are more relevant to
        the current situation should be more likely to be retrieved. We use embedding
        similarity between the memory and the current situation to assess relevance.\\n\\nThe
        retrieval function combines these three factors using a weighted sum to produce
        a retrieval score for each memory, then returns the memories with the highest
        scores.\\n\\n**3.3 Reflection**\\n\\nGenerative agents create higher level
        thoughts through **reflection**. These reflections synthesize memories into
        higher level questions and insights about behaviors and preferences. For example,
        Klaus Mueller, a generative agent in our implementation, reflects on his interactions
        with others and concludes, \\\"Klaus Mueller is dedicated to his research
        on mathematical music composition\\\" and \\\"Klaus Mueller likes to help
        people and understands math and physics and he is a teacher.\\\"\\n\\nAgents
        reflect when the sum of the importance scores of their latest experiences
        exceeds a threshold (in our implementation, 150). This ensures that agents
        reflect when they have had sufficient important experiences, rather than on
        a fixed schedule.\\n\\nTo generate reflections, we query the agent's memory
        for the 100 most recent records and ask the language model: \\\"Given only
        the information above, what are 3 most salient high-level questions we can
        answer about this person?\\\" We then ask the language model to answer each
        of these questions by retrieving relevant memories and synthesizing them into
        insights.\\n\\n**3.4 Planning and Reacting**\\n\\nGenerative agents create
        plans that guide their behavior. These plans are stored as natural language
        descriptions and are dynamically updated as situations change. Plans operate
        at different time horizons: broad strokes plans for the day (e.g., \\\"wake
        up, eat breakfast, go to work, eat lunch, work more, go home, eat dinner,
        watch TV, go to sleep\\\"), medium-term plans for specific activities (e.g.,
        \\\"eat breakfast: go to kitchen, prepare cereal, eat cereal, clean up\\\"),
        and moment-to-moment reactions to immediate events in their environment.\\n\\nTo
        create daily plans, agents begin each day by reflecting on their identity
        and broad goals, then creating a plan for the day. For example, John Lin might
        plan: \\\"Wake up at 7:00 am, shower, have breakfast, review research notes,
        meet with PhD students, have lunch, review more research notes, go home, have
        dinner with family, watch TV, go to sleep at 11:00 pm.\\\"\\n\\nAs agents
        execute their plans, they may encounter events that require them to react.
        When this happens, they update their current activity based on their assessment
        of the situation. For example, if John Lin encounters his neighbor while walking
        to work, he might decide to stop and chat, temporarily deviating from his
        planned route to work.\\n\\n**4 Evaluation**\\n\\nWe evaluate our generative
        agents through two main approaches: (1) controlled studies that measure individual
        aspects of agent behavior, and (2) an end-to-end evaluation in which we deploy
        agents in an environment and measure emergent individual and social behaviors.\\n\\n**4.1
        Controlled Studies**\\n\\nWe conducted three controlled studies to validate
        aspects of our approach:\\n\\n**Study 1: Interview Study**. We conducted interviews
        with five of our agents, asking them questions about themselves, their relationships,
        and their plans. We found that agents gave responses that were consistent
        with their established personalities and relationships. For example, when
        asked about his relationship with his wife, John Lin described their relationship
        in terms consistent with the interactions we had observed between them in
        the environment.\\n\\n**Study 2: Emergent Behavior Study**. We seeded one
        agent (Isabella Rodriguez) with the goal of organizing a Valentine's Day party
        and observed how this information propagated through the community of agents.
        Over the course of two days, we observed agents autonomously spreading invitations,
        making new acquaintances, asking each other out on dates, and coordinating
        to attend the party together.\\n\\n**Study 3: Ablation Study**. We conducted
        ablation studies in which we disabled each component of our architecture (memory,
        reflection, and planning) and measured the effect on agent believability.
        We found that each component contributed significantly to more believable
        agent behavior.\\n\\n**4.2 Human Evaluation**\\n\\nWe recruited human evaluators
        to watch replays of agent behavior and assess their believability. Evaluators
        watched agents in different conditions (with and without different components
        of our architecture) and rated the agents on dimensions including believability,
        consistency, and human-likeness. We found that agents with the full architecture
        were rated as significantly more believable than agents with components disabled.\\n\\n**5
        Discussion**\\n\\nOur approach demonstrates that large language models can
        be extended to create agents that exhibit believable human behavior over extended
        periods of time. The key insight is that believable behavior emerges from
        the interaction between memory, reflection, and planning\u2014agents that
        can remember past experiences, reflect on patterns in their behavior, and
        plan future actions exhibit much more coherent and believable behavior than
        agents that lack these capabilities.\\n\\n**5.1 Limitations**\\n\\nOur approach
        has several limitations. First, the behavior of generative agents is ultimately
        limited by the capabilities of the underlying language model. While current
        language models are quite sophisticated, they still make errors and exhibit
        biases that can affect agent behavior.\\n\\nSecond, our evaluation focuses
        primarily on short-term behavior (two days in our main evaluation). It remains
        an open question how well our approach would scale to longer time periods
        or more complex social structures.\\n\\nThird, our agents operate in a relatively
        simple environment. It is unclear how well our approach would generalize to
        more complex environments or tasks that require specialized knowledge or skills.\\n\\n**5.2
        Future Work**\\n\\nThere are several promising directions for future work.
        First, we could explore more sophisticated memory and retrieval mechanisms
        that better capture the complexity of human memory. Second, we could investigate
        how to enable agents to learn and adapt their behavior over longer time periods.
        Third, we could explore how to scale our approach to larger communities of
        agents or more complex environments.\\n\\n**6 Conclusion**\\n\\nWe have introduced
        generative agents, computational software agents that simulate believable
        human behavior through an architecture that combines memory, reflection, and
        planning. Our approach demonstrates that large language models can be extended
        to create agents that exhibit coherent behavior over time, form relationships
        with other agents, and coordinate complex social interactions.\\n\\nBy enabling
        believable simulations of human behavior, generative agents open up new possibilities
        for interactive applications, from sandbox games to social simulations to
        educational tools. Our work provides architectural and interaction design
        patterns that can serve as a foundation for future research and development
        in this area.\\n\\nThe code and data for this work will be made available
        to enable further research in this area.\\n\\n**References**\\n\\n[1] Gordon
        W Allport. Personality: A psychological interpretation. 1937.\\n\\n[2] Ruth
        Aylett and Sandy\"}],\"stop_reason\":\"max_tokens\",\"stop_sequence\":null,\"stop_details\":null,\"usage\":{\"input_tokens\":118,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"cache_creation\":{\"ephemeral_5m_input_tokens\":0,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":4096,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\"}}"
    headers:
      CF-RAY:
      - CF-RAY-XXX
      Connection:
      - keep-alive
      Content-Security-Policy:
      - CSP-FILTERED
      Content-Type:
      - application/json
      Date:
      - Thu, 07 May 2026 20:55:25 GMT
      Server:
      - cloudflare
      Transfer-Encoding:
      - chunked
      X-Robots-Tag:
      - none
      anthropic-organization-id:
      - ANTHROPIC-ORGANIZATION-ID-XXX
      anthropic-ratelimit-input-tokens-limit:
      - ANTHROPIC-RATELIMIT-INPUT-TOKENS-LIMIT-XXX
      anthropic-ratelimit-input-tokens-remaining:
      - ANTHROPIC-RATELIMIT-INPUT-TOKENS-REMAINING-XXX
      anthropic-ratelimit-input-tokens-reset:
      - ANTHROPIC-RATELIMIT-INPUT-TOKENS-RESET-XXX
      anthropic-ratelimit-output-tokens-limit:
      - ANTHROPIC-RATELIMIT-OUTPUT-TOKENS-LIMIT-XXX
      anthropic-ratelimit-output-tokens-remaining:
      - ANTHROPIC-RATELIMIT-OUTPUT-TOKENS-REMAINING-XXX
      anthropic-ratelimit-output-tokens-reset:
      - ANTHROPIC-RATELIMIT-OUTPUT-TOKENS-RESET-XXX
      anthropic-ratelimit-requests-limit:
      - '20000'
      anthropic-ratelimit-requests-remaining:
      - '19999'
      anthropic-ratelimit-requests-reset:
      - '2026-05-07T20:53:45Z'
      anthropic-ratelimit-tokens-limit:
      - ANTHROPIC-RATELIMIT-TOKENS-LIMIT-XXX
      anthropic-ratelimit-tokens-remaining:
      - ANTHROPIC-RATELIMIT-TOKENS-REMAINING-XXX
      anthropic-ratelimit-tokens-reset:
      - ANTHROPIC-RATELIMIT-TOKENS-RESET-XXX
      cf-cache-status:
      - DYNAMIC
      request-id:
      - REQUEST-ID-XXX
      set-cookie:
      - SET-COOKIE-XXX
      strict-transport-security:
      - STS-XXX
      traceresponse:
      - 00-f095e9c7565a1bcd82ed46e1b1b23dec-65cd307f1dc6144d-01
      vary:
      - Accept-Encoding
      x-envoy-upstream-service-time:
      - '100630'
    status:
      code: 200
      message: OK
version: 1