Skip to main content

Pyram Logo

⚡ Pyram

Workflows & Agentes com IA — DAGs · Tools · LLMs

Docs LLM Docs Tools Docs Graph Docs Examples
Python 3.10+ MIT httpx only Alpha


Pyram unifica LLM calling, tool calling e workflows DAG em uma API minimalista.
Zero dependências além de httpx. Sem Pydantic. Sem frameworks. Sem classes abstratas.


🚀 Quickstart

# 1. LLM em 3 linhas
from Pyram.llm import DeepSeek
ia = DeepSeek(api_key="sk-...")
print(ia.completetion("Qual a capital do Brasil?").text())

# 2. Tool calling em 5 linhas
from Pyram.tools import tool, sch, exec
@tool(info="Soma dois números")
def add(a: int, b: int) -> int:
    return a + b
resp = ia.completetion("2 + 3?", tools=sch())
print(exec(resp))

# 3. Workflow em 10 linhas
from Pyram.graph import flow, state
@flow
def chatbot():
    if state.pergunta == "preço":
        state.resposta = "R$ 199,90"
    else:
        state.resposta = "Pergunte sobre preços"
resultado = chatbot.run(state={"pergunta": "preço"})
print(resultado.resposta)

🧭 Guia rápido

Módulo O que faz Documentação
Pyram.llm 6 provedores LLM com interface unificada, tool calling e thinking 📗 docs/llm.md
Pyram.tools Decorator @tool com schema automático, cache e execução 📗 docs/tools.md
Pyram.graph Motor de workflows: @flow, @task, DAG, AST, state 📗 docs/graph.md
Pyram.configs Cache unificado, diretório .PyramCache, TTL 📗 docs/index.md

🧠 Provedores LLM

Provider Classe Tool Calling Thinking Cache
DeepSeek DeepSeek ✅ Nativo ✅ ✅
OpenAI OpenAI ✅ Nativo ✅ ✅
Anthropic Anthropic ✅ Convertido ✅ ✅
Gemini Gemini ✅ functionDeclarations ❌ ✅
Cohere Cohere ✅ Convertido ✅ ✅
Groq Groq (extends OpenAI) ✅ Nativo ❌ ✅
# Interface 100% idêntica entre provedores
resposta = provedor.completetion(
    prompt="...",
    system="Você é um assistente...",
    tools=sch(),           # schemas de ferramentas
    tool_choice="auto",    # "auto" | "any" | "none" | {"function": {"name": "..."}}
    messages=[...],        # histórico completo (opcional)
)
# → CompletionResponse (.text(), .jsn(), .content, .tool_calls, .thinking)

🔧 Ferramentas

from Pyram.tools import tool, sch, sch_ant, sch_gem, exec, listar

@tool(info="Busca produtos no estoque")
def buscar_produtos(categoria: str, limite: int = 10) -> list[dict]:
    return [{"nome": "Notebook", "preco": 4500}]

sch()        # → OpenAI format  (DeepSeek, Groq)
sch_ant()    # → Anthropic format
sch_gem()    # → Gemini format
exec(resp, use_cache=True)   # executa com cache

listar()     # → ["buscar_produtos"]

🔄 Workflows

from Pyram.graph import flow, task, state, parallel

@task(retry=3, timeout=10, checkpoint=True)
def pagamento():
    state.status = "pago"

@flow
def ecommerce():
    pagamento()
    envio()
    if state.status == "pago":
        notificar()

resultado = ecommerce.run(state={"status": ""})
print(ecommerce.viz())
# pagamento
# ├── envio
# │   └── ? state.status == 'pago'
# │       ├── notificar
# │       │   └── merge
# │       └── [notificar...]

📁 Cache Unificado

.PyramCache/
├── responses/
│   ├── deepseek/     # Cache de respostas DeepSeek
│   └── openai/       # Cache de respostas OpenAI
├── tools/            # Cache de execução de tools
└── graph/
    └── {flow_name}/
        ├── checkpoints/  # Checkpoint de tasks
        ├── cache/        # Cache de tasks
        └── manifest.json
from Pyram.configs import Cache

cache = Cache("deepseek", ttl=3600)
cache.set({"model": "deepseek-v4"}, {"choices": [...]})
hit = cache.get({"model": "deepseek-v4"})  # → dict or None

Configure o diretório via export PYRAM_CACHE_DIR=/caminho/do/cache


📚 Documentação

Documento Conteúdo
docs/llm.md API completa dos 6 provedores, exemplos, detalhes técnicos
docs/tools.md Decorator @tool, schemas, execução, cache, utilitários
docs/graph.md @flow, @task, state, condicionais, loops, checkpoint
docs/examples.md 4 exemplos completos: Claude Code Agent, Auto-Correção, E-commerce, Perplexity

📄 Licença

MIT — use, modifique, distribua livremente.


Feito com ☕ e Python puro · GitHub

Metadata

Release files for pyram-flow 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 pyram-flow 0.1.0
File Size Uploaded Provenance Actions
pyram_flow-0.1.0.tar.gz 24.3 kB Without provenance Details for pyram_flow-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 54.7 kB

Release files / pyram_flow-0.1.0.tar.gz

Download URL pyram_flow-0.1.0.tar.gz
Size 24.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2d26708b4725823a0bcff1e7a51a3127b96537cae84b13efa4963c6aa2f47289
BLAKE2b-256 checksum
How to use checksums
793d616995863097c57d289267024815dbe2b83388c0e6612e9856d345b06dec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

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

Download URL pyram_flow-0.1.0-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
323a08667a537ae395382040a6f2d32b9c476c7faa52d45c0720c4583e2bde0f
BLAKE2b-256 checksum
How to use checksums
ad301f27c42eead18e002f544908d40b4531c9c83b1ca6a19b0961039c2a9e99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for pyram-flow 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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