Skip to content
A framework for integrated Artificial Intelligence & Artificial General Intelligence (AGI)
C++ Scheme Python C CMake Perl Other
Find file
Latest commit 03d8a6d Apr 28, 2016 @wenwei-dev wenwei-dev Update


Build Status

OpenCog is a framework for developing AI systems, especially appropriate for integrative multi-algorithm systems, and artificial general intelligence systems. Though much work remains to be done, it currently contains a functional core framework, and a number of cognitive agents at varying levels of completion, some already displaying interesting and useful functionalities alone and in combination.

The main project site is at

An interactive tutorial for getting started is available at:

For platform dependent instruction on dependencies and building the code as well as other options for setting up development environment more details are found at:


To build and run OpenCog, the packages listed below are required. With a few exceptions, most Linux distributions will provide these packages. Users of Ubuntu 14.04 "Trusty Tahr" may use the dependency installer at /scripts/octool. Users of any version of Linux may use the Dockerfile to quickly build a container in which OpenCog will be built and run.


Common OpenCog C++ utilities It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.


OpenCog Atomspace database and reasoning engine It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.

Optional Prerequisites

The following packages are optional. If they are not installed, some optional parts of OpenCog will not be built. The CMake command, during the build, will be more precise as to which parts will not be built.

Link Grammar

Natural Language Parser for English, Russian, other languages. Required for experimental Viterbi parser.


MOSES Machine Learning It uses exactly the same build proceedure as this pakcage. Be sure to sudo make install at the end.


Open Graphics Library Used by opencog/spatial/MapTool Commonly provided with your video card driver


Simple DirectMedia Layer Used by opencog/spatial/MapTool | libsdl1.2-dev


Simple DirectMedia Layer extension Used by opencog/spatial/MapTool | libsdl-gfx1.2-dev

Threading Building Blocks

C++ template library for parallel programming | libtbb-dev

ZeroMQ (version 3.2.4 or higher)

Asynchronous messaging library | libzmq3-dev

Building OpenCog

Perform the following steps at the shell prompt:

    cd to project root dir
    mkdir build
    cd build
    cmake ..

Libraries will be built into subdirectories within build, mirroring the structure of the source directory root.

Unit tests

To build and run the unit tests, from the ./build directory enter (after building opencog as above):

    make test

Using OpenCog

OpenCog can be used in one of three ways, or a mixture of all three: By using the GNU Guile scheme interface, by using Python, or by running the cogserver.

Guile provides the easiest interface for creating atoms, loading them into the AtomSpace, and performing various processing operations on them. For examples, see the /examples/guile and the /examples/pattern-matcher directories.

Python is more familiar than scheme (guile) to most programmers, and it offers another way of interfacing to the atomspace. See the /examples/python directory for how to use python with OpenCog.

The cogserver provides a network server interface to OpenCog. It is requires for running embodiment, some of the reasoning agents, and some of the natural-language processing agents.

Running the server

The cogserver provides a network server interface to the various components and agents. After building everything, change directory to your opencog/build folder and execute opencog/cogserver/server/cogserver. Then, from another terminal, run rlwrap telnet localhost 17001 The help command will list all of the other available commands. Notable among these are the commands to attach to a (Postgres) database, and networked scheme and python interfaces (i.e. scheme and python shells that are usable over the network, if you are logged in remotely to the cogserver).

The operation of the server can be altered by means of a config file. This config file is in lib/opencog.conf. To make use of it, say cogserver -c <config-filename> when starting the server.

CMake notes

Some useful CMake's web sites/pages:

The main CMakeLists.txt currently sets -DNDEBUG. This disables Boost matrix/vector debugging code and safety checks, with the benefit of making it much faster. Boost sparse matrixes and (dense) vectors are currently used by ECAN's ImportanceDiffusionAgent. If you use Boost ublas in other code, it may be a good idea to at least temporarily unset NDEBUG. Also if the Boost assert.h is used it will be necessary to unset NDEBUG. Boost ublas is intended to respond to a specific BOOST_UBLAS_NDEBUG, however this is not available as of the current Ubuntu standard version (1.34).

-Wno-deprecated is currently enabled by default to avoid a number of warnings regarding hash_map being deprecated (because the alternative is still experimental!)

Something went wrong with that request. Please try again.