aigents-sdk


Nameaigents-sdk JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/aigents/aigents-python
SummaryOfficial Python client library for AIgents AI platform
upload_time2025-08-19 12:44:01
maintainerNone
docs_urlNone
authorAIgents Team
requires_python>=3.8
licenseNone
keywords ai artificial-intelligence chatbot llm gpt agents tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AIgents Python Client

Official Python client library for the AIgents AI platform.

## Installation

```bash
pip install aigents-sdk
```

## Quick Start

```python
from aigents import AIgentsClient

# Initialize the client with your API key
client = AIgentsClient(
    api_key="aig_your_api_key_here",
    base_url="http://localhost:8000"  # or your AIgents server URL
)

# List your applications
apps = client.applications.list()
print(f"Found {len(apps)} applications")

# Get a specific application
app = client.applications.get("app_id")
print(f"Application: {app.name}")

# List agents in an application
agents = client.applications.agents.list("app_id")
print(f"Found {len(agents)} agents")

# Start a chat session
session = client.chat.create_session("app_id", agent_id="agent_id")
print(f"Created session: {session.id}")

# Send a message
response = client.chat.send_message(
    session_id=session.id,
    content="Hello, how can you help me today?"
)
print(f"Assistant: {response.content}")
```

## Advanced Usage

### Tool Calls and MCP Approval

```python
# Send a message that might trigger tool calls
response = client.chat.send_message(
    session_id=session.id,
    content="What's the weather like in San Francisco?",
    tools=[{"type": "weather_api"}]
)

# Handle tool calls
if response.tool_calls:
    for tool_call in response.tool_calls:
        print(f"Tool call: {tool_call.name}")
        print(f"Arguments: {tool_call.arguments}")

# Handle MCP approval requests
if response.requires_mcp_approval:
    print(f"MCP approval required: {response.mcp_approval_request_id}")
    
    # Approve the MCP request
    approved_response = client.chat.approve_mcp_request(
        request_id=response.mcp_approval_request_id,
        approved=True
    )
```

### Working with Datasets

```python
# List datasets
datasets = client.applications.datasets.list("app_id")

# Add data to a dataset
client.applications.datasets.add_data(
    app_id="app_id",
    dataset_id="dataset_id",
    data=[
        {
            "input": "What is machine learning?",
            "output": "Machine learning is a subset of AI...",
            "metadata": {"category": "education"}
        }
    ]
)
```

### Error Handling

```python
from aigents.exceptions import AIgentsError, AuthenticationError, RateLimitError

try:
    response = client.chat.send_message(session_id, "Hello")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limit exceeded")
except AIgentsError as e:
    print(f"API error: {e}")
```

## Configuration

The client can be configured with environment variables:

```bash
export AIGENTS_API_KEY="aig_your_api_key_here"
export AIGENTS_BASE_URL="https://api.aigents.co"
```

```python
# Client will automatically use environment variables
client = AIgentsClient()
```

## API Reference

### Client

- `AIgentsClient(api_key, base_url, timeout)`

### Applications

- `client.applications.list()` - List all applications
- `client.applications.get(app_id)` - Get application details
- `client.applications.create(name, description)` - Create new application
- `client.applications.update(app_id, **kwargs)` - Update application
- `client.applications.delete(app_id)` - Delete application

### Agents

- `client.applications.agents.list(app_id)` - List agents
- `client.applications.agents.get(app_id, agent_id)` - Get agent details
- `client.applications.agents.create(app_id, **kwargs)` - Create agent
- `client.applications.agents.update(app_id, agent_id, **kwargs)` - Update agent
- `client.applications.agents.delete(app_id, agent_id)` - Delete agent

### Chat

- `client.chat.create_session(app_id, **kwargs)` - Create chat session
- `client.chat.send_message(session_id, content, **kwargs)` - Send message
- `client.chat.get_history(session_id)` - Get chat history
- `client.chat.approve_mcp_request(request_id, approved)` - Approve MCP request

### Tools & MCPs

- `client.applications.tools.list(app_id)` - List tools
- `client.applications.mcps.list(app_id)` - List MCPs

### Datasets

- `client.applications.datasets.list(app_id)` - List datasets
- `client.applications.datasets.get(app_id, dataset_id)` - Get dataset
- `client.applications.datasets.add_data(app_id, dataset_id, data)` - Add data

## Contributing

1. Clone the repository
2. Install development dependencies: `pip install -e .[dev]`
3. Run tests: `pytest`
4. Format code: `black aigents/`
5. Type check: `mypy aigents/`

## License

MIT License - see LICENSE file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aigents/aigents-python",
    "name": "aigents-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ai, artificial-intelligence, chatbot, llm, gpt, agents, tools",
    "author": "AIgents Team",
    "author_email": "AIgents Team <support@aigents.co>",
    "download_url": "https://files.pythonhosted.org/packages/de/2a/ce59b73d9e9a6a40d54bca8ada26ae566c3dc1d966884cd31b412fc45908/aigents_sdk-0.1.0.tar.gz",
    "platform": null,
    "description": "# AIgents Python Client\n\nOfficial Python client library for the AIgents AI platform.\n\n## Installation\n\n```bash\npip install aigents-sdk\n```\n\n## Quick Start\n\n```python\nfrom aigents import AIgentsClient\n\n# Initialize the client with your API key\nclient = AIgentsClient(\n    api_key=\"aig_your_api_key_here\",\n    base_url=\"http://localhost:8000\"  # or your AIgents server URL\n)\n\n# List your applications\napps = client.applications.list()\nprint(f\"Found {len(apps)} applications\")\n\n# Get a specific application\napp = client.applications.get(\"app_id\")\nprint(f\"Application: {app.name}\")\n\n# List agents in an application\nagents = client.applications.agents.list(\"app_id\")\nprint(f\"Found {len(agents)} agents\")\n\n# Start a chat session\nsession = client.chat.create_session(\"app_id\", agent_id=\"agent_id\")\nprint(f\"Created session: {session.id}\")\n\n# Send a message\nresponse = client.chat.send_message(\n    session_id=session.id,\n    content=\"Hello, how can you help me today?\"\n)\nprint(f\"Assistant: {response.content}\")\n```\n\n## Advanced Usage\n\n### Tool Calls and MCP Approval\n\n```python\n# Send a message that might trigger tool calls\nresponse = client.chat.send_message(\n    session_id=session.id,\n    content=\"What's the weather like in San Francisco?\",\n    tools=[{\"type\": \"weather_api\"}]\n)\n\n# Handle tool calls\nif response.tool_calls:\n    for tool_call in response.tool_calls:\n        print(f\"Tool call: {tool_call.name}\")\n        print(f\"Arguments: {tool_call.arguments}\")\n\n# Handle MCP approval requests\nif response.requires_mcp_approval:\n    print(f\"MCP approval required: {response.mcp_approval_request_id}\")\n    \n    # Approve the MCP request\n    approved_response = client.chat.approve_mcp_request(\n        request_id=response.mcp_approval_request_id,\n        approved=True\n    )\n```\n\n### Working with Datasets\n\n```python\n# List datasets\ndatasets = client.applications.datasets.list(\"app_id\")\n\n# Add data to a dataset\nclient.applications.datasets.add_data(\n    app_id=\"app_id\",\n    dataset_id=\"dataset_id\",\n    data=[\n        {\n            \"input\": \"What is machine learning?\",\n            \"output\": \"Machine learning is a subset of AI...\",\n            \"metadata\": {\"category\": \"education\"}\n        }\n    ]\n)\n```\n\n### Error Handling\n\n```python\nfrom aigents.exceptions import AIgentsError, AuthenticationError, RateLimitError\n\ntry:\n    response = client.chat.send_message(session_id, \"Hello\")\nexcept AuthenticationError:\n    print(\"Invalid API key\")\nexcept RateLimitError:\n    print(\"Rate limit exceeded\")\nexcept AIgentsError as e:\n    print(f\"API error: {e}\")\n```\n\n## Configuration\n\nThe client can be configured with environment variables:\n\n```bash\nexport AIGENTS_API_KEY=\"aig_your_api_key_here\"\nexport AIGENTS_BASE_URL=\"https://api.aigents.co\"\n```\n\n```python\n# Client will automatically use environment variables\nclient = AIgentsClient()\n```\n\n## API Reference\n\n### Client\n\n- `AIgentsClient(api_key, base_url, timeout)`\n\n### Applications\n\n- `client.applications.list()` - List all applications\n- `client.applications.get(app_id)` - Get application details\n- `client.applications.create(name, description)` - Create new application\n- `client.applications.update(app_id, **kwargs)` - Update application\n- `client.applications.delete(app_id)` - Delete application\n\n### Agents\n\n- `client.applications.agents.list(app_id)` - List agents\n- `client.applications.agents.get(app_id, agent_id)` - Get agent details\n- `client.applications.agents.create(app_id, **kwargs)` - Create agent\n- `client.applications.agents.update(app_id, agent_id, **kwargs)` - Update agent\n- `client.applications.agents.delete(app_id, agent_id)` - Delete agent\n\n### Chat\n\n- `client.chat.create_session(app_id, **kwargs)` - Create chat session\n- `client.chat.send_message(session_id, content, **kwargs)` - Send message\n- `client.chat.get_history(session_id)` - Get chat history\n- `client.chat.approve_mcp_request(request_id, approved)` - Approve MCP request\n\n### Tools & MCPs\n\n- `client.applications.tools.list(app_id)` - List tools\n- `client.applications.mcps.list(app_id)` - List MCPs\n\n### Datasets\n\n- `client.applications.datasets.list(app_id)` - List datasets\n- `client.applications.datasets.get(app_id, dataset_id)` - Get dataset\n- `client.applications.datasets.add_data(app_id, dataset_id, data)` - Add data\n\n## Contributing\n\n1. Clone the repository\n2. Install development dependencies: `pip install -e .[dev]`\n3. Run tests: `pytest`\n4. Format code: `black aigents/`\n5. Type check: `mypy aigents/`\n\n## License\n\nMIT License - see LICENSE file for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Official Python client library for AIgents AI platform",
    "version": "0.1.0",
    "project_urls": {
        "Bug Reports": "https://github.com/aigents/aigents-python/issues",
        "Documentation": "https://docs.aigents.co",
        "Homepage": "https://aigents.co",
        "Repository": "https://github.com/aigents/aigents-python"
    },
    "split_keywords": [
        "ai",
        " artificial-intelligence",
        " chatbot",
        " llm",
        " gpt",
        " agents",
        " tools"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c34a951aa9c55b709b6c9dbe3bc544b72c5df1e190b17ac2ce7e34e12b300c98",
                "md5": "b1a63046f82f87a9d0c174e94d318d62",
                "sha256": "99d53e662bd8ecc8c4fbbe463389a3c1ca73c5e7fe5f0707be61222064f43c89"
            },
            "downloads": -1,
            "filename": "aigents_sdk-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b1a63046f82f87a9d0c174e94d318d62",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11088,
            "upload_time": "2025-08-19T12:43:59",
            "upload_time_iso_8601": "2025-08-19T12:43:59.177605Z",
            "url": "https://files.pythonhosted.org/packages/c3/4a/951aa9c55b709b6c9dbe3bc544b72c5df1e190b17ac2ce7e34e12b300c98/aigents_sdk-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "de2ace59b73d9e9a6a40d54bca8ada26ae566c3dc1d966884cd31b412fc45908",
                "md5": "d9cdd9ea1d1f90e3eeef8648464b83b8",
                "sha256": "920646981978ff0a6f65b3cebf95d91846c8742464da04efe7f2e984fc896a82"
            },
            "downloads": -1,
            "filename": "aigents_sdk-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d9cdd9ea1d1f90e3eeef8648464b83b8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11821,
            "upload_time": "2025-08-19T12:44:01",
            "upload_time_iso_8601": "2025-08-19T12:44:01.370713Z",
            "url": "https://files.pythonhosted.org/packages/de/2a/ce59b73d9e9a6a40d54bca8ada26ae566c3dc1d966884cd31b412fc45908/aigents_sdk-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 12:44:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aigents",
    "github_project": "aigents-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "aigents-sdk"
}
        
Elapsed time: 0.55105s