Skip to main content

Interactor

A modular AI interaction framework with streaming, tool calling, context history, session management, retry/backoff logic, multi-provider support, and optional real-time logging.

Built for testability, extensibility, and CLI or programmatic use.

Features

  • Supports OpenAI, Ollama, NVIDIA, Google (Gemini), Anthropic out-of-the-box
  • Streamed output with markdown rendering
  • Tool calling with auto-registration from Python functions
  • Token-aware message cycling (to respect context limits)
  • Persistent sessions with metadata and CRUD via session.py
  • Optional per-instance logging of all interactions
  • Retry logic for rate-limiting and transient failures
  • CLI runner with interactive loop and safe shell command execution

Installation

To install directly from GitHub:

pip install git+https://github.com/woodyk/interactor.git#egg=interactor

Or clone locally and install for development:

git clone https://github.com/woodyk/interactor.git
cd interactor
pip install -e .

Requirements

Defined in requirements.txt:

  • openai
  • aiohttp
  • tiktoken
  • rich

Usage (CLI)

After installing:

interactor

Command-line options:

  • --model: Model in format provider:model (e.g., openai:gpt-4o)
  • --api-key: Optional override (default uses env var)
  • --base-url: Optional custom API base
  • --tools: Enable tool calling
  • --stream: Stream assistant replies
  • --markdown: Render streamed output as markdown

Use /exit or /quit to end the session.

Usage (Python)

from interactor import Interactor, Session

inter = Interactor(
    model="openai:gpt-4o",
    session_enabled=True,
    session_path="~/.interactor_sessions",
    log_path="~/interactor.log"
)

def say_hello(name: str) -> str:
    return f"Hello, {name}!"

inter.add_function(say_hello)

reply = inter.interact("Please greet Ada.")
print(reply)

Session Support

Sessions are JSON files stored on disk.

You can:

  • List and load sessions
  • Create branches from message midpoints
  • Search and update content
  • Automatically summarize a session with interactor.summarize()

Logging

To enable logging:

inter = Interactor(..., log_path="~/my_session.log")

Logs include:

  • User and assistant messages
  • Tool call arguments and results
  • Model switches, session transitions
  • Retry events and exceptions

License

Copyright (c) Wadih Khairallah. All rights reserved.

Licensed for use and modification under the MIT License.

Metadata

Release files for ai-interactor 0.1.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-interactor 0.1.2.5
File Size Uploaded
ai_interactor-0.1.2.5.tar.gz 184.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-interactor 0.1.2.5
File Interpreter ABI Platform
ai_interactor-0.1.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 220.1 kB

Release files / ai_interactor-0.1.2.5.tar.gz

Download URL ai_interactor-0.1.2.5.tar.gz
Size 184.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0fa34efb8f7e5b7bc57bb90b9833c715ea6b9fa0053573aac9f06e19cb7105b3
BLAKE2b-256 checksum
How to use checksums
de5cce47b09c00b9e0da76a74c99bb6e7a280536e9ce8862a630cd2cb2b1761f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / ai_interactor-0.1.2.5-py3-none-any.whl

Download URL ai_interactor-0.1.2.5-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3efe51ea292685e359daaffd85f960a5acd23b52868d3530cc157222ea5317c6
BLAKE2b-256 checksum
How to use checksums
e317e93161c5f63261592d0bb17b6ef5306a878e152407fffad3f24b0c2bcb30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.2.5 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page