Metadata-Version: 2.4
Name: logosai
Version: 0.17.1
Summary: Build AI agents in 4 lines. Orchestrate 63+ agents. Self-evolving. Observable.
Author-email: LogosAI Team <info@logosai.info>
Maintainer-email: LogosAI Team <info@logosai.info>
License: MIT License
        
        Copyright (c) 2023-2026 LogosAI
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE. 
Project-URL: Homepage, https://github.com/maior/logosai-framework
Project-URL: Documentation, https://github.com/maior/logosai-framework#readme
Project-URL: Repository, https://github.com/maior/logosai-framework
Project-URL: Issues, https://github.com/maior/logosai-framework/issues
Keywords: ai,agent,llm,multi-agent,orchestration,framework,self-evolution,agentic
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3.8.0
Requires-Dist: requests>=2.25.0
Requires-Dist: websocket-client>=1.2.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: loguru>=0.7.0
Requires-Dist: python-dotenv>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: isort>=5.10.0; extra == "dev"
Requires-Dist: mypy>=0.900; extra == "dev"
Provides-Extra: llm
Requires-Dist: openai>=1.0.0; extra == "llm"
Requires-Dist: anthropic>=0.3.0; extra == "llm"
Requires-Dist: google-genai>=1.0.0; extra == "llm"
Provides-Extra: langchain
Requires-Dist: langchain>=0.1.0; extra == "langchain"
Requires-Dist: langchain-openai>=0.0.8; extra == "langchain"
Requires-Dist: langchain-community>=0.0.28; extra == "langchain"
Provides-Extra: agentic
Requires-Dist: google-genai>=1.0.0; extra == "agentic"
Provides-Extra: monitoring
Provides-Extra: desktop
Requires-Dist: pyautogui>=0.9.50; extra == "desktop"
Requires-Dist: pillow>=9.0.0; extra == "desktop"
Provides-Extra: tools
Requires-Dist: tavily-python>=0.3.0; extra == "tools"
Requires-Dist: rich>=13.0.0; extra == "tools"
Provides-Extra: all
Requires-Dist: logosai[llm]; extra == "all"
Requires-Dist: logosai[desktop]; extra == "all"
Requires-Dist: logosai[tools]; extra == "all"
Dynamic: license-file

# LogosAI

