Metadata-Version: 2.4
Name: noesium
Version: 0.2.2
Summary: Towards a cognitive agentic framework
Author-email: Xiaming Chen <chenxm35@gmail.com>
Maintainer-email: Xiaming Chen <chenxm35@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/mirasoth/noesium
Project-URL: Repository, https://github.com/mirasoth/noesium
Keywords: agents,multi-agent system,cognition,artificial intelligence
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.0.0
Requires-Dist: requests>=2.31.0
Requires-Dist: aiohttp>=3.12.15
Requires-Dist: python-dotenv>=1.1.1
Requires-Dist: colorlog>=6.8.0
Requires-Dist: typing-extensions>=4.8.0
Requires-Dist: pydantic-settings>=2.12.0
Provides-Extra: google
Requires-Dist: google-genai>=1.5.0; extra == "google"
Requires-Dist: google-api-python-client>=2.174.0; extra == "google"
Requires-Dist: google-auth-oauthlib>=1.2.2; extra == "google"
Requires-Dist: google-auth>=2.40.3; extra == "google"
Provides-Extra: aliyun
Requires-Dist: aliyun-python-sdk-core<3.0.0,>=2.13.1; extra == "aliyun"
Provides-Extra: llm
Requires-Dist: litellm>=1.0.0; extra == "llm"
Requires-Dist: openai>=1.0.0; extra == "llm"
Requires-Dist: instructor>=1.10.0; extra == "llm"
Provides-Extra: local-llm
Requires-Dist: ollama>=0.5.3; extra == "local-llm"
Requires-Dist: llama-cpp-python>=0.3.16; extra == "local-llm"
Requires-Dist: huggingface-hub>=0.34.4; extra == "local-llm"
Provides-Extra: ai-providers-all
Requires-Dist: noesium[aliyun,google,llm,local-llm]; extra == "ai-providers-all"
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.3.72; extra == "langchain"
Requires-Dist: langchain-text-splitters>=0.3.0; extra == "langchain"
Requires-Dist: langchain-ollama>=0.2.0; extra == "langchain"
Requires-Dist: langgraph>=0.5.4; extra == "langchain"
Provides-Extra: agents
Requires-Dist: noesium[langchain]; extra == "agents"
Requires-Dist: bubus>=1.5.6; extra == "agents"
Provides-Extra: postgres
Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgres"
Requires-Dist: psycopg2>=2.9.10; extra == "postgres"
Provides-Extra: weaviate
Requires-Dist: weaviate-client<5,>=4; extra == "weaviate"
Requires-Dist: protobuf<6,>=5; extra == "weaviate"
Provides-Extra: datascience
Requires-Dist: networkx>=3.5; extra == "datascience"
Requires-Dist: matplotlib>=3.8.0; extra == "datascience"
Requires-Dist: pexpect>=4.9.0; extra == "datascience"
Requires-Dist: ipython>=8.18.0; extra == "datascience"
Requires-Dist: pandas>=2.0.0; extra == "datascience"
Provides-Extra: mcp
Requires-Dist: mcp>=1.0.0; extra == "mcp"
Provides-Extra: tools
Requires-Dist: noesium[aliyun,datascience,google,mcp]; extra == "tools"
Requires-Dist: wizsearch<2.0.0,>=1.0.1; extra == "tools"
Requires-Dist: arxiv>=2.2.0; extra == "tools"
Requires-Dist: pillow<12.0,>=10.1.0; extra == "tools"
Requires-Dist: pymupdf>=1.23.0; extra == "tools"
Requires-Dist: openpyxl>=3.1.5; extra == "tools"
Requires-Dist: wikipedia-api>=0.6.0; extra == "tools"
Requires-Dist: aiofiles>=24.1.0; extra == "tools"
Provides-Extra: browser-use
Requires-Dist: screeninfo>=0.8.1; extra == "browser-use"
Requires-Dist: uuid7>=0.1.0; extra == "browser-use"
Requires-Dist: authlib>=1.6.0; extra == "browser-use"
Requires-Dist: pypdf>=5.7.0; extra == "browser-use"
Requires-Dist: cdp-use>=1.4.4; extra == "browser-use"
Requires-Dist: html2text>=2025.4.15; extra == "browser-use"
Requires-Dist: psutil>=7.0.0; extra == "browser-use"
Requires-Dist: pillow>=11.3.0; extra == "browser-use"
Requires-Dist: anyio>=4.9.0; extra == "browser-use"
Requires-Dist: httpx>=0.28.1; extra == "browser-use"
Requires-Dist: cloudpickle>=3.1.1; extra == "browser-use"
Provides-Extra: all
Requires-Dist: noesium[agents,ai-providers-all,browser-use,postgres,tools,weaviate]; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest<9,>=8.2; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=1.1.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.12.0; extra == "dev"
Requires-Dist: mypy>=1.10.0; extra == "dev"
Requires-Dist: autoflake>=2.3.1; extra == "dev"
Requires-Dist: flake8>=7.3.0; extra == "dev"
Dynamic: license-file

