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.1.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.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cognition_core-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 08975a765fe5f5a526d3a1daf1bfcb41de07ea862dc51ef2b73219b0aaca42b2
MD5 86db3d66e0f412206bd14aea92a8eef8
BLAKE2b-256 59f5c8f6dc04c21ebe13667d30e9ab732a43d51605069979a67d16649d667b34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cognition_core-0.1.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 856e91d11979a9f45df08934d4b81283627d332966cc46a2f048e450162c688e
MD5 62710d7fc1480c72a68547e9fca86d56
BLAKE2b-256 bfc2a110fc65e8e5ea18a7a3c6e5edb2c8f9579cd241a5990c85a6a062233ce7

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