py-agent-tools


Namepy-agent-tools JSON
Version 0.0.24 PyPI version JSON
download
home_pageNone
Summary...
upload_time2025-07-17 07:42:31
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # py-agent-tools

A Python package providing tools for working with various AI agents and APIs.

## Installation

```bash
pip install py-agent-tools
```

## Usage

- How to use model switcher with local credentials:

```python
# 服务起来的时候需要加载所有可用的凭证
switcher = ModelSwitcher(allowed_providers=['laozhang'])
await switcher.start_all_pools()

# 通过 model_provider 和 model_name 获取凭证池
model_provider = 'laozhang'
model_name = 'o4-mini'
credential_pool = self.model_switcher.get_credential_pool(model_provider, model_name)

# 根据 model_provider 和凭证池创建 agent, 可以设置系统提示词, 模型参数, 以及 http 请求的超时时间
agent= switcher.get_agent_cls(model_provider).create(
    system_prompt='system',
    credential_pool=credential_pool,
    model_settings={'temperature': 0.0},
    timeout=300,
)

# 给定提示词,agent 运行推理并存储结果于 runner 对象里, 支持传入后处理函数, 支持查看 usage 等信息
runner = await agent.run('hello')
print(runner.result)

# 服务关闭的时候清除所有凭证
switcher.stop_all_pools()
```

- TODO: How to use model switcher with remote credential api:

## Features

- Support for multiple AI agent providers
- Unified interface for different APIs
- Credential management
- Model switching capabilities

## Requirements

- Python >= 3.10

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "py-agent-tools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Sheldon Lee <sheldonlee@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/ce/79/3cc8c2956fcf1e9fff588b22f91eb70533160a73ae16909bbe4f172235a2/py_agent_tools-0.0.24.tar.gz",
    "platform": null,
    "description": "# py-agent-tools\n\nA Python package providing tools for working with various AI agents and APIs.\n\n## Installation\n\n```bash\npip install py-agent-tools\n```\n\n## Usage\n\n- How to use model switcher with local credentials:\n\n```python\n# \u670d\u52a1\u8d77\u6765\u7684\u65f6\u5019\u9700\u8981\u52a0\u8f7d\u6240\u6709\u53ef\u7528\u7684\u51ed\u8bc1\nswitcher = ModelSwitcher(allowed_providers=['laozhang'])\nawait switcher.start_all_pools()\n\n# \u901a\u8fc7 model_provider \u548c model_name \u83b7\u53d6\u51ed\u8bc1\u6c60\nmodel_provider = 'laozhang'\nmodel_name = 'o4-mini'\ncredential_pool = self.model_switcher.get_credential_pool(model_provider, model_name)\n\n# \u6839\u636e model_provider \u548c\u51ed\u8bc1\u6c60\u521b\u5efa agent, \u53ef\u4ee5\u8bbe\u7f6e\u7cfb\u7edf\u63d0\u793a\u8bcd, \u6a21\u578b\u53c2\u6570, \u4ee5\u53ca http \u8bf7\u6c42\u7684\u8d85\u65f6\u65f6\u95f4\nagent= switcher.get_agent_cls(model_provider).create(\n    system_prompt='system',\n    credential_pool=credential_pool,\n    model_settings={'temperature': 0.0},\n    timeout=300,\n)\n\n# \u7ed9\u5b9a\u63d0\u793a\u8bcd\uff0cagent \u8fd0\u884c\u63a8\u7406\u5e76\u5b58\u50a8\u7ed3\u679c\u4e8e runner \u5bf9\u8c61\u91cc, \u652f\u6301\u4f20\u5165\u540e\u5904\u7406\u51fd\u6570, \u652f\u6301\u67e5\u770b usage \u7b49\u4fe1\u606f\nrunner = await agent.run('hello')\nprint(runner.result)\n\n# \u670d\u52a1\u5173\u95ed\u7684\u65f6\u5019\u6e05\u9664\u6240\u6709\u51ed\u8bc1\nswitcher.stop_all_pools()\n```\n\n- TODO: How to use model switcher with remote credential api:\n\n## Features\n\n- Support for multiple AI agent providers\n- Unified interface for different APIs\n- Credential management\n- Model switching capabilities\n\n## Requirements\n\n- Python >= 3.10\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "...",
    "version": "0.0.24",
    "project_urls": {
        "Homepage": "https://github.com/sheldonldev/py-agent-tools",
        "Issues": "https://github.com/sheldonldev/py-agent-tools/issues",
        "Repository": "https://github.com/sheldonldev/py-agent-tools"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "366392b02c7cf945f2172a0b4ecfff9de926fe5e8565ac4aea1052ae44013dcc",
                "md5": "e9c7d465e16c6e40022b17d2a91d4b8c",
                "sha256": "c380356fe13f0d8aaa080f7c2e6d055cbcd8c7be2952179c75e1232a95ba09eb"
            },
            "downloads": -1,
            "filename": "py_agent_tools-0.0.24-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e9c7d465e16c6e40022b17d2a91d4b8c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 20566,
            "upload_time": "2025-07-17T07:42:29",
            "upload_time_iso_8601": "2025-07-17T07:42:29.018992Z",
            "url": "https://files.pythonhosted.org/packages/36/63/92b02c7cf945f2172a0b4ecfff9de926fe5e8565ac4aea1052ae44013dcc/py_agent_tools-0.0.24-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ce793cc8c2956fcf1e9fff588b22f91eb70533160a73ae16909bbe4f172235a2",
                "md5": "5d3657fffa234319998b11c72e247118",
                "sha256": "23da2efae75ae9b6ecfa44e401071fc6a4267b47b68b9df69c74e45275b05ef0"
            },
            "downloads": -1,
            "filename": "py_agent_tools-0.0.24.tar.gz",
            "has_sig": false,
            "md5_digest": "5d3657fffa234319998b11c72e247118",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 14001,
            "upload_time": "2025-07-17T07:42:31",
            "upload_time_iso_8601": "2025-07-17T07:42:31.241446Z",
            "url": "https://files.pythonhosted.org/packages/ce/79/3cc8c2956fcf1e9fff588b22f91eb70533160a73ae16909bbe4f172235a2/py_agent_tools-0.0.24.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-17 07:42:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sheldonldev",
    "github_project": "py-agent-tools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "py-agent-tools"
}
        
Elapsed time: 0.94440s