Skip to main content

Core integration package for building AI agents with CrewAI, providing configuration management, memory systems, and tool integration

Project description

Cognition Core

Core integration package for building AI agents with CrewAI, providing configuration management, memory systems, and tool integration.

Architecture

Cognition AI

cognition-core/
├── config/                  # Configuration files
│   ├── agents.yaml         # Agent definitions
│   ├── crew.yaml          # Crew settings
│   ├── memory.yaml        # Memory configuration
│   ├── portkey.yaml       # LLM routing
│   ├── tasks.yaml         # Task definitions
│   └── tools.yaml         # Tool configuration
├── memory/                 # Memory implementations
│   ├── entity.py          # Entity memory
│   ├── long_term.py       # Long-term storage
│   ├── short_term.py      # Short-term memory
│   ├── storage.py         # Storage interfaces
│   └── mem_svc.py         # Memory service
├── tools/                  # Tool management
│   ├── custom_tool.py     # Custom tool base
│   ├── tool_svc.py        # Tool service
│   └── __init__.py
└── crew.py                # Core crew base class

Features

Configuration Management

  • Hot-reloading YAML configuration
  • Environment variable integration
  • Centralized settings management

Memory Systems

  • Short-term memory (Redis)
  • Long-term memory (Firestore)
  • Entity memory for relationship tracking
  • Configurable storage backends

Tool Integration

  • Tool registry and service
  • API wrapper utilities
  • Configuration-driven tool management

LLM Integration

  • Portkey routing and monitoring
  • Multi-model support
  • Performance optimization

Installation

pip install cognition-core

Quick Start

from cognition_core import CognitionCoreCrewBase
from crewai import Agent, Task, Crew

class YourCrew(CognitionCoreCrewBase):
    @agent
    def researcher(self) -> Agent:
        return Agent(
            config=self.agents_config["researcher"],
            llm=self.init_portkey_llm(
                model="gpt-4",
                portkey_config=self.portkey_config
            ),
            verbose=True
        )

    @crew
    def crew(self) -> Crew:
        return Crew(
            agents=self.agents,
            tasks=self.tasks,
            process=Process.sequential,
            memory=True,
            verbose=True
        )

Configuration

Example YAML configuration:

# memory.yaml
short_term_memory:
  enabled: true
  external: true
  host: "redis.example.com"
  port: 6379

long_term_memory:
  enabled: true
  external: true
  connection_string: "${LONG_TERM_DB_CONNECTION_STRING}"

Environment Variables

Required variables:

  • PORTKEY_API_KEY: Portkey API key
  • PORTKEY_VIRTUAL_KEY: Portkey virtual key
  • LONG_TERM_DB_PASSWORD: Long-term storage password
  • CONFIG_DIR: Configuration directory path (default: src/cognition-core/config)

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request with tests

License

MIT

Project details


Download files

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

Source Distribution

cognition_core-0.3.0.tar.gz (131.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cognition_core-0.3.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file cognition_core-0.3.0.tar.gz.

File metadata

  • Download URL: cognition_core-0.3.0.tar.gz
  • Upload date:
  • Size: 131.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for cognition_core-0.3.0.tar.gz
Algorithm Hash digest
SHA256 36fc02b877c707424f89996eb6f057e3b4eb737bb3b3492945bfdf3e61eaf469
MD5 e8afec883801cd91e80500a0c0c23a94
BLAKE2b-256 792436817bfc7a2107e28f236aaaa41990a21a3f8dcfff2180e51692303798cc

See more details on using hashes here.

File details

Details for the file cognition_core-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: cognition_core-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for cognition_core-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14f1842b5ff30cead3ff72c8a4a03d7dc52ad2f2d8e57dec93352c47664f754a
MD5 d8168f7d223d0291250f2eda60315f75
BLAKE2b-256 4b2f03517019ca5e02d11826a1ce876a26bce7a0accce80a94a921ecffd4c45e

See more details on using hashes here.

Supported by

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