Skip to main content

Astra Runtime - Build AI agents, teams, and RAG pipelines in Python with embedded runtime and FastAPI server

Project description

Astra Runtime

🚀 Build AI agents, teams, and RAG pipelines in pure Python.

Astra Runtime provides everything you need to build intelligent AI applications:

  • Embedded Mode: Use agents directly in your Python code
  • Server Mode: Deploy as REST APIs with FastAPI

PyPI version Python 3.10+ License: MIT

Installation

pip install astra-runtime

Optional Dependencies

# With MongoDB support
pip install astra-runtime[mongodb]

# With AWS Bedrock support
pip install astra-runtime[aws]

# Everything
pip install astra-runtime[all]

Quick Start

Embedded Mode

import asyncio
from astra import Agent, Gemini

agent = Agent(
    model=Gemini(model="gemini-2.0-flash"),
    instructions="You are a helpful assistant"
)

async def main():
    response = await agent.invoke("Hello!")
    print(response.content)

asyncio.run(main())

Server Mode

from astra import Agent, Gemini
from astra.server import create_app

agent = Agent(
    name="assistant",
    model=Gemini(model="gemini-2.0-flash"),
    instructions="You are a helpful assistant"
)

app = create_app(agents={"assistant": agent})

# Run with: uvicorn main:app --reload

With Tools

from astra import Agent, Tool, tool, Gemini

@tool
def get_weather(city: str) -> str:
    """Get the current weather for a city."""
    return f"The weather in {city} is sunny, 72°F"

agent = Agent(
    model=Gemini(model="gemini-2.0-flash"),
    instructions="You are a weather assistant",
    tools=[get_weather]
)

RAG (Retrieval-Augmented Generation)

from astra import Agent, Rag, LanceDB, HuggingFaceEmbedder, Gemini

# Create RAG pipeline
rag = Rag(
    vector_db=LanceDB(path="./my_db"),
    embedder=HuggingFaceEmbedder()
)

# Ingest documents
await rag.ingest("path/to/documents/")

# Create agent with RAG
agent = Agent(
    model=Gemini(model="gemini-2.0-flash"),
    instructions="Answer questions using the provided context",
    rag=rag
)

Features

Feature Description
🤖 Agents Build intelligent agents with tools, memory, and context
📚 RAG Retrieval-Augmented Generation with custom pipelines
🗄️ Storage LibSQL, MongoDB, and LanceDB backends
🛡️ Guardrails PII filtering, content moderation, prompt injection detection
🔧 Tools Easy function calling with @tool decorator
👥 Teams Multi-agent collaboration and delegation
🌐 Server FastAPI-based REST API with streaming support
💾 Memory Short-term and long-term agent memory
🔌 Middleware Input/output processing pipelines

Model Support

  • Google Gemini: Gemini(model="gemini-2.0-flash")
  • OpenAI: OpenAI(model="gpt-4")
  • AWS Bedrock: Bedrock(model="anthropic.claude-3")
  • HuggingFace Local: HuggingFaceLocal("Qwen/Qwen2.5-0.5B-Instruct")

Documentation

License

MIT License - see LICENSE for details.

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

astra_runtime-0.1.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

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

astra_runtime-0.1.0-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: astra_runtime-0.1.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for astra_runtime-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8b8f9f2fd8d3ff447a73835d116f5c649fe282f71e4ba88f44c409063f84c60b
MD5 5beaefff1745807cdb69cd992760bd75
BLAKE2b-256 5d5c93cf2c6f6bcd516e43f513123fcd825cd138a15aeb2c324d879779ce1b8d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: astra_runtime-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for astra_runtime-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1897b9378fca674f1ce2eb961977e4fdf619d54322b90ffbca4afdefa29f60b6
MD5 23728a8ec6abf4326e01ff3f9bcf8a04
BLAKE2b-256 4b079f59927ccd069d3f7fad862cc61464d2493cb3a0062a5d638b0fb23643ee

See more details on using hashes here.

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