bridgic


Namebridgic JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryBridgic is a project that enables developers to develop agents/workflows in a more natural and flexible way, consisting of several Python packages.
upload_time2025-10-20 12:39:34
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords llm agent devtools workflow
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Bridgic is an innovative programming framework designed to create agentic systems, from simple workflows to fully autonomous agents. Its APIs are thoughtfully crafted to be both simple and powerful.

## Core Features

* **Orchestration**: Bridgic helps to manage the control flow of your AI applications asynchronously.
* **Dynamic Control Flow**: Bridgic supports dynamic routing based on input data, and even allows workers to be added or removed at runtime.
* **Modularity**: In Bridgic, a complex agentic system can be composed by reusing components through hierarchical nesting.
* **Human-in-the-Loop**: A workflow or an agent built with Bridgic can request feedback from humans whenever needed.
* **Serialization**: Bridgic includes serialization, deserialization, and resuming capabilities to support human-in-the-loop.
* **Parameter Binding**: There are three ways to pass data among workers, including Arguments Mapping, Arguments Injection, and Inputs Propagation.
* **Systematic Integration**: A wide range of tools and LLMs can be seamlessly integrated into the Bridgic world, in a systematic way.
* **Customization**: What Bridgic provides is not a "black box" approach. You have full control over every aspect of your AI applications, such as prompts, context windows, the control flow, and more.

## Install Bridgic

Python version 3.9 or higher is required.

```bash
pip install bridgic
```

## Example Code

Initialize the running environment for LLM:

```python
import os
from bridgic.llms.openai.openai_llm import OpenAILlm, OpenAIConfiguration

_api_key = os.environ.get("OPENAI_API_KEY")
_model_name = os.environ.get("OPENAI_MODEL_NAME")

llm = OpenAILlm(
    api_key=_api_key,
    configuration=OpenAIConfiguration(model=_model_name),
)
```

Then, create a `word learning assistant` with code:

```python
from bridgic.core.automa import GraphAutoma, worker
from bridgic.core.model.types import Message, Role

class WordLearningAssistant(GraphAutoma):
    @worker(is_start=True)
    async def generate_derivatives(self, word: str):
        response = await llm.achat(
            model=_model_name,
            messages=[
                Message.from_text(text="You are a word learning assistant. Generate derivatives of the input word in a list.", role=Role.SYSTEM),
                Message.from_text(text=word, role=Role.USER),
            ]
        )
        return response.message.content

    @worker(dependencies=["generate_derivatives"], is_output=True)
    async def make_sentences(self, derivatives):
        response = await llm.achat(
            model=_model_name,
            messages=[
                Message.from_text(text="You are a word learning assistant. Make sentences with the input derivatives in a list.", role=Role.SYSTEM),
                Message.from_text(text=derivatives, role=Role.USER),
            ]
        )
        return response.message.content
```

Let's run it:

```python
word_learning_assistant = WordLearningAssistant()
res = await word_learning_assistant.arun(word="happy")
print(res)
```

For more information and examples, see the [Tutorials](https://docs.bridgic.ai/tutorials/).

## Understanding

See [Understanding Bridgic](https://docs.bridgic.ai/home/introduction/).

## License

This repo is available under the [MIT license](/LICENSE).
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bridgic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "LLM, agent, devtools, workflow",
    "author": null,
    "author_email": "Tielei Zhang <zhangtl04@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/2f/4e/9a9170f25be7c27dac732236de83acac36a0d461d5e288f3824268ede3e6/bridgic-0.1.0.tar.gz",
    "platform": null,
    "description": "Bridgic is an innovative programming framework designed to create agentic systems, from simple workflows to fully autonomous agents. Its APIs are thoughtfully crafted to be both simple and powerful.\n\n## Core Features\n\n* **Orchestration**: Bridgic helps to manage the control flow of your AI applications asynchronously.\n* **Dynamic Control Flow**: Bridgic supports dynamic routing based on input data, and even allows workers to be added or removed at runtime.\n* **Modularity**: In Bridgic, a complex agentic system can be composed by reusing components through hierarchical nesting.\n* **Human-in-the-Loop**: A workflow or an agent built with Bridgic can request feedback from humans whenever needed.\n* **Serialization**: Bridgic includes serialization, deserialization, and resuming capabilities to support human-in-the-loop.\n* **Parameter Binding**: There are three ways to pass data among workers, including Arguments Mapping, Arguments Injection, and Inputs Propagation.\n* **Systematic Integration**: A wide range of tools and LLMs can be seamlessly integrated into the Bridgic world, in a systematic way.\n* **Customization**: What Bridgic provides is not a \"black box\" approach. You have full control over every aspect of your AI applications, such as prompts, context windows, the control flow, and more.\n\n## Install Bridgic\n\nPython version 3.9 or higher is required.\n\n```bash\npip install bridgic\n```\n\n## Example Code\n\nInitialize the running environment for LLM:\n\n```python\nimport os\nfrom bridgic.llms.openai.openai_llm import OpenAILlm, OpenAIConfiguration\n\n_api_key = os.environ.get(\"OPENAI_API_KEY\")\n_model_name = os.environ.get(\"OPENAI_MODEL_NAME\")\n\nllm = OpenAILlm(\n    api_key=_api_key,\n    configuration=OpenAIConfiguration(model=_model_name),\n)\n```\n\nThen, create a `word learning assistant` with code:\n\n```python\nfrom bridgic.core.automa import GraphAutoma, worker\nfrom bridgic.core.model.types import Message, Role\n\nclass WordLearningAssistant(GraphAutoma):\n    @worker(is_start=True)\n    async def generate_derivatives(self, word: str):\n        response = await llm.achat(\n            model=_model_name,\n            messages=[\n                Message.from_text(text=\"You are a word learning assistant. Generate derivatives of the input word in a list.\", role=Role.SYSTEM),\n                Message.from_text(text=word, role=Role.USER),\n            ]\n        )\n        return response.message.content\n\n    @worker(dependencies=[\"generate_derivatives\"], is_output=True)\n    async def make_sentences(self, derivatives):\n        response = await llm.achat(\n            model=_model_name,\n            messages=[\n                Message.from_text(text=\"You are a word learning assistant. Make sentences with the input derivatives in a list.\", role=Role.SYSTEM),\n                Message.from_text(text=derivatives, role=Role.USER),\n            ]\n        )\n        return response.message.content\n```\n\nLet's run it:\n\n```python\nword_learning_assistant = WordLearningAssistant()\nres = await word_learning_assistant.arun(word=\"happy\")\nprint(res)\n```\n\nFor more information and examples, see the [Tutorials](https://docs.bridgic.ai/tutorials/).\n\n## Understanding\n\nSee [Understanding Bridgic](https://docs.bridgic.ai/home/introduction/).\n\n## License\n\nThis repo is available under the [MIT license](/LICENSE).",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Bridgic is a project that enables developers to develop agents/workflows in a more natural and flexible way, consisting of several Python packages.",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "llm",
        " agent",
        " devtools",
        " workflow"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cfc6059d4a0753cc0b9b165e121c8ad24c1eb450c3b00519dbc2120b59286cda",
                "md5": "9234782e1ff0027e9b130ddef4d8793a",
                "sha256": "a71b3710bcf209382026e157d2078cd757b1af1c3e5b54828dd56770f3f61e51"
            },
            "downloads": -1,
            "filename": "bridgic-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9234782e1ff0027e9b130ddef4d8793a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 3443,
            "upload_time": "2025-10-20T12:39:33",
            "upload_time_iso_8601": "2025-10-20T12:39:33.311354Z",
            "url": "https://files.pythonhosted.org/packages/cf/c6/059d4a0753cc0b9b165e121c8ad24c1eb450c3b00519dbc2120b59286cda/bridgic-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2f4e9a9170f25be7c27dac732236de83acac36a0d461d5e288f3824268ede3e6",
                "md5": "526b86a83a87a9c820ec3f13444dc6d2",
                "sha256": "38d8bd94acc85d06536073f34bede9ed3b5e1817deb2b8b9ee3451ad6b4b8e93"
            },
            "downloads": -1,
            "filename": "bridgic-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "526b86a83a87a9c820ec3f13444dc6d2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 3094,
            "upload_time": "2025-10-20T12:39:34",
            "upload_time_iso_8601": "2025-10-20T12:39:34.368193Z",
            "url": "https://files.pythonhosted.org/packages/2f/4e/9a9170f25be7c27dac732236de83acac36a0d461d5e288f3824268ede3e6/bridgic-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-20 12:39:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "bridgic"
}
        
Elapsed time: 0.46922s