# DSPy-ReAct-Machina
Alternative ReAct implementation for DSPy with full conversation history in a unified context.
## Installation
```bash
pip install dspy-react-machina
```
## Quick Start
```python
import dspy
from dspy_react_machina import ReActMachina
# Configure your LM
lm = dspy.LM(model="openai/gpt-4o-mini")
dspy.configure(lm=lm)
# Define tools
def get_weather(city: str) -> str:
"""Get current weather for a city"""
return f"Weather in {city}: 72°F, sunny"
# Create agent
agent = ReActMachina("history: dspy.History, question -> answer", tools=[get_weather])
# Chat with persistent history
history = dspy.History(messages=[])
while True:
user_input = input("You: ").strip()
if user_input.lower() in ["quit", "exit"]:
break
response = agent(question=user_input, history=history)
print(f"Agent: {response.answer}\n")
# Update history for next turn
history = response.history
```
## Documentation
- [Examples](examples/) - Working examples including async and instrumentation
- [Testing Conventions](tests/TESTING_CONVENTIONS.md) - Testing guidelines
## Development
### Setup
```bash
uv sync
uv run pre-commit install
```
### Code Quality
```bash
uv run quality-check # Run all checks: ruff + pyright
```
### Testing
```bash
uv run tests # Run tests
uv run tests-coverage # Run tests with coverage
uv run tests-coverage --web # Run tests with coverage and open HTML report
```
Raw data
{
"_id": null,
"home_page": null,
"name": "dspy-react-machina",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "dspy, react, llm, agent, state-machine, conversation",
"author": "Arthur Moura Carvalho",
"author_email": "Arthur Moura Carvalho <armoucar@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a9/3f/25339d0a2a1bdd996ced5de9f4c30139a359a5c5ac8c9133119578e0ee97/dspy_react_machina-0.1.1.tar.gz",
"platform": null,
"description": "# DSPy-ReAct-Machina\n\nAlternative ReAct implementation for DSPy with full conversation history in a unified context.\n\n## Installation\n\n```bash\npip install dspy-react-machina\n```\n\n## Quick Start\n\n```python\nimport dspy\nfrom dspy_react_machina import ReActMachina\n\n# Configure your LM\nlm = dspy.LM(model=\"openai/gpt-4o-mini\")\ndspy.configure(lm=lm)\n\n# Define tools\ndef get_weather(city: str) -> str:\n \"\"\"Get current weather for a city\"\"\"\n return f\"Weather in {city}: 72\u00b0F, sunny\"\n\n# Create agent\nagent = ReActMachina(\"history: dspy.History, question -> answer\", tools=[get_weather])\n\n# Chat with persistent history\nhistory = dspy.History(messages=[])\n\nwhile True:\n user_input = input(\"You: \").strip()\n if user_input.lower() in [\"quit\", \"exit\"]:\n break\n\n response = agent(question=user_input, history=history)\n print(f\"Agent: {response.answer}\\n\")\n\n # Update history for next turn\n history = response.history\n```\n\n## Documentation\n\n- [Examples](examples/) - Working examples including async and instrumentation\n- [Testing Conventions](tests/TESTING_CONVENTIONS.md) - Testing guidelines\n\n## Development\n\n### Setup\n\n```bash\nuv sync\nuv run pre-commit install\n```\n\n### Code Quality\n\n```bash\nuv run quality-check # Run all checks: ruff + pyright\n```\n\n### Testing\n\n```bash\nuv run tests # Run tests\nuv run tests-coverage # Run tests with coverage\nuv run tests-coverage --web # Run tests with coverage and open HTML report\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Alternative ReAct implementation for DSPy with full conversation history",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/armoucar/dspy-react-machina",
"Issues": "https://github.com/armoucar/dspy-react-machina/issues",
"Repository": "https://github.com/armoucar/dspy-react-machina"
},
"split_keywords": [
"dspy",
" react",
" llm",
" agent",
" state-machine",
" conversation"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d2682322a92aed857d9903367f17c55005c2cf8fc7d7f40f13c6e3b3f62078ca",
"md5": "f31bbe1d0d79d7fd32e2b1ae3c1056b5",
"sha256": "4d21e71466ccaf934e02bdbfef5fcd36e8fe8aac971163ee4e560d952c6de597"
},
"downloads": -1,
"filename": "dspy_react_machina-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f31bbe1d0d79d7fd32e2b1ae3c1056b5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 26696,
"upload_time": "2025-10-06T23:15:57",
"upload_time_iso_8601": "2025-10-06T23:15:57.958011Z",
"url": "https://files.pythonhosted.org/packages/d2/68/2322a92aed857d9903367f17c55005c2cf8fc7d7f40f13c6e3b3f62078ca/dspy_react_machina-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a93f25339d0a2a1bdd996ced5de9f4c30139a359a5c5ac8c9133119578e0ee97",
"md5": "24c212efb5e7e99fc236f3a44aec927b",
"sha256": "3c26490ddc5c29df11daa94a7f12b770e8c777e0ef965b67d5620f688f17af2c"
},
"downloads": -1,
"filename": "dspy_react_machina-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "24c212efb5e7e99fc236f3a44aec927b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 21320,
"upload_time": "2025-10-06T23:15:58",
"upload_time_iso_8601": "2025-10-06T23:15:58.939209Z",
"url": "https://files.pythonhosted.org/packages/a9/3f/25339d0a2a1bdd996ced5de9f4c30139a359a5c5ac8c9133119578e0ee97/dspy_react_machina-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-06 23:15:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "armoucar",
"github_project": "dspy-react-machina",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "dspy-react-machina"
}