Graph-based agent framework powered by oauth-codex
Project description
Fabrix
Language: English | 한국어
API Guides: English | 한국어
Overview
Fabrix is a graph-based agent framework built on top of oauth-codex>=2.3.0.
It provides a structured execution graph with streaming events for tool-driven workflows.
Key Features
- Graph-based 3-state execution:
reasoning,tool_call,response - Structured state outputs powered by Pydantic models
- Sequential tool execution with strict payload validation
- Async streaming event API for step-by-step observability
- Multimodal input with explicit message models:
TextMessage,ImageMessage
Installation
pip install fabrix-ai
Quickstart
import asyncio
from pydantic import BaseModel
from fabrix import Agent
from fabrix.events import (
ReasoningEvent,
ResponseEvent,
TaskFailedEvent,
ToolEvent,
)
from fabrix.messages import TextMessage
from fabrix.tools import ToolOutput
class AddInput(BaseModel):
a: int
b: int
def add_numbers(payload: AddInput) -> ToolOutput:
return ToolOutput.json({"sum": payload.a + payload.b})
async def main() -> None:
agent = Agent(
instructions="You are a precise assistant.",
model="gpt-5.3-codex",
tools=[add_numbers],
)
messages = [TextMessage(text="Use add_numbers to compute 3 + 9")]
async for event in agent.run_stream(messages=messages):
print(f"[step={event.step}] {event.event_type}")
if isinstance(event, ReasoningEvent):
print("reasoning:", event.reasoning)
print("focus:", event.focus)
elif isinstance(event, ToolEvent):
if event.phase == "start":
print("tool call:", event.tool_name, event.arguments)
elif event.result is not None:
print("tool result:", event.result.model_dump())
elif isinstance(event, ResponseEvent):
if event.response is not None:
print("response:", event.response)
if event.parts is not None:
print("parts:", [part.model_dump(mode="json") for part in event.parts])
if event.response is None and event.parts is None:
print("response: <empty>")
elif isinstance(event, TaskFailedEvent):
print("failed:", event.error_code, event.message)
asyncio.run(main())
Message Models
Fabrix input is now list[TextMessage | ImageMessage].
TextMessage(role: str = "user", text: str)ImageMessage(role: str = "user", image: str | Path | bytes, text: str | None = None)- Unknown message fields are rejected at construction time.
ImageMessage.image accepts:
- remote URL (
https://...) - local path (
Pathor string path) - raw bytes (
bytes), encoded to a data URL internally
Multimodal Input
from fabrix.messages import ImageMessage, TextMessage
messages = [
TextMessage(text="Describe this screenshot"),
ImageMessage(image="https://example.com/screenshot.png"),
TextMessage(text="Focus on errors"),
]
async for event in agent.run_stream(messages=messages):
...
Tool Contract
Fabrix accepts tools in this shape:
def tool(payload: BaseModel) -> ToolOutput: ...
- The tool must accept exactly one parameter.
- The parameter type must be a Pydantic
BaseModel. - The return type must be
ToolOutput(breaking in v1.2.0). - Runtime arguments must be a JSON object matching payload fields.
- Extra argument keys are rejected.
- Both sync and async tools are supported.
Event Stream
run_stream(...) yields these event types:
reasoningtool(phase="start"/phase="finish")responsetask_failed
reasoning is a step-level decision trace / plan summary, not raw internal chain-of-thought.
response events now support both response: str | None and parts (structured text/image/json parts);
both fields may be None for an empty response event.
Terminate by setting next_state=null in response state.
Migration (Breaking)
run_task_stream(task, images, context) has been removed.
- Before:
agent.run_task_stream(task=..., images=..., context=...) - After:
agent.run_stream(messages=[...])
Mapping:
tasktext ->TextMessage(text="...")images->ImageMessage(image="..." | Path(...) | b"...")context-> include serialized context inTextMessage.text
Tool migration:
- Before: tool returns
str/dict/ scalar / arbitrary JSON-like objects - After: tool must return
ToolOutput(for exampleToolOutput.text(...),ToolOutput.json(...),ToolOutput.image(...))
Documentation
- API usage guide (English):
docs/api.md - API 사용 가이드 (한국어):
docs/api.ko.md - Korean README:
README.ko.md
Examples
- Minimal quickstart:
examples/minimal/quickstart.py - Multimodal vision:
examples/minimal/multimodal.py - Data workflow:
examples/advanced/data_workflow.py - Incident response workflow:
examples/advanced/incident_response.py
Notes
- Public runtime entry point is
fabrix.Agent. - Execution defaults are fixed internally:
max_steps=128and no public per-tool timeout option. - On successful completion, the stream ends right after the final
responseevent (next_state=nullin response state). - If
max_stepsis reached, the stream ends without emitting an additional terminal event.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fabrix_ai-1.4.1.tar.gz.
File metadata
- Download URL: fabrix_ai-1.4.1.tar.gz
- Upload date:
- Size: 33.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ef0e4ef0adbcff3b8f4b52170e99066083a174840941bc50da849e270cd9471
|
|
| MD5 |
61c01c41c42f42e26a7523d17bc3138f
|
|
| BLAKE2b-256 |
b1b31f73faa4f6d51370b58e1d1ce78a4232d4beb4e978fe293f0101a8557ce0
|
Provenance
The following attestation bundles were made for fabrix_ai-1.4.1.tar.gz:
Publisher:
publish-pypi.yml on smturtle2/fabrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fabrix_ai-1.4.1.tar.gz -
Subject digest:
5ef0e4ef0adbcff3b8f4b52170e99066083a174840941bc50da849e270cd9471 - Sigstore transparency entry: 962232058
- Sigstore integration time:
-
Permalink:
smturtle2/fabrix@2e9c0efd1342d2148ae7d529cbbd99d5c913dda2 -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/smturtle2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2e9c0efd1342d2148ae7d529cbbd99d5c913dda2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fabrix_ai-1.4.1-py3-none-any.whl.
File metadata
- Download URL: fabrix_ai-1.4.1-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d00b37c30a5f4c8ed23b1fc2997410ef2c14f6c78a289cfc853746a2453dbfa1
|
|
| MD5 |
fb1b7c3721621bfb1dd14678b41cac3c
|
|
| BLAKE2b-256 |
ecd64454e0ce879cd700e27e17b49dba929be14f7d8a9b7cde6b0072e536678d
|
Provenance
The following attestation bundles were made for fabrix_ai-1.4.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on smturtle2/fabrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fabrix_ai-1.4.1-py3-none-any.whl -
Subject digest:
d00b37c30a5f4c8ed23b1fc2997410ef2c14f6c78a289cfc853746a2453dbfa1 - Sigstore transparency entry: 962232059
- Sigstore integration time:
-
Permalink:
smturtle2/fabrix@2e9c0efd1342d2148ae7d529cbbd99d5c913dda2 -
Branch / Tag:
refs/tags/v1.4.1 - Owner: https://github.com/smturtle2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2e9c0efd1342d2148ae7d529cbbd99d5c913dda2 -
Trigger Event:
push
-
Statement type: