Skip to main content

A framework for modeling agent thoughts and conversations

Project description

Thoughtful Agents

A framework for modeling agent thoughts and conversations, enabling more natural and human-like interactions between multiple AI agents and humans.

Overview

Thoughtful Agents provides a structured approach to modeling the internal thought processes of AI agents during conversations. Rather than simply predicting conversational turns, this framework enables proactive AI driven by its own internal "thoughts".

This framework is based on the paper Proactive Conversational Agents with Inner Thoughts, published at CHI 2025.

Key Features

  • Thinking engine for thought generation, evaluation, selection, and articulation
  • System 1 (fast, automatic) and System 2 (slow, deliberate) thinking
  • Mental object management (thoughts, memories)
  • Saliency-based memory and thought retrieval
  • Conversation and event tracking
  • Turn-taking prediction and engine for determining when and who should speak next
  • Proactivity configuration for agents

Installation

pip install thoughtful-agents

Download the required spaCy model:

python -m spacy download en_core_web_sm

Quick Start

import asyncio
from thoughtful_agents.models import Agent, Conversation
from thoughtful_agents.utils.turn_taking_engine import decide_next_speaker_and_utterance, predict_turn_taking_type

async def main():
    # Create a conversation with a simple context
    conversation = Conversation(context="A friendly chat between Alice and Bob.")
    
    # Create agents with specific proactivity configurations
    alice = Agent(name="Alice", proactivity_config={
        'im_threshold': 3.2, 
        'system1_prob': 0.3,
        'interrupt_threshold': 4.5
    })
    
    bob = Agent(name="Bob", proactivity_config={
        'im_threshold': 3.2,
        'system1_prob': 0.3,
        'interrupt_threshold': 4.5
    })
    
    # Add background knowledge to the agents
    alice.initialize_memory("I am a software engineer who likes to code.")
    bob.initialize_memory("I am a cognitive scientist who works on understanding the human mind.")
    
    # Add agents to the conversation
    conversation.add_participant(alice)
    conversation.add_participant(bob)
    
    # Alice starts the conversation
    new_event = await alice.send_message("I'm recently thinking about adopting a cat. What do you think about this?", conversation)
    
    # Predict the next speaker before broadcasting the event
    turn_allocation_type = await predict_turn_taking_type(conversation)
    
    # Broadcast the event to let all agents think
    await conversation.broadcast_event(new_event)
    
    # Decide the next speaker and their utterance
    next_speaker, utterance = await decide_next_speaker_and_utterance(conversation)
    
    if next_speaker:
        await next_speaker.send_message(utterance, conversation)
        print(f"{next_speaker.name}: {utterance}")

if __name__ == "__main__":
    asyncio.run(main())

Documentation

For more detailed documentation and examples, visit the GitHub repository.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Citation

If you use this framework in your research, please cite:

@inproceedings{liu2025inner,
    title={Proactive Conversational Agents with Inner Thoughts},
    author={Liu, Xingyu Bruce and Fang, Shitao and Shi, Weiyan and Wu, Chien-Sheng and Igarashi, Takeo and Chen, Xiang Anthony},
    booktitle = {Proceedings of the 2025 CHI Conference on Human Factors in Computing Systems},
    year = {2025},
    publisher = {Association for Computing Machinery},
    address = {New York, NY, USA},
    location = {Yokohama, Japan},
    series = {CHI '25},
    keywords = {Full},    
    url = {https://doi.org/10.1145/3706598.3713760},
    doi = {10.1145/3706598.3713760},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thoughtful_agents-0.1.1.tar.gz (668.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thoughtful_agents-0.1.1-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file thoughtful_agents-0.1.1.tar.gz.

File metadata

  • Download URL: thoughtful_agents-0.1.1.tar.gz
  • Upload date:
  • Size: 668.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for thoughtful_agents-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d45e8cd2c7b429317e5fd730a5df0e6158737fd391e4399c54fc953e014e8c13
MD5 e66aa41cccee07d3b34704e65d226268
BLAKE2b-256 76df89c38b14120e01d647c19c5dd50fcd9bb64d320d3d8610955bb1606b4ac1

See more details on using hashes here.

File details

Details for the file thoughtful_agents-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for thoughtful_agents-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4d55bc30546106afb3923e4215adb8a490260c80d94015127c5e59b7b68bad46
MD5 4d761be2aa22e40530f0959bd9054a9a
BLAKE2b-256 d6676b60e40264fe6c8ade4e11f2289934b96d5c52450dc846052734b73ba74d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page