[![PyPI](https://img.shields.io/pypi/v/logosai.svg)](https://pypi.org/project/logosai/)
[![Python](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![GitHub](https://img.shields.io/badge/GitHub-logosai--framework-181717?logo=github)](https://github.com/maior/logosai-framework)

**Build an AI agent in 4 lines. Orchestrate many. See every run.**

LogosAI is a Python framework for building, orchestrating, and evolving AI agents. Create a single agent with minimal code, or build a multi-agent system where agents collaborate, debate, learn from each other, and improve themselves autonomously — with full observability via LogosPulse.

```bash
pip install "logosai[llm]"        # framework + OpenAI, Anthropic and Gemini SDKs
export GOOGLE_API_KEY=...         # default provider is Gemini — https://aistudio.google.com/apikey
```

No Google key? Use what you have: `export LOGOSAI_LLM_PROVIDER=openai` (or `anthropic`, `ollama`, …) and the matching key.
Runnable scripts for everything below are in [`samples/`](samples/).

> **Writing code with an LLM?** Give it the bundled guide: `python -m logosai.guide`
> (source: [`logosai/llms.txt`](logosai/llms.txt)). Every example in it is executed by the test suite.

## Architecture

<p align="center">
  <img src="https://raw.githubusercontent.com/maior/logosai-framework/main/docs/architecture-overview.svg" alt="LogosAI System Architecture" width="100%"/>
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/maior/logosai-framework/main/docs/self-evolution-flow.svg" alt="Self-Evolution Flow" width="100%"/>
</p>

## What is in this package

Everything in this table ships with `pip install logosai` and is covered by the test suite (about 1,300 tests).
The last column says what we know from running it against real models, including what does not work well yet.

| Area | What you get | Status and limits |
|---|---|---|
| **Agent creation** | `@agent` decorator (4 lines), `SimpleAgent`, `LogosAIAgent` | Stable |
| **LLM client** | One client for OpenAI, Anthropic, Gemini, Ollama and OpenAI-compatible servers; streaming; structured output | Adapts to a provider's rejected request parameter and remembers it. A model that refuses tools on chat.completions is asked through the Responses API (OpenAI only) |
| **Tool use** | `register_tool()`, `run_with_tools()` | A loop that ends with no answer is an error, not a success. Small models still skip tools sometimes |
| **ReAct** | `react()` — think, act, observe | On gemini-2.5-flash-lite: lookups answered correctly in 8 of 10 runs (small sample) |
| **Memory** | `memorize()`, `recall()` — PostgreSQL with an in-memory fallback; SQLite store for personal mode; embedding search | Embedding search needs an embedding provider |
| **Planning** | `plan()`, `plan_stream()` — goal decomposition | — |
| **Multi-agent** | `call_agent()`, `delegate()`, `spawn_agent()`, debate, message bus | — |
| **Orchestration** | `logosai.orchestration` — plan, validate, run (sequential, parallel, hybrid), streaming progress; a fit check for one-agent plans | The planner is an LLM: on our 35-scenario set it scores about 261 of 280, and unrelated prompt changes move which scenarios fail |
| **Resident** | `logosai resident` — standing goals, schedule, journal, requests for new agents | A person adds or approves every goal and every new agent |
| **Playbooks** | Procedures an agent proposes and a person approves | With one approved playbook, flash-lite followed it in 11 of 12 runs; not measured with many playbooks |
| **Observability** | Trace spans, executions and LLM calls sent to [LogosPulse](https://github.com/maior/logosai-pulse) | Opt-in — nothing is sent until you enable it |
| **MCP bridge** | `logosai mcp` — use your agents from Claude Code or Codex | — |
| **Self-evolution** | `logosai.evolution` — detect failures, propose fixes | Off by default. Automatic repair and deploy need an agent runtime and [FORGE](#forge-agent-builder-optional) |

**Not in this package.** The desktop, document-generation, maps and scheduled-report agents described further
down run in the authors' reference deployment (an ACP server with about 90 registered agents). That deployment is
not published. This repository ships the framework, the server (`SimpleACPServer`) and two sample agents; the
sections below that describe those agents are marked.

## Quick Start

### 1. One-Line LLM Call

```python
import asyncio
from logosai import quick_llm

async def main():
    answer = await quick_llm("What is the capital of France?")
    print(answer)  # "The capital of France is Paris."

asyncio.run(main())
```

### 2. Build an Agent (4 Lines)

```python
import asyncio
from logosai import agent, AgentResponse

@agent(name="Joke Agent", description="Tells jokes about any topic")
async def joke_agent(query, context=None, llm=None):
    response = await llm.invoke(f"Tell a short joke about: {query}")
    return AgentResponse.success(content={"answer": response.content})

async def main():
    instance = joke_agent()              # @agent returns a factory — create an instance
    result = await instance.process("cats")
    print(result.content["answer"])

asyncio.run(main())
```

### 3. Build an Agent (Class-Based)

```python
from logosai import SimpleAgent, AgentResponse

class TranslatorAgent(SimpleAgent):
    agent_name = "Translator"
    agent_description = "Translates text between languages"

    async def handle(self, query, context=None):
        translation = await self.ask_llm(f"Translate to English: {query}")
        return AgentResponse.success(content={"answer": translation})
```

### 4. Run a Multi-Agent Server

```python
from logosai import SimpleAgent, AgentResponse
from logosai.acp import SimpleACPServer

class MathAgent(SimpleAgent):
    agent_name = "Math Agent"
    agent_description = "Solves math problems"

    async def handle(self, query, context=None):
        answer = await self.ask_llm(f"Calculate: {query}")
        return AgentResponse.success(content={"answer": answer})

server = SimpleACPServer(port=9000)
server.add(MathAgent())
server.run()
```

```bash
# List agents
curl localhost:9000/jsonrpc -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"list_agents"}'

# SSE streaming
curl -N "localhost:9000/stream?query=3+5&agent_id=math_agent"
```

### 5. Use Your Agents from Claude Code · Codex (MCP)

`logosai mcp` exposes any ACP server — `logosai serve` or a full ACP deployment — to MCP
clients over stdio. The bridge speaks ACP (`list_agents` + `POST /stream`), so the server
needs no extra endpoint.

```bash
# Claude Code
claude mcp add logosai -- logosai mcp --acp http://localhost:9000
# Codex
codex mcp add logosai -- logosai mcp --acp http://localhost:9000
```

| Option | Meaning |
|---|---|
| `--mode router` (default) | Two tools: `logosai_agents` (list) and `logosai_ask(query, agent_id?)`. Without `agent_id` the server picks the agent |
| `--mode direct` | One tool per agent |
| `--agents a,b` | Allowlist. Anything else is refused **before** it reaches the server; with an allowlist, `logosai_ask` requires `agent_id` |
| `--timeout 300` | Seconds per agent run |
| `LOGOSAI_ACP_TOKEN` (env) | Bearer token. Not accepted as a flag — flags end up in plaintext in the client's config file |

**Claude Code plugin** — installs the bridge, two commands and a usage skill in one step:

```text
/plugin marketplace add maior/logosai-framework
/plugin install logosai-acp@logosai
```

On install Claude Code asks for the `logosai` executable path, the ACP URL and the agent
allowlist (change them later with `/plugin configure logosai-acp`). Commands:
`/logosai-acp:ask [agent_id] <question>` and `/logosai-acp:agents`.

Keep agents that touch files, mail or the desktop out of the allowlist unless you mean to
let an external AI call them. Codex asks for approval on each MCP tool call; in
non-interactive `codex exec` use `--approve-for-me`.

### 6. LLM Client (Multi-Provider)

```python
import asyncio
from logosai import LLMClient

async def main():
    client = LLMClient(provider="google", model="gemini-2.5-flash-lite")
    response = await client.invoke("Explain async/await in Python")   # initializes on first use
    print(response.content)

asyncio.run(main())
```

Supported: `openai`, `anthropic`, `google` (Gemini), `ollama`

## Installation

```bash
pip install "logosai[llm]"   # Framework + LLM providers (OpenAI, Anthropic, Gemini) — start here
pip install logosai          # Core only — bring your own provider SDK (e.g. `pip install openai`)
pip install "logosai[all]"   # + All optional dependencies
```

## Features

### Core
- **`@agent` decorator** — 4-line agent creation
- **`SimpleAgent`** — Class-based with `ask_llm()` helper
- **`quick_llm()`** — One-shot LLM call
- **`LLMClient`** — Unified multi-provider client (OpenAI, Anthropic, Gemini, Ollama)
- **`LogosAIAgent`** — Full-featured base with async lifecycle and mixin composition

### Multi-Agent Orchestration
- **SimpleACPServer** — Host agents with JSON-RPC + SSE streaming
- **Message Bus** — Pub/sub with topic routing and priorities
- **Workflow Orchestrator** — `logosai.orchestration.WorkflowOrchestrator`: query → plan → validate → run (sequential, parallel, hybrid), with streaming progress
- **Workflow Engine** — `logosai.workflow.WorkflowEngine`: hand compound queries off from your own agent router (`total_tasks == 0` = handle it yourself)
- **Dynamic Routing** — Tag-based auto-discovery, no hardcoded routes
- **Data Flow** — Previous agent results automatically injected into next agent's query
- **Document Search** — Semantic search across project docs (LLM-indexed, "where is this info?")

### Agent Communication (4 Levels)

```
L1: call_agent()      — Data passing (query → result)
L2: Debate System     — 5-phase workflow negotiation (propose → vote → consensus)
L3: Collaboration     — ask_opinion(), share_finding(), request_help()
L4: Learning          — share_learning(), get_learnings() (persisted across sessions)
```

```python
# L1: Call another agent
result = await self.call_agent("internet_agent", "Seoul weather")

# L3: Ask for opinion (not just data — shares reasoning)
opinion = await self.ask_opinion("analysis_agent",
    "Is this a seasonal pattern?",
    my_analysis={"pattern": "March spike", "confidence": 0.6})

# L4: Share what you learned (persisted for all agents)
await self.share_learning(
    pattern="Gmail compose overlay breaks JS selectors",
    solution="Add &fs=1 to compose URL",
    tags=["gmail", "chrome"])

# L4: Learn from others
learnings = await self.get_learnings(tags=["gmail"])
```

### Agentic AI — Mixin Architecture

`LogosAIAgent` is built from composable mixins, each independently usable:

| Mixin | File | Capabilities |
|-------|------|--------------|
| **ToolUseMixin** | `mixins/tool_use.py` | `register_tool()`, `run_with_tools()`, `register_tool_object()` |
| **MemoryMixin** | `mixins/memory.py` | `memorize()`, `recall()`, `forget()` — embedding hybrid search |
| **ReActMixin** | `mixins/react.py` | `react()` — Think→Act→Observe loop |
| **PlanningMixin** | `mixins/planning.py` | `plan()`, `plan_stream()` — Goal decomposition tree |
| **MultiAgentMixin** | `mixins/multi_agent.py` | `call_agent()`, `delegate()`, `spawn_agent()` |
| **PlaybookMixin** | `mixins/playbook.py` | `propose_playbook()`, `select_playbook()` — procedure notes; a person approves them |
| **HttpToolMixin** | `mixins/http_tool.py` | call an external HTTP tool and use only what it returns |

```python
# Tool Use — 3 ways to register tools
agent.register_tool("calc", "Calculator", calc_func, params)          # existing
agent.register_tool_object(Tool(name="calc", category="math", ...))   # new: Tool dataclass
agent.register_tool_object(@tool_decorator(...))                       # new: auto-parse signature

# ReAct — Think → Act → Observe loop
result = await agent.react(
    "Calculate compound interest: $10K at 8% for 5 years, then convert to KRW",
    tools=BUILTIN_TOOLS, tool_executors=BUILTIN_EXECUTORS,
)
# → Thought: "Need to calculate compound interest"
# → Action: calculator(10000 * 1.08**5) → $14,693
# → Thought: "Now convert to KRW"
# → Action: calculator(14693 * 1380) → ₩20,276,340
# → Final Answer: "₩20,276,340"

# Persistent Memory — embedding hybrid search
await agent.memorize("user_pref", "User prefers Korean", importance=0.9)
memories = await agent.recall("user")  # Auto-injected into LLM context
# Semantic: query "수도 날씨" finds memory "서울 기온" via cosine similarity

# Goal Decomposition
plan = await agent.plan("Build a web scraper for news articles")
# → Sub-goals: fetch → parse → store → deduplicate → schedule
async for step in agent.plan_stream("Build a web scraper"):
    print(step)  # Streams decomposition steps in real-time

# Structured Output — enforce JSON schema (`ask_llm_structured` and `ask_llm_stream` are `SimpleAgent` methods)
from pydantic import BaseModel
class Weather(BaseModel):
    city: str
    temperature: float

result = await agent.ask_llm_structured("Seoul weather", Weather)
# → Weather(city="Seoul", temperature=22.5)

# Dynamic Sub-Agent — create specialists at runtime
translator = agent.spawn_agent("translator", "Translates text", my_func)
results = await agent.delegate([
    {"agent_id": "translator", "query": "Hello"},
    {"agent_id": "calculator", "query": "1+1"},
], parallel=True)

# LLM Streaming — token-by-token
async for chunk in agent.ask_llm_stream("Tell me about AI"):
    print(chunk, end="")
```

### Resident — one agent that stays

`logosai resident` keeps standing goals, runs each when it is due through an orchestrator, and
journals every run. It never plans or calls a model itself.

```bash
logosai resident add "Summarize today's USD/KRW rate in one line" --every 1d
logosai resident run --once          # run what is due now; `run` keeps going
logosai resident goals               # status, runs, failures in a row
logosai resident journal
```

- You add goals. The agent can only propose one (`Resident.propose_goal`), and a proposed goal
  does not run until `logosai resident approve <id>`.
- A run counts as done only if it is not a failure, its evaluation (when the orchestrator gives
  one) passed, and it carries an answer. An executor exception is a failed run, not a crash.
- One tick runs at most 3 goals; a goal that fails 3 times in a row is paused until
  `logosai resident resume <id>`. Minimum interval 60 seconds.
- State: `~/.logosai/resident/<name>/goals.json` and `journal.jsonl` (`LOGOSAI_RESIDENT_DIR`).
- From code, pass any `async (goal_text) -> result` as the executor:
  `Resident("desk", executor=my_agent.process)`. `notify=` is optional and off by default.
- When a goal is paused because every run of the streak gave an answer that failed evaluation, the resident
  records a request for a new agent with those runs as evidence (`logosai resident growth`). Nothing is built
  until you run `logosai resident growth-approve <id>`; the goal is then run once more and resumed only if it passes.
  Outages do not produce a request.

### Playbooks — procedures an agent proposes and you approve

An agent that found a working procedure can write it down. The note changes nothing until
you approve it:

```python
agent.propose_playbook(
    "fx-fallback", "What to do when the rate API fails",
    "1. Call the rate API\n2. On failure use the cached rate and state its timestamp",
    evidence="trace 4f2a: API 503, cached answer accepted",
)
```

```bash
logosai playbook list
logosai playbook show fx-fallback --agent currency_agent
logosai playbook approve fx-fallback --agent currency_agent
export LOGOSAI_PLAYBOOKS=true      # agents read approved playbooks only when this is on
```

With the switch on, `run_with_tools` asks the model one narrow question — is one of the approved
playbooks about this kind of task — and puts the body of that playbook in the system prompt. When
none fits, nothing is added and no tool is offered. (Listing the playbooks and leaving the model to
open one worked in 2 of 12 runs on a small model; picking first worked in 11 of 12. The older form is
`LOGOSAI_PLAYBOOK_MODE=index`.) Limits: body
2,000 characters, description 200, 30 playbooks per agent, 3,000 characters of index. A playbook
that fails twice and succeeds in fewer than half of its recorded outcomes is switched off
(`agent.record_playbook_outcome(name, success)` — the tool loop does not record outcomes for you).
Files live in `~/.logosai/playbooks/<agent_id>/<name>/SKILL.md` (`LOGOSAI_PLAYBOOKS_DIR` to move
them), with `name` and `description` front matter. The store does not check that a procedure is
correct; approval is your judgement.


**Capabilities**: Tool Use · ReAct · Memory (embedding search) · Goal Decomposition · Streaming · Structured Output · Error Recovery · Context Management

### Document Generation — Desktop Native

> Reference deployment only — these agents are not in the public repositories.

Generate professional documents through natural language:

```
"SpaceX 회사 정보를 PPT로 만들어줘"
→ internet_agent (search) → pptx_generator_agent (generate)
→ PowerPoint opens and builds slides in real-time

"Docker 매뉴얼을 워드로 만들어줘"
→ docx_generator_agent → Word document with tables, charts, metrics
```

| Feature | Details |
|---------|---------|
| **PPT Generation** | 101 themes × 15 layouts, Desktop Native (AppleScript) + python-pptx fallback |
| **DOCX Generation** | 8 doc_types × 8 themes, Hybrid mode (python-docx tables + Desktop Native text) |
| **Google Maps** | Place search + directions + interactive map rendering |
| **File Search** | Spotlight + find + grep — local filesystem search with content matching |
| **Capability Protocol** | Agent auto-composition via DAG (Level B composite + Level C autonomous) |

### Observability — LogosPulse

OpenTelemetry-style tracing and metrics for every agent execution. **Opt-in** — nothing is sent
(and nothing is written to `~/.logosai/`) until you point the SDK at a LogosPulse server:

```bash
export LOGOS_PULSE_ENABLED=1                      # send to http://localhost:8095
export LOGOS_PULSE_URL=http://pulse.internal:8095 # or name the server (this alone enables sending)
# or, per machine: ~/.logosai/config.json  →  {"pulse": {"enabled": true}}
```

```
Root Span (agent.process)
├── LLM Span (llm.gemini-2.5-flash-lite) — intent extraction      ~120ms
└── LLM Span (llm.gemini-2.5-flash-lite) — response generation    ~1.8s
```

```python
from logosai.utils import pulse_client as pulse

# Requires the opt-in above. Endpoint: LOGOS_PULSE_URL (default http://localhost:8095)
# Spans from TraceSpan are sent automatically — call these for your own records.
# Failed execution/LLM-call sends are spooled to ~/.logosai/pulse_spool.jsonl
# and retried later (spans are not — they are not idempotent yet).
await pulse.send_execution(agent_id="my_agent", query=query, success=True, duration_ms=120)
await pulse.send_llm_call(agent_id="my_agent", model="gemini-2.5-flash-lite",
                          input_tokens=812, output_tokens=164, duration_ms=1800)
await pulse.send_span(trace_id=trace_id, parent_id=parent_id, name="tool.search", duration_ms=40)
```

**Dashboard** (port 8096): Execution history · LLM cost tracking · Span tree visualization · User feedback (👍/👎) · Adaptive learning loop

### Self-Evolution

```python
from logosai.evolution import EvolutionSystem, EvolutionConfig

config = EvolutionConfig(enabled=True, llm_provider="google")
evolution = EvolutionSystem(agent, config)
await evolution.enable()
```

**Capabilities**: Self-Healing · Self-Growing · Self-Evaluation

**Safety**: Circuit breaker · Confidence gates · Fix history. `EvolutionConfig.enabled` is `False` by default.

### FORGE Agent Builder (Optional)

```bash
pip install logosai-forge
```

```python
from logosai_forge import ForgeClient

forge = ForgeClient()
result = await forge.create_agent("Calculate BMI from weight and height")
result = await forge.improve_agent(code, failure_log)      # Fix bugs
result = await forge.enhance_agent(code, "add caching")    # Add features
```

Autonomous evolution loop, as it runs in the reference deployment's agent runtime (opt-in there too):
```
Agent fails → FailureLogger → 30% threshold → FORGE improves
→ Confidence Gate (≥0.95) → RollbackManager backup
→ hot_register (zero-downtime deploy) → EvolutionMonitor tracks
```

### Desktop Agent

> Reference deployment only — these agents are not in the public repositories.

Control your desktop through natural language — each agent independent:

```
desktop_agent (dynamic LLM router — no hardcoded routes)
├── call_agent("kakaotalk_agent")       → KakaoTalk messaging
├── call_agent("mail_desktop_agent")    → Gmail read/compose/attach
├── call_agent("notion_desktop_agent")  → Notion pages/todos
├── call_agent("multi_ai_inquiry_agent") → ChatGPT/Claude/Gemini compare
├── call_agent("auto_report_agent")     → Scheduled search + delivery
└── screen_analyzer (lightweight 0.1s + Vision 3s fallback)
```

| Feature | macOS | Ubuntu |
|---------|-------|--------|
| Gmail read/compose/reply/attach | ✅ | ✅ Chrome CDP |
| KakaoTalk messaging | ✅ AppleScript | ❌ |
| Notion read/create/todos | ✅ Keyboard + Vision | ✅ |
| Multi-AI Inquiry | ✅ App + Chrome | ✅ Chrome |
| Auto Reports (scheduled) | ✅ | ✅ |
| ScreenAnalyzer (lightweight + Vision) | ✅ | ✅ |
| Intent Verification | ✅ | ✅ |

**ScreenAnalyzer**: Lightweight check first (~0.1s AppleScript/JS) → Vision fallback only when needed (~3s). **Intent Verification**: verifies all preconditions before irreversible actions. **No Trace**: closes windows and restores previous app after completion (Cmd+W, not Cmd+Q).

### Auto Reports

> Reference deployment only — not in the public repositories.

```
"Every morning at 8am, search Seoul weather and send via KakaoTalk"
"If Bitcoin exceeds $80,000, notify me by email"
```

Conditional execution · AI summary · Multi-channel (KakaoTalk/Gmail/Telegram)

Web management: `http://localhost:8010/auto-reports`

## Testing

About 1,300 tests. They run without API keys or network — model calls are faked:

```bash
pip install -e ".[dev]"
pytest tests/ -q
```

Every code example in the bundled LLM guide (`logosai/llms.txt`) is executed by the suite.
Numbers quoted in this README that come from real models are small samples; each says which model.

## Documentation

| Guide | Description |
|-------|-------------|
| [LLM guide](logosai/llms.txt) | For code-generating LLMs — entry points, contracts, pitfalls; examples are tested (`python -m logosai.guide`) |
| [ACP Protocol](docs/ACP_PROTOCOL.md) | Agent Communication Protocol — endpoints, call_agent(), Auto Reports |
| [Building Agentic AI](docs/BUILDING_AGENTIC_AI.md) | LLM integration, collaboration, debate, evolution |
| [Building an ACP Server](docs/BUILDING_ACP_SERVER.md) | Deploy multi-agent servers with JSON-RPC + SSE |
| [Samples](samples/) | Runnable examples — hello world, calculator, decorator agent, ACP server |

## Full Stack Quick Start

**macOS:**
```bash
curl -fsSL https://raw.githubusercontent.com/maior/logosai-framework/main/install-macos.sh | bash
```

**Ubuntu / Debian:**
```bash
curl -fsSL https://raw.githubusercontent.com/maior/logosai-framework/main/install-ubuntu.sh | bash
```

```bash
cd ~/logosai
./start.sh       # Start all services
./stop.sh        # Stop all services
./status.sh      # Check what's running
```

| Service | Port | Description |
|---------|------|-------------|
| logos_web | 8010 | Next.js frontend — chat, [admin](/admin), auto reports, [architecture](/architecture) |
| logos_api | 8090 | FastAPI backend — auth, streaming, memory, Telegram bot |
| ACP Server | 8888 | Agent runtime — starts with the sample agents; add your own |
| LogosPulse API | 8095 | Observability backend — execution traces, LLM metrics, costs |
| LogosPulse UI | 8096 | Observability dashboard — span tree, feedback, learning loop |
| PostgreSQL | 5432 | Database |

## Requirements

**Core**: Python 3.11+, aiohttp, pydantic, loguru

**LLM** (`pip install logosai[llm]`): openai, anthropic, google-genai — native SDKs, no langchain

**LangChain** (`pip install logosai[langchain]`): opt-in only, for legacy integrations

**Desktop Agent**: macOS: Peekaboo + Accessibility · Ubuntu: xdotool, xclip, scrot

**Full Stack**: Node.js 18+, PostgreSQL 14+

## Related Repositories

| Repository | Description |
|-----------|-------------|
| [logosai-ontology](https://github.com/maior/logosai-ontology) | Knowledge graph, grounded retrieval, and the Logos planner (knowledge graph + LLM; a learned selector is optional and off by default) |
| [logosai-api](https://github.com/maior/logosai-api) | FastAPI backend server |
| [logosai-web](https://github.com/maior/logosai-web) | Next.js frontend |
| [logosai-pulse](https://github.com/maior/logosai-pulse) | Agent Observability (traces, metrics, feedback) |

## License

[MIT](LICENSE) — Copyright (c) 2023-2026 LogosAI

---

[PyPI](https://pypi.org/project/logosai/) · [GitHub](https://github.com/maior/logosai-framework) · [Issues](https://github.com/maior/logosai-framework/issues) · [Samples](samples/)
