box-ai-agents-toolkit


Namebox-ai-agents-toolkit JSON
Version 0.0.44 PyPI version JSON
download
home_pageNone
SummaryA python library for building AI agents for Box
upload_time2025-07-25 17:52:42
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords agent ai box box ai box ai api box api box.com library toolkit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Box AI Agents Toolkit

A Python library for building AI agents for Box. This toolkit provides functionalities for authenticating with Box using OAuth and CCG, interacting with Box files and folders, managing document generation operations, and handling metadata templates.

## Features

- **Authentication**: Authenticate with Box using OAuth or CCG.
- **Box API Interactions**: Interact with Box files and folders.
- **File Upload & Download**: Easily upload files to and download files from Box.
- **Folder Management**: Create, update, delete, and list folder contents.
- **Search**: Search for content and locate folders by name.
- **Document Generation (DocGen)**: Create and manage document generation jobs and templates.
- **Metadata Templates**: Create and retrieve metadata templates by key, ID, or name.
- **Metadata Instances**: Set, get, update, and delete metadata instances on files.
- **AI Capabilities**: 
  - Ask AI questions about single or multiple files
  - Ask AI questions about Box hubs
  - Extract information using freeform prompts
  - Extract structured information using fields or templates
  - Enhanced extraction capabilities with improved formatting

## Installation

To install the toolkit, run:

```sh
pip install box-ai-agents-toolkit
```

## Usage

### Authentication

#### CCG Authentication

Create a `.env` file with:

```yaml
BOX_CLIENT_ID = "your client id"
BOX_CLIENT_SECRET = "your client secret"
BOX_SUBJECT_TYPE = "user/enterprise"
BOX_SUBJECT_ID = "user id/enterprise id"
```

Then authenticate:

```python
from box_ai_agents_toolkit import get_ccg_client

client = get_ccg_client()
```

#### OAuth Authentication

Create a `.env` file with:

```yaml
BOX_CLIENT_ID = "your client id"
BOX_CLIENT_SECRET = "your client secret"
BOX_REDIRECT_URL = "http://localhost:8000/callback"
```

Then authenticate:

```python
from box_ai_agents_toolkit import get_oauth_client

client = get_oauth_client()
```

### Box API Interactions

#### Files and Folders

**Get File by ID:**

```python
from box_ai_agents_toolkit import box_file_get_by_id

file = box_file_get_by_id(client, file_id="12345")
```

**Extract Text from File:**

```python
from box_ai_agents_toolkit import box_file_text_extract

text = box_file_text_extract(client, file_id="12345")
```

**List Folder Contents:**

```python
from box_ai_agents_toolkit import box_folder_list_content

contents = box_folder_list_content(client, folder_id="0")
print("Folder contents:", contents)
```

**Create a Folder:**

```python
from box_ai_agents_toolkit import box_create_folder

folder = box_create_folder(client, name="New Folder", parent_id="0")
print("Created folder:", folder)
```

**Update a Folder:**

```python
from box_ai_agents_toolkit import box_update_folder

updated_folder = box_update_folder(client, folder_id="12345", name="Updated Name", description="New description")
print("Updated folder:", updated_folder)
```

**Delete a Folder:**

```python
from box_ai_agents_toolkit import box_delete_folder

box_delete_folder(client, folder_id="12345")
print("Folder deleted")
```

#### File Upload & Download

**Upload a File:**

```python
from box_ai_agents_toolkit import box_upload_file

content = "This is a test file content."
result = box_upload_file(client, content, file_name="test_upload.txt", folder_id="0")
print("Uploaded File Info:", result)
```

**Download a File:**

```python
from box_ai_agents_toolkit import box_file_download

path_saved, file_content, mime_type = box_file_download(client, file_id="12345", save_file=True)
print("File saved to:", path_saved)
```

#### Search

**Search for Content:**

```python
from box_ai_agents_toolkit import box_search

results = box_search(client, query="contract", limit=10, content_types=["name", "description"])
print("Search results:", results)
```

**Locate Folder by Name:**

```python
from box_ai_agents_toolkit import box_locate_folder_by_name

folder = box_locate_folder_by_name(client, folder_name="Documents", parent_folder_id="0")
print("Found folder:", folder)
```

### Document Generation (DocGen)

**Mark a File as a DocGen Template:**

```python
from box_ai_agents_toolkit import box_docgen_template_create

template = box_docgen_template_create(client, file_id="template_file_id")
print("Created DocGen Template:", template)
```

**List DocGen Templates:**

```python
from box_ai_agents_toolkit import box_docgen_template_list

templates = box_docgen_template_list(client, marker='x', limit=10)
print("DocGen Templates:", templates)
```

**Delete a DocGen Template:**

```python
from box_ai_agents_toolkit import box_docgen_template_delete

box_docgen_template_delete(client, template_id="template_file_id")
print("Template deleted")
```

**Retrieve a DocGen Template by ID:**

```python
from box_ai_agents_toolkit import box_docgen_template_get_by_id

template_details = box_docgen_template_get_by_id(client, template_id="template_file_id")
print("Template details:", template_details)
```

**Retrieve a DocGen Template by Name:**

```python
from box_ai_agents_toolkit import box_docgen_template_get_by_name

template_details = box_docgen_template_get_by_name(client, template_name="My Template")
print("Template details:", template_details)
```

**List Template Tags and Jobs:**

```python
from box_ai_agents_toolkit import box_docgen_template_list_tags, box_docgen_template_list_jobs

tags = box_docgen_template_list_tags(client, template_id="template_file_id", template_version_id='v1', marker='m', limit=5)
jobs = box_docgen_template_list_jobs(client, template_id="template_file_id", marker='m2', limit=3)
print("Template tags:", tags)
print("Template jobs:", jobs)
```

**Create a Document Generation Batch:**

```python
from box_ai_agents_toolkit import box_docgen_create_batch

data_input = [
    {"generated_file_name": "file1", "user_input": {"a": "b"}},
    {"generated_file_name": "file2", "user_input": {"x": "y"}}
]
batch = box_docgen_create_batch(client, file_id="f1", input_source="api", destination_folder_id="dest", output_type="pdf", document_generation_data=data_input)
print("Batch job created:", batch)
```

**Create Single Document from User Input:**

```python
from box_ai_agents_toolkit import box_docgen_create_single_file_from_user_input

result = box_docgen_create_single_file_from_user_input(
    client, 
    file_id="template_file_id", 
    destination_folder_id="dest_folder_id", 
    user_input='{"name": "John Doe", "date": "2024-01-01"}', 
    generated_file_name="Generated Document",
    output_type="pdf"
)
print("Single document created:", result)
```

**Get DocGen Job by ID:**

```python
from box_ai_agents_toolkit import box_docgen_get_job_by_id

job = box_docgen_get_job_by_id(client, job_id="job123")
print("Job details:", job)
```

**List DocGen Jobs:**

```python
from box_ai_agents_toolkit import box_docgen_list_jobs

jobs = box_docgen_list_jobs(client, marker="m", limit=10)
print("DocGen jobs:", jobs)
```

**List Jobs by Batch:**

```python
from box_ai_agents_toolkit import box_docgen_list_jobs_by_batch

batch_jobs = box_docgen_list_jobs_by_batch(client, batch_id="batch123", marker="m", limit=5)
print("Batch jobs:", batch_jobs)
```

### Metadata Templates

**Create a Metadata Template:**

```python
from box_ai_agents_toolkit import box_metadata_template_create

template = box_metadata_template_create(
    client,
    scope="enterprise",
    display_name="My Template",
    template_key="tmpl1",
    hidden=True,
    fields=[{"key": "a", "type": "string"}],
    copy_instance_on_item_copy=False,
)
print("Created Metadata Template:", template)
```

**Retrieve a Metadata Template by Key:**

