Portable ReAct agent graph with MCP tools and RAG — part of the fractal-agent-graphs catalog
Project description
fractal-graph-react-agent
ReAct agent with MCP tools — part of the fractal-agents-runtime graph catalog.
Overview
This package provides a portable, self-contained ReAct agent graph built on LangGraph with:
- MCP tool integration — connects to Model Context Protocol servers for extensible tool use
- RAG tool factory — creates retrieval-augmented generation tools from document collections
- OAuth token exchange — handles MCP server authentication with token caching
- Multi-provider LLM support — OpenAI, Anthropic, Google, and custom OpenAI-compatible endpoints
Installation
uv add fractal-graph-react-agent
Usage
The graph is a portable factory function that accepts a RunnableConfig and optional persistence components via dependency injection:
from react_agent import graph
from langchain_core.runnables import RunnableConfig
# Build the agent graph — runtime injects persistence
config = RunnableConfig(configurable={"model_name": "openai:gpt-4o"})
agent = await graph(config, checkpointer=my_checkpointer, store=my_store)
# Invoke
result = await agent.ainvoke({"messages": [{"role": "user", "content": "Hello!"}]})
Dependency Injection
The graph() factory uses dependency injection for persistence — it never imports from any specific runtime:
# The runtime (e.g., Robyn server) creates and injects these:
from my_runtime.database import get_checkpointer, get_store
agent = await graph(
config,
checkpointer=get_checkpointer(), # Thread-level conversation memory
store=get_store(), # Cross-thread long-term memory
)
When checkpointer and store are None (the default), the agent runs without persistence — useful for testing or stateless invocations.
Configuration
The graph is configured via RunnableConfig.configurable:
| Key | Type | Default | Description |
|---|---|---|---|
model_name |
str |
"openai:gpt-4o" |
LLM provider and model |
temperature |
float |
0.7 |
Sampling temperature |
max_tokens |
int |
4000 |
Maximum generation tokens |
system_prompt |
str |
Generic helpful assistant | System prompt |
mcp_config |
dict |
None |
MCP server configuration |
rag |
dict |
None |
RAG collection configuration |
base_url |
str |
None |
Custom OpenAI-compatible endpoint |
Architecture
This package is part of the 3-layer architecture:
apps/ → Thin HTTP wrappers (Robyn, FastAPI, etc.)
↓ depends on
graphs/ → Portable agent architectures (this package)
↓ depends on
infra/ → Shared runtime infrastructure (tracing, auth, store namespace)
Graphs have zero coupling to any runtime — they can be deployed to LangGraph Platform, embedded in any server framework, or run standalone.
License
MIT
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 fractal_graph_react_agent-0.0.0.tar.gz.
File metadata
- Download URL: fractal_graph_react_agent-0.0.0.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cda8a8b42d09f23226fdaeba507e0927d86a6f5e3ac988a4ea0d1792ae969a16
|
|
| MD5 |
9eeab7ac7616cfe9720f8b4d475c1841
|
|
| BLAKE2b-256 |
c50c45d1ad9d4e49fa75c78d21ac0b7e4ee65bf7a0c749d195aaf1c1d6093be7
|
Provenance
The following attestation bundles were made for fractal_graph_react_agent-0.0.0.tar.gz:
Publisher:
release.yml on l4b4r4b4b4/fractal-agents-runtime
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fractal_graph_react_agent-0.0.0.tar.gz -
Subject digest:
cda8a8b42d09f23226fdaeba507e0927d86a6f5e3ac988a4ea0d1792ae969a16 - Sigstore transparency entry: 942519408
- Sigstore integration time:
-
Permalink:
l4b4r4b4b4/fractal-agents-runtime@e2932799fe22c184b212a74d269e9fdb57d3503b -
Branch / Tag:
refs/tags/python-graphs-v0.0.0 - Owner: https://github.com/l4b4r4b4b4
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e2932799fe22c184b212a74d269e9fdb57d3503b -
Trigger Event:
push
-
Statement type:
File details
Details for the file fractal_graph_react_agent-0.0.0-py3-none-any.whl.
File metadata
- Download URL: fractal_graph_react_agent-0.0.0-py3-none-any.whl
- Upload date:
- Size: 14.2 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 |
4621b2b0878a160fe32320e764011e2d2a74e8e9b1c43895e09169c6d1938744
|
|
| MD5 |
23891a0ae63cff82599690effd0bd8cf
|
|
| BLAKE2b-256 |
f60b3df70a18d020af0ca432ad710f5a8cb5d677844b61f4cbf73ab40b794151
|
Provenance
The following attestation bundles were made for fractal_graph_react_agent-0.0.0-py3-none-any.whl:
Publisher:
release.yml on l4b4r4b4b4/fractal-agents-runtime
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fractal_graph_react_agent-0.0.0-py3-none-any.whl -
Subject digest:
4621b2b0878a160fe32320e764011e2d2a74e8e9b1c43895e09169c6d1938744 - Sigstore transparency entry: 942519419
- Sigstore integration time:
-
Permalink:
l4b4r4b4b4/fractal-agents-runtime@e2932799fe22c184b212a74d269e9fdb57d3503b -
Branch / Tag:
refs/tags/python-graphs-v0.0.0 - Owner: https://github.com/l4b4r4b4b4
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e2932799fe22c184b212a74d269e9fdb57d3503b -
Trigger Event:
push
-
Statement type: