Skip to main content

LogosAI

PyPI Python License GitHub

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.

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/.

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

Architecture

LogosAI System Architecture

Self-Evolution Flow

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 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

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

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)

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)

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

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()
# 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.

# 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:

/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)

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

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)
# 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
# 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.

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:

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",
)
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:

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
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

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)

pip install logosai-forge
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:

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 For code-generating LLMs — entry points, contracts, pitfalls; examples are tested (python -m logosai.guide)
ACP Protocol Agent Communication Protocol — endpoints, call_agent(), Auto Reports
Building Agentic AI LLM integration, collaboration, debate, evolution
Building an ACP Server Deploy multi-agent servers with JSON-RPC + SSE
Samples Runnable examples — hello world, calculator, decorator agent, ACP server

Full Stack Quick Start

macOS:

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

Ubuntu / Debian:

curl -fsSL https://raw.githubusercontent.com/maior/logosai-framework/main/install-ubuntu.sh | 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, auto reports, 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+

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

License

MIT — Copyright (c) 2023-2026 LogosAI


PyPI · GitHub · Issues · Samples

Metadata

Release files for logosai 0.17.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logosai 0.17.1
File Size Uploaded Provenance Actions
logosai-0.17.1.tar.gz 593.2 kB Without provenance Details for logosai-0.17.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for logosai 0.17.1
File Interpreter ABI Platform Actions
logosai-0.17.1-py3-none-any.whl Python 3 none any Details for logosai-0.17.1-py3-none-any.whl

Total release size: 1.3 MB

Release files / logosai-0.17.1.tar.gz

Download URL logosai-0.17.1.tar.gz
Size 593.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2bf34fba50617b78149181fa1ee54564a23b70533f97ba27c00ee41d1fc7c1bd
BLAKE2b-256 checksum
How to use checksums
6ae82dfd14a6552d86f444f70fe2b5cc93d0792d7aaa63b428a6b2fca8bcff54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.0

Release files / logosai-0.17.1-py3-none-any.whl

Download URL logosai-0.17.1-py3-none-any.whl
Size 688.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02499307646dae3ccc8aa3bc248442b79b00dd625f55f0a43f7a3075b804f957
BLAKE2b-256 checksum
How to use checksums
347434f9c8ae0b1e2ebc60008d813c61a1de1958d2c42957bd261b3c96299b34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.0

Security for logosai 0.17.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page