```python
from box_ai_agents_toolkit import box_metadata_template_get_by_key

template = box_metadata_template_get_by_key(client, scope="enterprise", template_key="tmpl1")
print("Metadata Template Details:", template)
```

**Retrieve a Metadata Template by ID:**

```python
from box_ai_agents_toolkit import box_metadata_template_get_by_id

template = box_metadata_template_get_by_id(client, template_id="12345")
print("Metadata Template Details:", template)
```

**Retrieve a Metadata Template by Name:**

```python
from box_ai_agents_toolkit import box_metadata_template_get_by_name

template = box_metadata_template_get_by_name(client, template_name="My Template", scope="enterprise")
print("Metadata Template Details:", template)
```

#### Metadata Instances on Files

**Set Metadata Instance on File:**

```python
from box_ai_agents_toolkit import box_metadata_set_instance_on_file

metadata = {"field1": "value1", "field2": "value2"}
result = box_metadata_set_instance_on_file(
    client, 
    file_id="12345", 
    scope="enterprise", 
    template_key="tmpl1", 
    metadata=metadata
)
print("Metadata set:", result)
```

**Get Metadata Instance on File:**

```python
from box_ai_agents_toolkit import box_metadata_get_instance_on_file

metadata = box_metadata_get_instance_on_file(
    client, 
    file_id="12345", 
    scope="enterprise", 
    template_key="tmpl1"
)
print("File metadata:", metadata)
```

**Update Metadata Instance on File:**

```python
from box_ai_agents_toolkit import box_metadata_update_instance_on_file

updates = [
    {"op": "replace", "path": "/field1", "value": "new_value1"},
    {"op": "add", "path": "/field3", "value": "value3"}
]
result = box_metadata_update_instance_on_file(
    client, 
    file_id="12345", 
    scope="enterprise", 
    template_key="tmpl1", 
    request_body=updates
)
print("Metadata updated:", result)
```

**Delete Metadata Instance on File:**

```python
from box_ai_agents_toolkit import box_metadata_delete_instance_on_file

box_metadata_delete_instance_on_file(
    client, 
    file_id="12345", 
    scope="enterprise", 
    template_key="tmpl1"
)
print("Metadata instance deleted")
```

### AI Capabilities

**Ask AI a Question about a Single File:**

```python
from box_ai_agents_toolkit import box_ai_ask_file_single

response = box_ai_ask_file_single(client, file_id="12345", prompt="What is this file about?")
print("AI Response:", response)
```

**Ask AI a Question about Multiple Files:**

```python
from box_ai_agents_toolkit import box_ai_ask_file_multi

file_ids = ["12345", "67890"]
response = box_ai_ask_file_multi(client, file_ids=file_ids, prompt="Compare these files")
print("AI Response:", response)
```

**Ask AI a Question about a Box Hub:**

```python
from box_ai_agents_toolkit import box_ai_ask_hub

response = box_ai_ask_hub(client, hubs_id="12345", prompt="What is the current policy on parental leave?")
print("AI Response:", response)
```

**Extract Information from Files using AI (Freeform):**

```python
from box_ai_agents_toolkit import box_ai_extract_freeform

response = box_ai_extract_freeform(client, file_id="12345", prompt="Extract date, name, and contract number from this file.")
print("AI Extract Response:", response)
```

**Extract Structured Information using Fields:**

```python
from box_ai_agents_toolkit import box_ai_extract_structured_using_fields

fields = [
    {"key": "contract_date", "type": "date", "description": "The contract signing date"},
    {"key": "parties", "type": "array", "description": "Names of contracting parties"}
]
response = box_ai_extract_structured_using_fields(client, file_id="12345", fields=fields)
print("Structured Extract Response:", response)
```

**Extract Enhanced Structured Information using Fields:**

```python
from box_ai_agents_toolkit import box_ai_extract_structured_enhanced_using_fields

fields = [
    {"key": "contract_date", "type": "date", "description": "The contract signing date"},
    {"key": "parties", "type": "array", "description": "Names of contracting parties"}
]
response = box_ai_extract_structured_enhanced_using_fields(client, file_id="12345", fields=fields)
print("Enhanced Structured Extract Response:", response)
```

**Extract Structured Information using Template:**

```python
from box_ai_agents_toolkit import box_ai_extract_structured_using_template

response = box_ai_extract_structured_using_template(client, file_id="12345", template_key="contract_template")
print("Template-based Extract Response:", response)
```

**Extract Enhanced Structured Information using Template:**

```python
from box_ai_agents_toolkit import box_ai_extract_structured_enhanced_using_template

response = box_ai_extract_structured_enhanced_using_template(client, file_id="12345", template_key="contract_template")
print("Enhanced Template-based Extract Response:", response)
```

## Development

### Setting Up

1. Clone the repository:
    ```sh
    git clone https://github.com/box-community/box-ai-agents-toolkit.git
    cd box-ai-agents-toolkit
    ```

2. Install dependencies:
    ```sh
    pip install -e .[dev]
    ```

### Running Tests

To run the tests, use:

```sh
pytest
```

### Linting and Code Quality

To run the linter:

```sh
ruff check
```

To format code:

```sh
ruff format
```

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.

## Contact

