Skip to main content

A production-grade, type-safe Python Agent framework

Project description

Nonoka

A production-grade, type-safe Python agent framework with deterministic orchestration, conversational execution, and first-class MCP integration.

Features

  • Type-safe core — Pydantic-validated schemas throughout; agents, tools, and plans are all strongly typed
  • Deterministic orchestrationPlan + Step + ref() for explicit control flow, not just prompt-and-pray
  • Conversational executionReActAgent, ReflectiveAgent, and PlanExecutor paradigms out of the box
  • First-class tools@tool decorator with automatic Pydantic schema generation
  • Prompt engineering@prompt decorator and PromptTemplate for composable, type-safe prompt construction
  • MCP ready — built-in MCP (Model Context Protocol) support via mcp
  • Resilient execution — structured error taxonomy (TransientError, LogicError, SafetyError, etc.) with configurable RetryPolicy
  • Observable hooksHooks system for tracing, logging, and custom middleware
  • Multi-backend LLM — powered by litellm, supporting OpenAI, Anthropic, DeepSeek, and 100+ providers

Installation

pip install nonoka

Or with uv:

uv add nonoka

Quick Start

import asyncio
import nonoka

@nonoka.tool
def get_weather(city: str) -> str:
    """Get the weather for a city."""
    return f"Sunny in {city}!"

async def main():
    agent = nonoka.Agent(
        name="weather-bot",
        tools=[get_weather],
    )
    result = await agent.run("What's the weather in Tokyo?")
    print(result.output)

asyncio.run(main())

Plans & Orchestration

Explicit multi-step workflows with type-safe references:

from nonoka import PlanBuilder, ref

plan = (
    PlanBuilder()
    .add_step("research", "Search for information")
    .add_step("summarize", "Summarize findings", depends_on=[ref("research")])
    .build()
)

executor = nonoka.PlanExecutor(plan=plan)
result = await executor.run("Latest AI breakthroughs")

Prompt Templates

Composable, type-safe prompts:

from nonoka import prompt, PromptTemplate

@prompt
def translate(text: str, target: str = "Chinese") -> str:
    """Translate the following text to {target}:

    {text}
    """

# Or programmatically
tpl = PromptTemplate("Summarize this in {style}:\n{content}")
output = tpl.render(style="bullet points", content=long_text)

ReAct Agent

agent = nonoka.ReActAgent(tools=[search, calculator])
result = await agent.run("What is 42 * the current temperature in Paris?")

Configuration

Nonoka integrates with pydantic-settings for environment-driven config:

from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    openai_api_key: str
    default_model: str = "gpt-4o"

    class Config:
        env_prefix = "NONOKA_"

Requirements

  • Python >= 3.10

License

MIT

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

nonoka-1.0.0.tar.gz (64.6 kB view details)

Uploaded Source

Built Distribution

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

nonoka-1.0.0-py3-none-any.whl (58.2 kB view details)

Uploaded Python 3

File details

Details for the file nonoka-1.0.0.tar.gz.

File metadata

  • Download URL: nonoka-1.0.0.tar.gz
  • Upload date:
  • Size: 64.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for nonoka-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c629d1c0714c5209fa72b51af1726b8ca8387f6ad93c4f208d18d67381594895
MD5 9fae4ae27a611902684518f815da3329
BLAKE2b-256 42d2dc460bf60fa6a3a1dda5d5c8615c743867f0e3b2cb60b63409047705f62b

See more details on using hashes here.

File details

Details for the file nonoka-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: nonoka-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 58.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for nonoka-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4745fa69c7b6937e9c2299ed5b2d37d8f4b0bc0f2c43b336a72e25b9d7ae7318
MD5 719521f0eabb1a94971caf17a85bcff6
BLAKE2b-256 1483ebcab7c0bd6bdc0ae2746777a855180b1612cd5302b75483e5e773732d95

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