Skip to main content

🔗 OmniaChain

Framework Python para agentes de IA — async-first, multi-modal, MCP nativo.

Mais poderoso que LangChain. Mais simples que CrewAI. Seguro com PGP.

Python 3.11+ License: MIT


✨ Recursos

Recurso Descrição
🚀 Async-first asyncio em tudo — zero bloqueio
🎨 Multi-modal Texto, PDF, imagem, áudio, vídeo, CSV, URL, código
🤖 5 Providers Anthropic, OpenAI, Groq, Ollama, Google Gemini
🛠️ Tools nativas Web search, calculator, HTTP, file, code exec, browser
🧠 4 tipos de memória Buffer, Summary, Vector (pgvector), Persistent (SQLite)
🔌 MCP nativo Server + Client + Memory Server via MCP Protocol
🔐 Segurança PGP Keypair, permissions, guard, middleware com auditoria
🎭 4 tipos de agente ReAct, Multimodal, Planner, Supervisor
📊 Observability Logger, Tracer, Cost Tracker, Dashboard
🔄 Pipelines Sequencial, Paralelo, Condicional, Router
🎯 Orquestração Session multi-agente, Pool de providers, Fallback

🚀 Instalação

pip install omniachain

# Com todos os extras
pip install omniachain[all]

# Extras específicos
pip install omniachain[vector]    # pgvector
pip install omniachain[browser]   # Playwright
pip install omniachain[audio]     # Whisper

📖 Uso Rápido

Agente básico (3 linhas!)

from omniachain import Agent, Anthropic, calculator, web_search

agent = Agent(provider=Anthropic(), tools=[calculator, web_search])
result = await agent.run("Quanto é 15 * 32 + raiz de 144?")
print(result.content)  # "O resultado é 492"

Multi-modal

from omniachain import MultimodalAgent, OpenAI

agent = MultimodalAgent(provider=OpenAI("gpt-4o"))
result = await agent.run(
    "Analise estes dados",
    inputs=["relatorio.pdf", "grafico.png", "dados.csv"]
)

Multi-agente com Supervisor

from omniachain import Anthropic, Groq, ReActAgent, SupervisorAgent, web_search, calculator

researcher = ReActAgent(provider=Anthropic(), tools=[web_search], name="researcher")
analyst = ReActAgent(provider=Groq(), tools=[calculator], name="analyst")

supervisor = SupervisorAgent(
    provider=Anthropic(),
    sub_agents=[researcher, analyst],
)
result = await supervisor.run("Pesquise IA e analise os dados")

MCP Server

from omniachain import MCPServer

server = MCPServer("meu-servidor")

@server.tool
async def consultar(query: str) -> str:
    """Consulta dados."""
    return f"Resultado: {query}"

await server.run(transport="stdio")

Segurança PGP

from omniachain import Agent, KeyPair, Permissions

keys = await KeyPair.generate(agent_name="admin")
perms = Permissions()
perms.grant(keys.fingerprint, tools=["calculator"])  # Só calculator
perms.deny(keys.fingerprint, tools=["code_exec"])    # Nunca code_exec

agent = Agent(provider=..., tools=[...], keypair=keys, permissions=perms)

Custom Tool

from omniachain import tool

@tool(cache=True, retries=3)
async def buscar_preco(produto: str, moeda: str = "BRL") -> float:
    """Busca o preço de um produto."""
    return 42.0

# Schema JSON gerado automaticamente!
print(buscar_preco.schema)

🏗️ Arquitetura

omniachain/
├── core/           # Config, Message, Response, Context, Chain, Errors
├── providers/      # Anthropic, OpenAI, Groq, Ollama, Google
├── loaders/        # Auto-detect: PDF, Image, Audio, Video, CSV, URL, Code
├── tools/          # @tool decorator, calculator, HTTP, file, code, search
├── memory/         # Buffer, Summary, Vector (pgvector), Persistent, MCP
├── mcp/            # Server, Client, Transport (stdio/HTTP), Registry
├── security/       # KeyPair (PGP), Permissions, Guard, Middleware
├── agents/         # Base, ReAct, Multimodal, Planner, Supervisor
├── pipeline/       # Sequential, Parallel, Conditional, Router
├── orchestration/  # Session, ProviderPool, Fallback, CostOptimizer
└── observability/  # Logger, Tracer, CostTracker, Dashboard

🔐 Segurança

O OmniaChain implementa segurança PGP completa:

  1. KeyPair: Cada agente tem par de chaves (GPG real ou HMAC fallback)
  2. Permissions: Grant/Deny por tool, memory e provider
  3. Guard: Decorator @requires_permission para proteger funções
  4. Middleware: Valida assinatura + permissão + anti-replay + auditoria

🧠 Memória Vetorial (MCP + pgvector)

from omniachain.memory.mcp_memory import MCPMemoryServer

# Servidor MCP de memória vetorial
server = MCPMemoryServer(dsn="postgresql://localhost/omniachain")
await server.run(transport="stdio")

# Qualquer agente MCP pode acessar:
# - memory_store: armazena com embedding
# - memory_search: busca semântica
# - memory_delete: remove por ID

📊 Observabilidade

from omniachain import CostTracker, Tracer

tracker = CostTracker()
tracker.record(response)

print(f"Custo total: ${tracker.total_cost:.4f}")
print(tracker.summary())

🧪 Testes

pip install pytest pytest-asyncio
pytest tests/ -v

📁 Variáveis de Ambiente

Variável Descrição
ANTHROPIC_API_KEY API key Anthropic
OPENAI_API_KEY API key OpenAI
GROQ_API_KEY API key Groq
GOOGLE_API_KEY API key Google
OMNIA_DEFAULT_PROVIDER Provider padrão
OMNIA_PGVECTOR_DSN DSN PostgreSQL pgvector
OMNIA_SECURITY_ENABLED Ativar segurança PGP

📜 Licença

MIT License — Use como quiser.


Feito com ❤️ para a comunidade de IA.

Metadata

Release files for omniachain 0.1.0

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

Source distribution (sdist)

Source distribution for omniachain 0.1.0
File Size Uploaded
omniachain-0.1.0.tar.gz 568.6 kB Details

Built distribution (wheel)

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

Total release size: 696.0 kB

Release files / omniachain-0.1.0.tar.gz

Download URL omniachain-0.1.0.tar.gz
Size 568.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8734689edade4520688502b23af26aa2d21715267b9ef12ad115c260be2f7849
BLAKE2b-256 checksum
How to use checksums
38175069785e6060a363c77eb2e9a6cc4edb6a7842c830cd2aca86419d4cb17f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / omniachain-0.1.0-py3-none-any.whl

Download URL omniachain-0.1.0-py3-none-any.whl
Size 127.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3e65dc956831cca2fae709fbaea4c22c2a798fffbab127c9c4219472ddd5907
BLAKE2b-256 checksum
How to use checksums
b50a0be582249dd7616e72f7b8c4e3f2888a01e819bfde03906641a88b0e396e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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