The async-first, multi-modal AI framework. Better than LangChain.
Project description
🔗 OmniaChain
Framework Python para agentes de IA — async-first, multi-modal, MCP nativo.
Mais poderoso que LangChain. Mais simples que CrewAI. Seguro com PGP.
✨ 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:
- KeyPair: Cada agente tem par de chaves (GPG real ou HMAC fallback)
- Permissions: Grant/Deny por tool, memory e provider
- Guard: Decorator
@requires_permissionpara proteger funções - 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omniachain-0.1.0.tar.gz.
File metadata
- Download URL: omniachain-0.1.0.tar.gz
- Upload date:
- Size: 568.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8734689edade4520688502b23af26aa2d21715267b9ef12ad115c260be2f7849
|
|
| MD5 |
2fbe873c28c4b7db23df84c587f1907c
|
|
| BLAKE2b-256 |
38175069785e6060a363c77eb2e9a6cc4edb6a7842c830cd2aca86419d4cb17f
|
File details
Details for the file omniachain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: omniachain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 127.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3e65dc956831cca2fae709fbaea4c22c2a798fffbab127c9c4219472ddd5907
|
|
| MD5 |
206ca149e933d70a8a422acbd4800947
|
|
| BLAKE2b-256 |
b50a0be582249dd7616e72f7b8c4e3f2888a01e819bfde03906641a88b0e396e
|