Skip to main content

The AI Application Runtime — @agent, @tool, >> chaining, any model.

Project description

Synapse — The AI Application Runtime

pip install synapse-runtime

Not a framework. Not a wrapper. The missing AI layer for your Python stack.

30-Second Demo

from synapse import agent, tool, workflow, step

@tool
def search_web(query: str) -> list[str]:
    """Search the web. Returns top results."""
    ...  # your implementation

@agent(model='gpt-4o', fallback='ollama/llama3')
async def researcher(topic: str) -> str: ...

@agent(model='claude-3-5-sonnet')
async def writer(content: str) -> str: ...

# Chain agents with >>
pipeline = researcher >> writer
result   = await pipeline.run('AI application runtimes')

That's it. No subclassing. No boilerplate. No JSON schema by hand.


The Four Primitives (v0.1)

@tool — Auto-generated schemas

@tool
def send_email(to: str, subject: str, body: str = '') -> bool:
    """Send an email. Returns True on success."""
    ...

Synapse reads the type annotations and docstring. The JSON schema is generated automatically — no BaseTool, no {type: "function", function: {…}} by hand.

@agent — Any model, same API

@agent(model='gpt-4o')                  # OpenAI
@agent(model='claude-3-5-sonnet')       # Anthropic
@agent(model='gemini/gemini-pro')       # Google
@agent(model='ollama/llama3')           # Local (free)

Powered by litellm — 100+ providers, one decorator.

Add guardrails:

@agent(
    model='gpt-4o',
    fallback='ollama/llama3',
    must_not=['PII', 'speculation'],
    token_budget=2000,
)
async def safe_agent(prompt: str) -> str: ...

>> — Readable pipelines

pipeline = researcher >> writer >> reviewer
result   = await pipeline.run(topic='climate change')

LangGraph needs nodes and edges. Synapse uses >>.

@workflow + step() — Composable pipelines

@workflow
async def research_pipeline(topic: str) -> str:
    data  = await step(researcher, topic)
    draft = await step(writer, data)
    return await step(reviewer, draft)

Zero-Cost Testing

from synapse import MockLLM

def test_my_agent():
    with MockLLM("expected response") as mock:
        result = await my_agent("prompt")
    assert result == "expected response"
    assert mock.call_count == 1

MockLLM patches litellm. No API calls. No tokens spent.


Synapse vs the alternatives

Feature Synapse LangChain OpenAI SDK LangGraph
Any LLM provider ❌ OpenAI only
Schema from annotations ❌ manual ❌ manual ❌ manual
>> chaining ❌ verbose
Built-in guardrails ⚠️ external
Readable 3-line agent ❌ subclass
MockLLM for tests

Roadmap

Version Name Ships
v0.1 The Tiny Core @agent, @tool, >>, MockLLM ← you are here
v0.3 Useful Projects Memory API, streaming, prompt templates, CLI
v0.5 AI Runtime Workflow engine, checkpointing, observability, guardrails
v0.8 Synapse Identity Prompt debugger, multi-agent graphs, human-in-the-loop
v1.0 Production Multi-tenancy, audit trail, intent routing

Install

pip install synapse-runtime

# For local LLM (free, no API key needed):
# Install Ollama → https://ollama.ai
ollama pull llama3

MIT License · Built in public · Issues welcome

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synapse_runtime-0.1.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

synapse_runtime-0.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file synapse_runtime-0.1.0.tar.gz.

File metadata

  • Download URL: synapse_runtime-0.1.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for synapse_runtime-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2aaa1dac3e84606a9a2fc2530c58bff9fa7d83547b369700fc30984af74c0351
MD5 20a70daf778c55c999955be2d451abb3
BLAKE2b-256 f1507a1d343b1f380e6b4ab546a1737a1589c884a6a1bc37254b1cab3397006b

See more details on using hashes here.

Provenance

The following attestation bundles were made for synapse_runtime-0.1.0.tar.gz:

Publisher: publish.yml on Sheheryar-byte/synapse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file synapse_runtime-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: synapse_runtime-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for synapse_runtime-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69cdd50f4c4cfed3b11f32fa85778e5f3d2068b3c3bf7b73cf4dff0b387238e6
MD5 fa060273dbb2e5f11bf1c304d8ca1fa7
BLAKE2b-256 1df80f54c2523f0a0888bb76aa474fe9f44a3bbbc92df55ab5ef2cd1bf7b61a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for synapse_runtime-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Sheheryar-byte/synapse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page