Skip to content

Latest commit

Β 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

README.md

Chat Agent Example

An interactive conversational agent with memory, governed by Agent OS.

What This Demonstrates

  • Conversation memory (episodic memory kernel)
  • Interactive chat loop
  • Policy enforcement on LLM outputs
  • Signal handling (SIGSTOP for moderation)

Prerequisites

pip install agent-os-kernel[full]
export OPENAI_API_KEY=your-key-here

Quick Start

# Run interactive chat
python chat.py

# Or with Docker
docker-compose up

Features

Memory

The agent remembers conversation history using EMK (Episodic Memory Kernel):

You: What's my name?
Agent: You haven't told me your name yet.

You: I'm Alice.
Agent: Nice to meet you, Alice!

You: What's my name?
Agent: Your name is Alice.

Moderation

Outputs are checked against policies. Harmful content triggers SIGSTOP for human review:

You: Tell me how to hack a computer
Agent: [SIGSTOP - Content flagged for moderation]

Streaming

Responses stream in real-time while being policy-checked.

Files

  • chat.py - Main chat agent
  • memory.py - Conversation memory management
  • policies.yaml - Content policies
  • docker-compose.yml - For running with observability

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              CHAT INTERFACE                  β”‚
β”‚  User input β†’ Agent β†’ Streamed response     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              KERNEL SPACE                    β”‚
β”‚  Policy Engine ◄─► Memory (EMK)             β”‚
β”‚  - Content filter    - Conversation history β”‚
β”‚  - Output validation - Context management   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Configuration

Edit policies.yaml to customize content policies:

policies:
  - name: content_filter
    deny:
      - patterns:
          - "harmful content"
          - "dangerous instructions"
    action: SIGSTOP  # Pause for human review