Skip to main content

A versatile AI environment to build and control AI agents using a terminal-based interface.

Project description

>_⚡ Instrukt

Terminal AI Commander at your fingertips

coding assistant example

Checkout more demos for more examples.

NOTE: This is a work in progress, expect bugs and api changes.

Introduction

Instrukt is a terminal-based environment for AI productivity and development. It offers a platform where users can:

  • :robot: Create and instruct modular AI agents
  • :card_file_box: Generate document indexes for question-answering
  • :toolbox: Create and attach tools to any agent

Agents are simple drop-in Python packages that can be extended, shared with others, attached to tools and augmented with document indexes. Instruct them in natural language and, for safety, run them inside secure containers (currently implemented with Docker) to perform tasks in their dedicated, sandboxed space :shield:.

Instrukt uses langchain LangChain and allows you to quickly customize agents and tools to your needs.

Built with: Langchain, Textual, Chroma

Consulting Services: Need help with Langchain or AI development/deployment ? You can reach out to me at contact@blob42.xyz

TOC

Usage

Quickstart

  • pip install instrukt[all]
  • export OPENAI_API_KEY with your OpenAI API key.
  • run instrukt
  • If the color scheme is broken, export TERM=xterm-256color

You can run instrukt on headless server such as a docker container with CUDA support.

From source:

  • Make sure the latest version of poetry is installed.
  • Set your virtualenv
  • Clone the repository
  • Run poetry install -E tools --with dev
  • This will install Instrukt including extra tools for agents.

See the installation guide for more details

Requirements:

  • Export OPENAI_API_KEY environment variable with your OpenAI API key.
  • Use a modern terminal that supports 24-bit color and mouse input.

Running:

  • Type instrukt.
  • On the first run, it will create a config file in ~/.config/instrukt/instrukt.yml

From source

  • If you did not install the dependencies using poetry make sure to install textual dev dependencies with: pip install textual[dev]

  • From the project's root run: textual run instrukt.app:InstruktApp

Default Agents:

Chat Q&A: A simple conversational agent. Attach document indexes and tools to create a question-answering agent. It also serves as an example for making custom agents.

Demo: The same agent used in the demo video.

Features

:computer: Keyboard and Mouse Terminal Interface:

  • A terminal-based interface for power keyboard users to instruct AI agents without ever leaving the keyboard.
  • Mouse support and Rich colorful agent outputs such as markdown and source code thanks to the Textual TUI library.
  • Run Instrukt in bare metal and access it remotely via SSH and/or terminal multiplexer.

:robot: Custom AI Agents:

  • Design your own agents and custom tools.
  • Agents are simple python packages can be shared and loaded by other users.

:wrench: Tools:

  • Use the pre-defined toolset or design your own tools.
  • Attach or detach tools to agents on-the-go, tailoring your AI workflows to your needs.

:books: Chat with your code and documents:

  • Index your data and let agents retrieve it for question-answering.
  • Create and organize your indexes with an easy UI.
  • Index creation will auto detect programming languages and optimize the splitting/chunking strategy accordingly.

:zap: Prompt Console :

  • Integrated REPL-Prompt for quick interaction with agents, and a fast feedback loop for development and testing.
  • Add your own custom commands to automate repetitive tasks.
  • Builtin prompt/chat history to quickly edit/correct messages.
  • Use an external editor for editing messages (e.g. vim). ctrl+e

:bird: LangChain:

  • Leverage the LangChain ecosystem to automate anything.
  • Extensible API for integrating with other frameworks.

:microscope: Developer Console:

Debug and introspect agents using an in-built IPython console. ctrl+d

ipython debug shell

:shield: Secure Containers:

  • Run agents inside secure docker containers for safety and privacy.
  • Use gVisor runtime for a full isolation of the agent.

note: The docker agent is only available to Patreon supporters as an early preview.

Document Indexes and Question-Answering

  • Indexes can be created using OpenAI or locally hosted embedding models.
  • They are stored locally using the Chroma embedding database.
  • You create and manage indexes using the Index Management UI (press i)
  • Indexing a directory will auto detect programming languages and use an appropriate splitting strategy optimized for the target language.
  • Indexes can be attached to any agent as a retrieval tool using the index menu in the top of the agent's window.
  • Once an index is attached you can do question-answering and the agent will lookup your indexed documents whenever they are mentioned or needed.

Supported platforms:

  • Linux/Mac.
  • Windows tested under WSL2.

LLM Models

  • Currently only OpenAI supported.
  • Using private local models is the next priority.

Roadmap

  • Private local models

  • Indexing and embeddings

    • Index directories and auto detect content. ( see AutoDirLoader)
    • Detect programming languages and use the appropriate splitter.
    • Load a git repository from URL
    • Load any webpage / website.
  • Documentation

    • Creating agents
    • Creating tools
    • Indexing and chat with documents and source code.
    • Example use cases
    • Tutorials for users non familiar with AI/LLM terms.

Contributing

Any contribution, feedback and PR is welcome !

You can help with:

  • Testing and creating Issues for bugs or features that would be useful.
  • If you have technical skills, you are welcome to create a PR.
  • If you don't have technical skills you can help with documentation, adding examples and tutorials or create new user stories.

Patreon

By becoming a patron, you will help me continue committing time to the development of Instrukt and bring to life all the planned features. Check out the Patreon page for more details on the rewards for early supporters.

Social

Join the Discord server to keep updated on the progress or ask for help.

Vision

I believe that AI should be accessible to everyone and not a walled garden for big corporations and SaaS services.

I hope my contributions will help create tools that empower users without compromising their freedoms. The long-term goal for Instrukt is to make it usable with minimal reliance on external services, giving users the choice to opt for local models and self-hosted services.

License

Copyright (c) 2023 Chakib Ben Ziane. All Rights Reserved.

Instrukt is licensed with a AGPL license, in short this means that it can be used by anyone for any purpose. However, if you decide to make a publicly available instance your users are entitled to a copy of the source code including all modifications that you have made (which needs to be available trough an interface such as a button on your website), you may also not distribute this project in a form that does not contain the source code (Such as compiling / encrypting the code and distributing this version without also distributing the source code that includes the changes that you made. You are allowed to distribute this in a closed form if you also provide a separate archive with the source code.).

Download files

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

Source Distribution

instrukt-0.6.2.tar.gz (517.9 kB view hashes)

Uploaded Source

Built Distribution

instrukt-0.6.2-py3-none-any.whl (584.9 kB view hashes)

Uploaded Python 3

Supported by

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