NinjaStack auto-generates AI agents, GraphQL APIs, authentication, and UI from your schema. Define once, generate everything.
# Connect to your database, generate everything
$ ninjastack introspect --db postgres://localhost/myapp
โ Discovered 12 entities, 8 relationships, 3 domains
$ ninjastack sync
โ Generated: 12 models, 18 agents, 12 GraphQL types
โ Wired: 3 domain agents + coordinator
โ Auth: JWT + RBAC configured
$ ninjastack serve
โ ๐ฅท Agentic backend running at http://localhost:8000
โ GraphQL playground at /graphql
โ Agent chat at /chat
Every team building AI agents rewrites the same boilerplate: data access, tool definitions, permission checks, API layers, agent orchestration.
The result? Months of plumbing before any agent does anything useful. Fragile hand-wired tool registrations. Auth bolted on as an afterthought. No clear ownership boundaries between agents.
NinjaStack starts from what you already have โ your database schema. From that single source of truth, it generates the entire agentic stack.
Agents get scoped tools per entity. Domains define ownership boundaries. RBAC is declarative. GraphQL is automatic. You focus on business logic, not wiring.
Not a toy. A production framework for schema-driven agentic systems.
Connect to SQL, MongoDB, Neo4j, or vector stores. NinjaStack discovers entities, fields, relationships, and constraints automatically.
Auto-generates Google ADK agents with scoped CRUD tools per entity. Data agents are deterministic (no LLM). Domain agents use Gemini for reasoning.
A typed, composable schema language for entities, relationships, domains, and agent configs. Your single source of truth.
Pluggable auth (OAuth2, JWT, API keys) with role-based access control at the domain and entity level. Declarative, not bolted on.
Strawberry GraphQL types, queries, mutations, and inputs generated from your schema. Permission-enforced at the resolver level.
Don't have a database yet? Chat with the Setup Assistant (real Gemini-powered LlmAgent) to design your schema through natural dialogue.
Each agent sees only its own tools. Data agents own one entity. Domain agents own one domain. The coordinator routes across domains. No leaking.
Helm charts and deployment manifests generated automatically. Deploy your agentic backend to GKE, EKS, or any Kubernetes cluster.
Unified persistence layer across SQL, NoSQL, graph, and vector databases. Entities declare their storage engine; the framework handles the rest.
Start from an existing database, from conversation, or both.
Connect to an existing database. NinjaStack introspects your schema and generates the full stack around it.
ninjastack introspect \
--db postgres://...
--db mongo://...
--db neo4j://...
No database? Chat with the AI setup assistant to design your domain model through natural conversation.
ninjastack init --interactive
# "I need a bookstore with
# books, customers, orders,
# and reviews..."
Bolt-on to an existing system, then expand the schema conversationally. Best of both worlds.
ninjastack introspect --db ...
ninjastack assistant
# "Add a Reviews entity
# with semantic search..."
Every agent has a scope. No tool leaking. No implicit state. Explicit ownership at every level.
Deterministic. No LLM. One entity, scoped tools. Fast, predictable CRUD.
LLM-powered. Owns a business domain. Delegates to data agents. Configurable reasoning level.
Top-level router. Classifies intent. Delegates to the right domain. Synthesizes cross-domain results.
Real code from the bookstore example. No pseudo-code.
from ninja_core.schema.entity import EntitySchema, FieldSchema, FieldType, StorageEngine
from ninja_core.schema.domain import DomainSchema
book = EntitySchema(
name="Book",
storage_engine=StorageEngine.SQL,
fields=[
FieldSchema(name="id", field_type=FieldType.UUID, primary_key=True),
FieldSchema(name="title", field_type=FieldType.STRING, indexed=True),
FieldSchema(name="author", field_type=FieldType.STRING),
FieldSchema(name="price", field_type=FieldType.FLOAT),
],
)
catalog = DomainSchema(
name="Catalog",
entities=["Book", "Review"],
agent_config=AgentConfig(reasoning_level=ReasoningLevel.MEDIUM),
)
from ninja_agents.base import DataAgent, DomainAgent, CoordinatorAgent
# Data agents: deterministic CRUD, no LLM
book_agent = DataAgent(entity=book)
book_agent.execute("book_get", id="abc-123") # Instant, no API call
# Domain agents: LLM-powered orchestration
catalog = DomainAgent(domain=catalog_domain, data_agents=[book_agent, review_agent])
# Coordinator: routes across all domains
coordinator = CoordinatorAgent(domain_agents=[catalog, commerce])
coordinator.route("Find sci-fi books", target_domains=["Catalog"])
from ninja_auth.rbac import RBACConfig, RBACPolicy, RoleDefinition
policy = RBACPolicy(config=RBACConfig(roles={
"customer": RoleDefinition(permissions=[
"read:Catalog", # Browse books and reviews
"write:Catalog.Review", # Write reviews only
"read:Commerce.Order", # View own orders
]),
}))
# Built-in: admin (*:*), editor (read:* + write:*), viewer (read:*)
policy.check(user_perms, "write", "Catalog", "Book") # โ PermissionError!
Built on proven foundations. No custom runtime. No vendor lock-in.
15 focused packages. Use what you need.
NinjaStack is open source and ready to use. Define your schema, generate your stack, ship your agents.
pip install agentic-backend