Skip to main content

A lightweight ReAct agent framework with tool calling, streaming chunks, and pluggable providers.

Project description

CrowAct

crowact is a lightweight ReAct agent framework with tool calling, streaming chunks, and pluggable providers.

Distribution name: crowact
Python import name: CrowAct

Requirements

  • Python 3.10+
  • requests
  • python-dotenv

Install

pip install crowact

For local development in this repository:

pip install -e .

Quick Start

from CrowAct import Agent, LLMProvider
from CrowAct.agent.tools import get_tools

TOOLS = get_tools("test_folder")


def main() -> None:
    provider = LLMProvider.from_anthropic_env("byte2.env")
    agent = Agent(
        provider=provider,
        model="deepseek-v3.2",
        system_prompt=(
            "You are a concise ReAct-style assistant. "
            "Use tools first when needed. "
            "You may call tools in multiple steps. "
            "After receiving tool results, provide the final answer."
        ),
        tools=TOOLS,
    )

    question = (
        "Please use tools to calculate this step by step: "
        "first compute 1+19, then take the square root of the result, "
        "and finally add 100."
    )

    for chunk in agent.run(question, stream=True):
        print(chunk)

    print(agent.last_answer)


if __name__ == "__main__":
    main()

Tool Files

get_tools(folder) loads every *.py file in the target folder and registers functions marked with the @tool(...) decorator.

Example folder:

test_folder/
  tool1.py
  tool2.py

Example tool:

from CrowAct.agent.tools import tool


@tool(
    description="Compute the square root of a number.",
    param_descriptions={"number": "The number to take the square root of"},
)
def sqrt_tool(number: float) -> float:
    return number ** 0.5

Agent Output

Agent.run(...) always returns an iterator of chunks.

Chunk types:

  • {"type": "text", "text": "..."}
  • {"type": "tool_use", "id": "...", "name": "...", "input": {...}}
  • {"type": "tool_result", "tool_use_id": "...", "content": "..."}

Behavior:

  • stream=True: text is yielded incrementally as streaming chunks.
  • stream=False: text is yielded as complete blocks, but the API remains iterator-based.

The final plain-text answer is stored in agent.last_answer.

History

You can pass prior conversation context through history.

agent = Agent(
    provider=provider,
    model="deepseek-v3.2",
    system_prompt="You are helpful.",
    history=[
        {"role": "user", "content": [{"type": "text", "text": "Previous question"}]},
        {"role": "assistant", "content": [{"type": "text", "text": "Previous answer"}]},
    ],
)

history is prepended to the current run, but it is not mutated after execution.

Provider Setup

Anthropic-style

provider = LLMProvider.from_anthropic_env(".env")

Expected environment variables:

ANTHROPIC_BASE_URL=https://your-endpoint
ANTHROPIC_API_KEY=your-api-key

Endpoint pattern:

  • .../v1/messages

OpenAI-style

provider = LLMProvider.from_openai_env(".env")

Expected environment variables:

OPENAI_BASE_URL=https://your-endpoint
OPENAI_API_KEY=your-api-key

Endpoint pattern:

  • .../chat/completions

Current Limitation

LLMProvider supports both anthropic and openai endpoint styles, but the request body and tool-calling flow are currently implemented around the Anthropic-style message format. If you use an OpenAI-compatible endpoint, confirm that it accepts the same request shape before relying on it.

Local Example

This repository includes:

License

Add a license before publishing to PyPI.

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

crowact-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

crowact-0.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file crowact-0.1.0.tar.gz.

File metadata

  • Download URL: crowact-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for crowact-0.1.0.tar.gz
Algorithm Hash digest
SHA256 69dad3adcddf91167759539bb36398227be7c37e20e6685e51611d492279bf81
MD5 56e860e443634ba2e732e87d4932233f
BLAKE2b-256 75da4db9d08ad59d89c7e4c17bd44c948fff5b6346ff28d21d51b1379e0db0a7

See more details on using hashes here.

File details

Details for the file crowact-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: crowact-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for crowact-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c614f25d4f42354cb032a27c4b5095fd6d56a3c23940497216062f1502034e4
MD5 08c3f7ceddb872952ecf75199c023de9
BLAKE2b-256 38899857cc9aba59e4dab4eaeafbbfc95d28940c10f5165547e695af864b2629

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