コンテンツへスキップ
Phronesis v0.1.0 アルファ版が利用可能ですアナウンスを読む
Phronesis

オープンソース · Apache 2.0 · Python 3.11+

AIエージェントシステムのための実践的知恵。

Phronesis (φρόνησις): アリストテレスにとって 実践的知恵 とは、具体的な状況において適切に熟慮し判断をもって行動する能力である。LLMは episteme (知識)を持つ。エージェントには phronesisが必要だ。

hello_phronesis.py
from phronesis.agents import agent
from phronesis.providers import anthropic


@agent(
    model=anthropic(model="claude-sonnet-4-6"),
    system_prompt="You investigate questions thoroughly and cite sources.",
)
def researcher() -> str:
    """Investigate a question and synthesize a cited answer."""


result = await researcher.run("What is phronesis in Aristotelian ethics?")
print(result.output)

なぜPhronesisか

エージェントはツールを持つチャットボットではない。

LLMは物事を知っている - それが エピステーメーだ。しかしエージェントは具体的な状況において判断をもって 決定し行動する 必要がある。それが フロネシスだ。多くのエージェントフレームワークはエージェントをツール利用ループに貼り付けられた強化チャットボットとして扱う。Phronesisは、それらを明示的な契約 - 型付き入力、宣言された副作用、有界なメモリ、名付けられた実行パターン - を持つ熟慮するシステムとして扱う。

既存のフレームワークは選択を迫る。一方では任意の制御フローをコードとして書く: 最大限の表現力と、半年後に誰もデバッグできないマルチエージェントシステム。他方ではすべてがYAMLやグラフビルダーで記述される: 一目では読めるが、非自明なものが必要になった瞬間に不可能になる。Phronesisは宣言的仕様と実行時のランタイムを分離する。エージェント、ツール、メモリ、パイプラインは 型付き、不変、JSONシリアライズ可能な仕様だ。実行パターンは閉じた、明確に定義されたカタログから来る - 混沌のない表現力。

すべての実行はOpenTelemetryで可観測であり、すべての仕様はバージョン管理可能、すべての契約はプロンプト内のコメントではなくランタイムチェックだ。これがデモを生み出すフレームワークと、運用できるシステムを生み出すフレームワークの違いだ。

By the numbers

Built like infrastructure, not a demo.

Phronesis is early, but it is not thin. The surface is small on purpose - and every layer carries its own tests, types, and observability.
19

Execution modes

A closed, named catalog - from Sequence and Parallel to Reflexion and Tree Search.

22

Runnable examples

Every mode with a deterministic cassette, plus a full multi-agent mini-app.

1,600+

Tests

Branch coverage gated at 90% - the build fails below the floor.

14

Stable modules

Agents, tools, memory, providers, MCP, pipelines, observability and more.

100%

Typed surface

mypy --strict across the entire source tree, no escape hatches.

Apache 2.0

Open source

Permissive license, public roadmap, no enterprise gates.

コードツアー

4つのスニペットで見るAPI。

本物のPython。本物の形。以下のフレームワークは初期アルファ - 表面積は拡大するが、設計はこのままスリムに保つ。

エージェントは、単一の宣言的仕様の下でモデル、ツール、メモリを結びつける。

agent.py
from phronesis import ToolEffect
from phronesis.agents import agent
from phronesis.providers import anthropic
from phronesis.tools import tool


@tool(effects=(ToolEffect.NETWORK,))
async def search_web(query: str, limit: int = 5) -> list[str]:
    """Search the web and return ranked snippets."""
    ...


@agent(
    model=anthropic(model="claude-sonnet-4-6"),
    tools=(search_web,),
    system_prompt="You are a careful research assistant.",
    max_iterations=8,
)
def assistant() -> str:
    """Answer questions grounded in live search results."""

原則

六つの選択、あらゆる場所に適用。

  • 継承よりコンポジション

    エージェントは部品 - モデル、ツール、メモリ、プロンプト - から構成され、サブクラス化されない。組み立てる; オーバーライドしない。

  • 非同期ファースト

    ストリーミング、並行性、キャンセルは基本前提。同期の影のAPIを保守する必要はない。

  • 強い型付け

    全体でPydantic v2。型はドキュメントではない - フレームワークが強制するランタイム契約だ。

  • 不変な仕様、可変な実行

    定義はJSONシリアライズ可能で再現可能。実行状態は別の場所に存在し、可観測かつクエリ可能だ。

  • 可観測性を組み込み

    すべてのエージェント実行、ツール呼び出し、パイプラインステージにOpenTelemetryスパン - 最初のコミットから、後付けではない。

  • 閉じた実行パターンのカタログ

    Sequence、Parallel、ReActLoop、Consensus、Debate、Handoff。推論できる名前付きモード - 任意の制御フローではない。

内部に何があるか

小さく、原則に基づいた表面。

フレームワークは意図的に狭い。各層は、システムをより安全に運用できるようにするか、半年後にコードをより読みやすくすることで、その存在を正当化する。

コア

すべてのエージェントが構築されるプリミティブ。

  • エージェント
  • ツール
  • MCP統合
  • Providers (Anthropic, OpenAI, Ollama, vLLM)
  • Context builders

状態とコンテキスト

エージェントはどう記憶し、何を共有するか。

  • メモリ(エピソード、意味、作業、共有)
  • Checkpoints (pause and resume)
  • セッション

オーケストレーション

エージェントはどうシステムへ構成されるか。

  • パイプライン
  • 実行モード
  • Provider middleware
  • Record / replay cassettes
  • 可観測性

Engineering

The guarantees, not the promises.

An agent framework is only as trustworthy as the discipline behind it. These are the gates every change passes before it lands.
  • Typed end to end

    mypy --strict and Pydantic v2 specs across the whole source tree. No untyped escape hatches.

  • Tested to a floor

    1,600+ tests with branch coverage gated at 90% - the build fails below it, never above it on paper.

  • Deterministic replay

    Record once, replay forever: cassette-backed runs make agent behavior reproducible in tests and CI without a network.

  • Observable by construction

    OpenTelemetry spans for every agent run, tool call, pipeline stage, and MCP session - correlated by stable ids.

  • Immutable specs

    Agents, tools, and pipelines are frozen, JSON-serializable dataclasses - versionable, diffable, reproducible.

  • Lint-clean

    ruff format and a strict ruff check gate every commit, alongside the type and test suites.

インストール

コマンドひとつ。Python 3.11以降。

$pip install phronesis-framework

プロジェクトの状況

Phronesisは初期アルファです。

APIは変わる。私たちはエージェントシステムを真剣に扱うフレームワーク - 型付き、合成可能、可観測 - を公開で構築している。本番運用の主張も、捏造されたケーススタディも、エンタープライズの壁もない。あるのはコードと、その設計への誠実なコミットメントだけだ。

フィードバック、アイデア、貢献はGitHubのDiscussionsとIssuesから歓迎する。ロードマップ、粗い部分、未解決の問いはすべてリポジトリにある。