# Noesium

[![CI](https://github.com/mirasoth/noesium/actions/workflows/ci.yml/badge.svg)](https://github.com/mirasoth/noesium/actions/workflows/ci.yml)
[![PyPI version](https://img.shields.io/pypi/v/noesium.svg)](https://pypi.org/project/noesium/)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/mirasoth/noesium)

Project Noesium is an initiative to develop a computation-driven, cognitive agentic system. This repo contains the foundational abstractions (Agent, Memory, Tool, Goal, Orchestration, and more) along with essential modules such as LLM clients, logging, message buses, model routing, and observability. For the underlying philosophy, refer to my talk on MAS ([link](https://github.com/caesar0301/mas-talk-2508/blob/master/mas-talk-xmingc.pdf)).

## Installation

```bash
pip install -U noesium
```

### Optional Dependencies

Noesium provides optional dependency groups for different usage scenarios:

```bash
# AI Providers
pip install noesium[google]          # Google GenAI, API Client, Auth
pip install noesium[aliyun]          # Aliyun Python SDK
pip install noesium[llm]             # LiteLLM, OpenAI, Instructor
pip install noesium[local-llm]       # Ollama, LlamaCPP, HuggingFace Hub
pip install noesium[ai-providers-all] # All AI providers above

# Frameworks
pip install noesium[langchain]       # LangChain Core, Text Splitters, Ollama, LangGraph
pip install noesium[agents]          # LangChain + Bubus for agent frameworks

# Database & Vector Stores
pip install noesium[postgres]        # PostgreSQL with psycopg2
pip install noesium[weaviate]        # Weaviate vector database

# Data Science Tools
pip install noesium[datascience]     # NetworkX, Matplotlib, Pandas, IPython, pexpect

# Browser Automation
pip install noesium[browser-use]     # Screen info, CDP client, PDF/HTML processing, PIL

# MCP Support
pip install noesium[mcp]             # Model Context Protocol

# Toolkits
pip install noesium[tools]           # All toolkits (search, arxiv, document, image, etc.)

# Full installation (recommended for most users)
pip install noesium[all]             # All optional dependencies except dev

# Development
pip install noesium[dev]             # pytest, black, isort, mypy, etc.
```

## Core Modules

| Module | Description |
|--------|-------------|
| **LLM Integration** (`noesium.core.llm`) | Multi-provider support (OpenAI, OpenRouter, Ollama, LlamaCPP, LiteLLM), dynamic routing, token tracking |
| **Goal Management** (`noesium.core.goalith`) | LLM-based goal decomposition, DAG-based goal graph, dependency tracking |
| **Tool Management** (`noesium.core.toolify`) | Tool registry, MCP integration, 17+ built-in toolkits |
| **Memory** (`noesium.core.memory`) | MemU integration, embedding-based retrieval, multi-category storage |
| **Vector Store** (`noesium.core.vector_store`) | PGVector and Weaviate support, semantic search |
| **Message Bus** (`noesium.core.msgbus`) | Event-driven architecture, watchdog patterns |
| **Routing** (`noesium.core.routing`) | Dynamic complexity-based model selection |
| **Tracing** (`noesium.core.tracing`) | Token usage monitoring, Opik integration |

## Built-in Agents

- **AskuraAgent** - Conversational agent for collecting semi-structured information via human-in-the-loop workflows
- **SearchAgent** - Web search with query polishing, multi-engine support, and optional content crawling
- **DeepResearchAgent** - Iterative research with LLM-powered reflection and citation generation
- **MemoryAgent** - Memory management with categorization, embedding search, and memory linking

## Built-in Toolkits

Tool management (`noesium.core.toolify`) ships with 17+ toolkits. Full details and tool lists are in [AGENTS.md](AGENTS.md).

| Toolkit | Registration | Description |
|---------|--------------|-------------|
| **Search** | `search` | Google/Serper search, web content fetch, Tavily/Google AI search, LLM Q&A on pages |
| **Bash** | `bash` | Run shell commands, get cwd, list directory (workspace-isolated, secure) |
| **Memory** | `memory` | Read/write/edit/append/clear named slots, list slots, search, stats |
| **Python Executor** | `python_executor` | Execute Python code (IPython, timeout, plot capture) |
| **ArXiv** | `arxiv` | Search and download papers, get paper details (arXiv API) |
| **Audio** | `audio` | Transcribe audio (Whisper), audio Q&A; local/URL, caching |
| **Audio Aliyun** | `audio_aliyun` | Transcribe and Q&A via Aliyun NLS (Lingjie); URL input |
| **Document** | `document` | Parse PDF/Office, extract text, document Q&A (Chunkr/PyMuPDF) |
| **File Edit** | `file_edit` | Create/read/write/delete files, list/search, backups, sanitized paths |
| **GitHub** | `github` | Repo info, contents, releases, repository search |
| **Gmail** | `gmail` | Authenticate, recent/search emails, extract verification codes |
| **Image** | `image` | Analyze/describe/compare images, OCR, info (URL or local) |
| **Serper** | `serper` | Google search, images, news, scholar, maps, video, places, autocomplete, Lens |
| **Tabular Data** | `tabular_data` | Column info, summaries, data quality checks for CSV/Excel |
| **User Interaction** | `user_interaction` | Ask user, confirm, choices, display message, final answer, interaction history |
| **Video** | `video` | Analyze video and Q&A (Gemini), video metadata |
| **Wikipedia** | `wikipedia` | Search, get page/summary, random page, categories, page views |

## Quick Start

### LLM Client

```python
from noesium.core.llm import get_llm_client

# Create client (supports openai, openrouter, ollama, llamacpp)
client = get_llm_client(provider="openai", api_key="sk-...")

# Chat completion
response = client.completion([{"role": "user", "content": "Hello!"}])

# Structured output
from pydantic import BaseModel

class Answer(BaseModel):
    text: str
    confidence: float

client = get_llm_client(provider="openai", structured_output=True)
result = client.structured_completion(messages, Answer)
```

### Tool Management

```python
from noesium.core.toolify import BaseToolkit, ToolkitConfig, ToolkitRegistry, register_toolkit

@register_toolkit("calculator")
class CalculatorToolkit(BaseToolkit):
    def get_tools_map(self):
        return {"add": self.add, "multiply": self.multiply}

    def add(self, a: float, b: float) -> float:
        return a + b

    def multiply(self, a: float, b: float) -> float:
        return a * b

# Use toolkit
config = ToolkitConfig(name="calculator")
calc = ToolkitRegistry.create_toolkit("calculator", config)
result = calc.call_tool("add", a=5, b=3)
```

### Goal Decomposition

```python
from noesium.core.goalith.goalgraph.node import GoalNode
from noesium.core.goalith.goalgraph.graph import GoalGraph
from noesium.core.goalith.decomposer import LLMDecomposer

# Create and decompose a goal
goal = GoalNode(description="Plan a product launch", priority=8.0)
graph = GoalGraph()
graph.add_node(goal)

decomposer = LLMDecomposer()
subgoals = decomposer.decompose(goal, context={"budget": "$50,000"})
```

### Search Agent

```python
from noesium.agents.search import SearchAgent, SearchConfig

config = SearchConfig(
    polish_query=True,
    search_engines=["tavily"],
    max_results_per_engine=5
)
agent = SearchAgent(config=config)
results = await agent.search("latest developments in quantum computing")
```

### Deep Research Agent

```python
from noesium.agents.deep_research import DeepResearchAgent, DeepResearchConfig

config = DeepResearchConfig(
    number_of_initial_queries=3,
    max_research_loops=3,
    web_search_citation_enabled=True
)
agent = DeepResearchAgent(config=config)
result = await agent.research("What are the implications of AI on healthcare?")
```

## Environment Variables

```bash
# LLM Providers
export NOESIUM_LLM_PROVIDER="openai"
export OPENAI_API_KEY="sk-..."
export OPENROUTER_API_KEY="sk-..."
export OLLAMA_BASE_URL="http://localhost:11434"
export LLAMACPP_MODEL_PATH="/path/to/model.gguf"

# Vector Store (PostgreSQL)
export POSTGRES_HOST="localhost"
export POSTGRES_PORT="5432"
export POSTGRES_DB="vectordb"
export POSTGRES_USER="postgres"
export POSTGRES_PASSWORD="postgres"

# Search Tools
export SERPER_API_KEY="..."
export JINA_API_KEY="..."
```

## Examples

See the `examples/` directory for comprehensive usage examples:

- `examples/agents/` - Agent demos (Askura, Search, DeepResearch)
- `examples/llm/` - LLM provider examples and token tracking
- `examples/goals/` - Goal decomposition patterns
- `examples/memory/` - Memory agent operations
- `examples/tools/` - Toolkit demonstrations
- `examples/vector_store/` - PGVector and Weaviate usage

## Documentation

- **Design Specifications**: `specs/` directory contains RFCs for system architecture
- **Agent Details**: See `AGENTS.md` for comprehensive agent and toolkit documentation
- **Toolify System**: `noesium/core/toolify/README.md`

## License

MIT License - see [LICENSE](LICENSE) file for details.