For questions or issues, open an issue on the [GitHub repository](https://github.com/box-community/box-ai-agents-toolkit/issues).
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "box-ai-agents-toolkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "Box Developer Relations <devrel@box.com>",
    "keywords": "agent, ai, box, box ai, box ai api, box api, box.com, library, toolkit",
    "author": null,
    "author_email": "Box Developer Relations <devrel@box.com>",
    "download_url": "https://files.pythonhosted.org/packages/e5/f3/bec93b6956b61f186c8403e12961bde2fc659911c48155491eb212e8600d/box_ai_agents_toolkit-0.0.44.tar.gz",
    "platform": null,
    "description": "# Box AI Agents Toolkit\n\nA Python library for building AI agents for Box. This toolkit provides functionalities for authenticating with Box using OAuth and CCG, interacting with Box files and folders, managing document generation operations, and handling metadata templates.\n\n## Features\n\n- **Authentication**: Authenticate with Box using OAuth or CCG.\n- **Box API Interactions**: Interact with Box files and folders.\n- **File Upload & Download**: Easily upload files to and download files from Box.\n- **Folder Management**: Create, update, delete, and list folder contents.\n- **Search**: Search for content and locate folders by name.\n- **Document Generation (DocGen)**: Create and manage document generation jobs and templates.\n- **Metadata Templates**: Create and retrieve metadata templates by key, ID, or name.\n- **Metadata Instances**: Set, get, update, and delete metadata instances on files.\n- **AI Capabilities**: \n  - Ask AI questions about single or multiple files\n  - Ask AI questions about Box hubs\n  - Extract information using freeform prompts\n  - Extract structured information using fields or templates\n  - Enhanced extraction capabilities with improved formatting\n\n## Installation\n\nTo install the toolkit, run:\n\n```sh\npip install box-ai-agents-toolkit\n```\n\n## Usage\n\n### Authentication\n\n#### CCG Authentication\n\nCreate a `.env` file with:\n\n```yaml\nBOX_CLIENT_ID = \"your client id\"\nBOX_CLIENT_SECRET = \"your client secret\"\nBOX_SUBJECT_TYPE = \"user/enterprise\"\nBOX_SUBJECT_ID = \"user id/enterprise id\"\n```\n\nThen authenticate:\n\n```python\nfrom box_ai_agents_toolkit import get_ccg_client\n\nclient = get_ccg_client()\n```\n\n#### OAuth Authentication\n\nCreate a `.env` file with:\n\n```yaml\nBOX_CLIENT_ID = \"your client id\"\nBOX_CLIENT_SECRET = \"your client secret\"\nBOX_REDIRECT_URL = \"http://localhost:8000/callback\"\n```\n\nThen authenticate:\n\n```python\nfrom box_ai_agents_toolkit import get_oauth_client\n\nclient = get_oauth_client()\n```\n\n### Box API Interactions\n\n#### Files and Folders\n\n**Get File by ID:**\n\n```python\nfrom box_ai_agents_toolkit import box_file_get_by_id\n\nfile = box_file_get_by_id(client, file_id=\"12345\")\n```\n\n**Extract Text from File:**\n\n```python\nfrom box_ai_agents_toolkit import box_file_text_extract\n\ntext = box_file_text_extract(client, file_id=\"12345\")\n```\n\n**List Folder Contents:**\n\n```python\nfrom box_ai_agents_toolkit import box_folder_list_content\n\ncontents = box_folder_list_content(client, folder_id=\"0\")\nprint(\"Folder contents:\", contents)\n```\n\n**Create a Folder:**\n\n```python\nfrom box_ai_agents_toolkit import box_create_folder\n\nfolder = box_create_folder(client, name=\"New Folder\", parent_id=\"0\")\nprint(\"Created folder:\", folder)\n```\n\n**Update a Folder:**\n\n```python\nfrom box_ai_agents_toolkit import box_update_folder\n\nupdated_folder = box_update_folder(client, folder_id=\"12345\", name=\"Updated Name\", description=\"New description\")\nprint(\"Updated folder:\", updated_folder)\n```\n\n**Delete a Folder:**\n\n```python\nfrom box_ai_agents_toolkit import box_delete_folder\n\nbox_delete_folder(client, folder_id=\"12345\")\nprint(\"Folder deleted\")\n```\n\n#### File Upload & Download\n\n**Upload a File:**\n\n```python\nfrom box_ai_agents_toolkit import box_upload_file\n\ncontent = \"This is a test file content.\"\nresult = box_upload_file(client, content, file_name=\"test_upload.txt\", folder_id=\"0\")\nprint(\"Uploaded File Info:\", result)\n```\n\n**Download a File:**\n\n```python\nfrom box_ai_agents_toolkit import box_file_download\n\npath_saved, file_content, mime_type = box_file_download(client, file_id=\"12345\", save_file=True)\nprint(\"File saved to:\", path_saved)\n```\n\n#### Search\n\n**Search for Content:**\n\n```python\nfrom box_ai_agents_toolkit import box_search\n\nresults = box_search(client, query=\"contract\", limit=10, content_types=[\"name\", \"description\"])\nprint(\"Search results:\", results)\n```\n\n**Locate Folder by Name:**\n\n```python\nfrom box_ai_agents_toolkit import box_locate_folder_by_name\n\nfolder = box_locate_folder_by_name(client, folder_name=\"Documents\", parent_folder_id=\"0\")\nprint(\"Found folder:\", folder)\n```\n\n### Document Generation (DocGen)\n\n**Mark a File as a DocGen Template:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_template_create\n\ntemplate = box_docgen_template_create(client, file_id=\"template_file_id\")\nprint(\"Created DocGen Template:\", template)\n```\n\n**List DocGen Templates:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_template_list\n\ntemplates = box_docgen_template_list(client, marker='x', limit=10)\nprint(\"DocGen Templates:\", templates)\n```\n\n**Delete a DocGen Template:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_template_delete\n\nbox_docgen_template_delete(client, template_id=\"template_file_id\")\nprint(\"Template deleted\")\n```\n\n**Retrieve a DocGen Template by ID:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_template_get_by_id\n\ntemplate_details = box_docgen_template_get_by_id(client, template_id=\"template_file_id\")\nprint(\"Template details:\", template_details)\n```\n\n**Retrieve a DocGen Template by Name:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_template_get_by_name\n\ntemplate_details = box_docgen_template_get_by_name(client, template_name=\"My Template\")\nprint(\"Template details:\", template_details)\n```\n\n**List Template Tags and Jobs:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_template_list_tags, box_docgen_template_list_jobs\n\ntags = box_docgen_template_list_tags(client, template_id=\"template_file_id\", template_version_id='v1', marker='m', limit=5)\njobs = box_docgen_template_list_jobs(client, template_id=\"template_file_id\", marker='m2', limit=3)\nprint(\"Template tags:\", tags)\nprint(\"Template jobs:\", jobs)\n```\n\n**Create a Document Generation Batch:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_create_batch\n\ndata_input = [\n    {\"generated_file_name\": \"file1\", \"user_input\": {\"a\": \"b\"}},\n    {\"generated_file_name\": \"file2\", \"user_input\": {\"x\": \"y\"}}\n]\nbatch = box_docgen_create_batch(client, file_id=\"f1\", input_source=\"api\", destination_folder_id=\"dest\", output_type=\"pdf\", document_generation_data=data_input)\nprint(\"Batch job created:\", batch)\n```\n\n**Create Single Document from User Input:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_create_single_file_from_user_input\n\nresult = box_docgen_create_single_file_from_user_input(\n    client, \n    file_id=\"template_file_id\", \n    destination_folder_id=\"dest_folder_id\", \n    user_input='{\"name\": \"John Doe\", \"date\": \"2024-01-01\"}', \n    generated_file_name=\"Generated Document\",\n    output_type=\"pdf\"\n)\nprint(\"Single document created:\", result)\n```\n\n**Get DocGen Job by ID:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_get_job_by_id\n\njob = box_docgen_get_job_by_id(client, job_id=\"job123\")\nprint(\"Job details:\", job)\n```\n\n**List DocGen Jobs:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_list_jobs\n\njobs = box_docgen_list_jobs(client, marker=\"m\", limit=10)\nprint(\"DocGen jobs:\", jobs)\n```\n\n**List Jobs by Batch:**\n\n```python\nfrom box_ai_agents_toolkit import box_docgen_list_jobs_by_batch\n\nbatch_jobs = box_docgen_list_jobs_by_batch(client, batch_id=\"batch123\", marker=\"m\", limit=5)\nprint(\"Batch jobs:\", batch_jobs)\n```\n\n### Metadata Templates\n\n**Create a Metadata Template:**\n\n```python\nfrom box_ai_agents_toolkit import box_metadata_template_create\n\ntemplate = box_metadata_template_create(\n    client,\n    scope=\"enterprise\",\n    display_name=\"My Template\",\n    template_key=\"tmpl1\",\n    hidden=True,\n    fields=[{\"key\": \"a\", \"type\": \"string\"}],\n    copy_instance_on_item_copy=False,\n)\nprint(\"Created Metadata Template:\", template)\n```\n\n**Retrieve a Metadata Template by Key:**\n\n```python\nfrom box_ai_agents_toolkit import box_metadata_template_get_by_key\n\ntemplate = box_metadata_template_get_by_key(client, scope=\"enterprise\", template_key=\"tmpl1\")\nprint(\"Metadata Template Details:\", template)\n```\n\n**Retrieve a Metadata Template by ID:**\n\n```python\nfrom box_ai_agents_toolkit import box_metadata_template_get_by_id\n\ntemplate = box_metadata_template_get_by_id(client, template_id=\"12345\")\nprint(\"Metadata Template Details:\", template)\n```\n\n**Retrieve a Metadata Template by Name:**\n\n```python\nfrom box_ai_agents_toolkit import box_metadata_template_get_by_name\n\ntemplate = box_metadata_template_get_by_name(client, template_name=\"My Template\", scope=\"enterprise\")\nprint(\"Metadata Template Details:\", template)\n```\n\n#### Metadata Instances on Files\n\n**Set Metadata Instance on File:**\n\n```python\nfrom box_ai_agents_toolkit import box_metadata_set_instance_on_file\n\nmetadata = {\"field1\": \"value1\", \"field2\": \"value2\"}\nresult = box_metadata_set_instance_on_file(\n    client, \n    file_id=\"12345\", \n    scope=\"enterprise\", \n    template_key=\"tmpl1\", \n    metadata=metadata\n)\nprint(\"Metadata set:\", result)\n```\n\n**Get Metadata Instance on File:**\n\n```python\nfrom box_ai_agents_toolkit import box_metadata_get_instance_on_file\n\nmetadata = box_metadata_get_instance_on_file(\n    client, \n    file_id=\"12345\", \n    scope=\"enterprise\", \n    template_key=\"tmpl1\"\n)\nprint(\"File metadata:\", metadata)\n```\n\n**Update Metadata Instance on File:**\n\n```python\nfrom box_ai_agents_toolkit import box_metadata_update_instance_on_file\n\nupdates = [\n    {\"op\": \"replace\", \"path\": \"/field1\", \"value\": \"new_value1\"},\n    {\"op\": \"add\", \"path\": \"/field3\", \"value\": \"value3\"}\n]\nresult = box_metadata_update_instance_on_file(\n    client, \n    file_id=\"12345\", \n    scope=\"enterprise\", \n    template_key=\"tmpl1\", \n    request_body=updates\n)\nprint(\"Metadata updated:\", result)\n```\n\n**Delete Metadata Instance on File:**\n\n```python\nfrom box_ai_agents_toolkit import box_metadata_delete_instance_on_file\n\nbox_metadata_delete_instance_on_file(\n    client, \n    file_id=\"12345\", \n    scope=\"enterprise\", \n    template_key=\"tmpl1\"\n)\nprint(\"Metadata instance deleted\")\n```\n\n### AI Capabilities\n\n**Ask AI a Question about a Single File:**\n\n```python\nfrom box_ai_agents_toolkit import box_ai_ask_file_single\n\nresponse = box_ai_ask_file_single(client, file_id=\"12345\", prompt=\"What is this file about?\")\nprint(\"AI Response:\", response)\n```\n\n**Ask AI a Question about Multiple Files:**\n\n```python\nfrom box_ai_agents_toolkit import box_ai_ask_file_multi\n\nfile_ids = [\"12345\", \"67890\"]\nresponse = box_ai_ask_file_multi(client, file_ids=file_ids, prompt=\"Compare these files\")\nprint(\"AI Response:\", response)\n```\n\n**Ask AI a Question about a Box Hub:**\n\n```python\nfrom box_ai_agents_toolkit import box_ai_ask_hub\n\nresponse = box_ai_ask_hub(client, hubs_id=\"12345\", prompt=\"What is the current policy on parental leave?\")\nprint(\"AI Response:\", response)\n```\n\n**Extract Information from Files using AI (Freeform):**\n\n```python\nfrom box_ai_agents_toolkit import box_ai_extract_freeform\n\nresponse = box_ai_extract_freeform(client, file_id=\"12345\", prompt=\"Extract date, name, and contract number from this file.\")\nprint(\"AI Extract Response:\", response)\n```\n\n**Extract Structured Information using Fields:**\n\n```python\nfrom box_ai_agents_toolkit import box_ai_extract_structured_using_fields\n\nfields = [\n    {\"key\": \"contract_date\", \"type\": \"date\", \"description\": \"The contract signing date\"},\n    {\"key\": \"parties\", \"type\": \"array\", \"description\": \"Names of contracting parties\"}\n]\nresponse = box_ai_extract_structured_using_fields(client, file_id=\"12345\", fields=fields)\nprint(\"Structured Extract Response:\", response)\n```\n\n**Extract Enhanced Structured Information using Fields:**\n\n```python\nfrom box_ai_agents_toolkit import box_ai_extract_structured_enhanced_using_fields\n\nfields = [\n    {\"key\": \"contract_date\", \"type\": \"date\", \"description\": \"The contract signing date\"},\n    {\"key\": \"parties\", \"type\": \"array\", \"description\": \"Names of contracting parties\"}\n]\nresponse = box_ai_extract_structured_enhanced_using_fields(client, file_id=\"12345\", fields=fields)\nprint(\"Enhanced Structured Extract Response:\", response)\n```\n\n**Extract Structured Information using Template:**\n\n```python\nfrom box_ai_agents_toolkit import box_ai_extract_structured_using_template\n\nresponse = box_ai_extract_structured_using_template(client, file_id=\"12345\", template_key=\"contract_template\")\nprint(\"Template-based Extract Response:\", response)\n```\n\n**Extract Enhanced Structured Information using Template:**\n\n```python\nfrom box_ai_agents_toolkit import box_ai_extract_structured_enhanced_using_template\n\nresponse = box_ai_extract_structured_enhanced_using_template(client, file_id=\"12345\", template_key=\"contract_template\")\nprint(\"Enhanced Template-based Extract Response:\", response)\n```\n\n## Development\n\n### Setting Up\n\n1. Clone the repository:\n    ```sh\n    git clone https://github.com/box-community/box-ai-agents-toolkit.git\n    cd box-ai-agents-toolkit\n    ```\n\n2. Install dependencies:\n    ```sh\n    pip install -e .[dev]\n    ```\n\n### Running Tests\n\nTo run the tests, use:\n\n```sh\npytest\n```\n\n### Linting and Code Quality\n\nTo run the linter:\n\n```sh\nruff check\n```\n\nTo format code:\n\n```sh\nruff format\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.\n\n## Contact\n\nFor questions or issues, open an issue on the [GitHub repository](https://github.com/box-community/box-ai-agents-toolkit/issues).",
    "bugtrack_url": null,
    "license": null,
    "summary": "A python library for building AI agents for Box",
    "version": "0.0.44",
    "project_urls": {
        "Issues": "https://github.com/box-community/box-ai-agents-toolkit/issues",
        "Repository": "https://github.com/box-community/box-ai-agents-toolkit.git"
    },
    "split_keywords": [
        "agent",
        " ai",
        " box",
        " box ai",
        " box ai api",
        " box api",
        " box.com",
        " library",
        " toolkit"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "dd1ea82b7bf9b77f69e2002f0dd2d16f29b3b665d84fbcb9970bff5ed37c5fa2",
                "md5": "1a9c3fc8613acfbf46beb22d7d434507",
                "sha256": "c161f9d875b15a71662cde5630de874deb45f0a46bd710ed77674a2a03e67b09"
            },
            "downloads": -1,
            "filename": "box_ai_agents_toolkit-0.0.44-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1a9c3fc8613acfbf46beb22d7d434507",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 23592,
            "upload_time": "2025-07-25T17:52:41",
            "upload_time_iso_8601": "2025-07-25T17:52:41.170025Z",
            "url": "https://files.pythonhosted.org/packages/dd/1e/a82b7bf9b77f69e2002f0dd2d16f29b3b665d84fbcb9970bff5ed37c5fa2/box_ai_agents_toolkit-0.0.44-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e5f3bec93b6956b61f186c8403e12961bde2fc659911c48155491eb212e8600d",
                "md5": "a50798e353e365772c3676a55b9daa21",
                "sha256": "e46d0141020789b3b6320e11664accb8fb24523937891cea089b6c276c5edc17"
            },
            "downloads": -1,
            "filename": "box_ai_agents_toolkit-0.0.44.tar.gz",
            "has_sig": false,
            "md5_digest": "a50798e353e365772c3676a55b9daa21",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 322558,
            "upload_time": "2025-07-25T17:52:42",
            "upload_time_iso_8601": "2025-07-25T17:52:42.123478Z",
            "url": "https://files.pythonhosted.org/packages/e5/f3/bec93b6956b61f186c8403e12961bde2fc659911c48155491eb212e8600d/box_ai_agents_toolkit-0.0.44.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-25 17:52:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "box-community",
    "github_project": "box-ai-agents-toolkit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "box-ai-agents-toolkit"
}
        
Elapsed time: 1.50094s