Welcome to cognition 🧠 an open-source agent framework in Python developed by Polycog, Inc.. The framework implements a neurosymbolic foundation for complex decision-making, natural language processing, structural knowledge representation, and logical & deterministic reasoning.
It enables developers to build trustworthy cognitive agents - agents that are reliable (repeatable, provably correct reasoning), steerable (programmatic enforcement of behavior directives), and explainable (causal provenance of all decisions).
- What it does: Manages the intelligent agent loop, bridging internal cognitive processes with external environmental sensors and actuators.
- Agentic AI Equivalent: Harness
- Why use it: Separates core cognitive reasoning from raw API calls. This creates a clean boundary for safety checks, API mocking, and simulation testing.
- What it does: Design agent behavior via a declarative, state-driven execution machine that matches the current environment state against explicit policy directives.
- Agentic AI Equivalent: Orchestrator
- Why use it: Replaces non-deterministic LLM loops and brittle if-else scripts with declarative state control — enforcing safety guardrails, business logic, and policies at every step.
- What it does: Declares domain knowledge using strongly-typed, validated data models that can be inspected, queried, and mutated at runtime.
- Agentic AI Equivalent: engineered or raw prompt context
- Why use it: Gives agents a typed, queryable source of truth instead of relying on fragile context windows or unvalidated text blobs.
- What it does: Uses LLMs for specific, constrained tasks—such as intent classification (
EnumClassifier), generating natural language from facts (describe_facts), and extracting structured data (ModelPopulator) with automated context engineering. - Agentic AI Equivalent: Structured Outputs
- Why use it: Restricts LLM operations to strict input/output contracts, keeping non-deterministic text generation out of core control flow.
- What it does: Solves planning sub-problems algorithmically to find an optimal sequence of actions to reach a specified target state.
- Agentic AI Equivalent: Chain-of-Thought
- Why use it: Guarantees causal validity, completeness, and efficiency for complex multi-step problems without relying on probabilistic LLM guessing.
Note: This project is under active development. Expect regular updates and new features!
The library is organized into specialized subpackages to handle distinct cognitive tasks:
Core modeling for your (cog)nitive ag(ent) and its surroundings.
cogent: Defines the fundamental agent loop and behaviors.env: Tools for creating and interacting with environmental sensors & actuators.
Frameworks for managing states and decision-making processes over time.
chain: Mechanisms for linking sequences of decisions.core: Core functionality for decision-making.dp: Functionality for knowledge-augmented decision processes.stage: Mechanisms for decision processes based upon singular enumerated field.state: Re-usable state augmentations.
Handle structured data and complex ontologies.
organization: Modules for structuring and linking concepts.representation: Primitives for representing facts, schemas, and semantic relationships.
Tools for interpreting and generating natural language.
classification: Text categorization and intent recognition.description: Capabilities for generating human-readable descriptions of states or actions.population: Tools for extracting data from text to populate knowledge representations.
Engines for logical deduction and automated planning.
planning: IncludesSearchPlannerand various state exploration strategies (DFS, BFS, UCS, A*) using classes likeFrontierManager,PriorityQueue, andSearchState. Allows you to defineStaticandDynamictransition options to navigate state spaces.
Helpful utilities to streamline your code, including...
enumeration: self-documenting and executing data.functypes: convenience function type descriptors.misc: utility code.
pip install polycog-cognitionSuggested exploration plan:
- Tutorials: thematic step-by-step guides, interactive Jupyter Notebooks, and complete Python reference implementations.
- Examples: fully coded mini-applications.
- Cookbook: annotated recipes related to library features.
For detailed technical descriptions & deep dives into the design philosophy:
© 2026 - Polycog, Inc.