> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentoffice.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK

> Install and use the Agent Office Python SDK

## Installation

```bash theme={null}
pip install agent-office
```

## Documentation

View the full SDK on PyPI:

<Card title="agent-office on PyPI" icon="python" href="https://pypi.org/project/agent-office/">
  Complete Python SDK documentation and API reference
</Card>

## Quick Example

```python theme={null}
from agent_office import AgentOffice
from uuid import uuid4

# Initialize the client
client = AgentOffice(api_key="YOUR_API_KEY")

# Upload a document with tracked changes enabled
doc = client.documents.create(
    file="document.docx",
    return_markdown=True,
    tracked_changes=True,
    author_name="John Doe"
)

# Edit the document
edit = client.edit(
    doc_id=doc.doc_id,
    edit_uid=str(uuid4()),
    edit_instructions="Change the title to 'My New Title'",
    save_chunks_for_review=False
)

# Download the edited document
result = client.documents.download(doc_id=doc.doc_id)
print(result.download_url)
```

## Features

* 📝 Upload and convert documents (DOCX, PDF, etc.)
* ✏️ AI-powered document editing
* 📖 Read document content as Markdown
* 💾 Download edited documents
* 🔄 Track changes support

## Error Handling

The SDK provides specific exception types for different error conditions:

```python theme={null}
from agent_office import (
    AgentOffice,
    AgentOfficeError,
    AuthenticationError,
    NotFoundError,
    ValidationError,
    RateLimitError,
    ServerError,
)

client = AgentOffice(api_key="YOUR_API_KEY")

try:
    doc = client.documents.create("document.docx")
except AuthenticationError:
    print("Invalid API key")
except NotFoundError:
    print("Document not found")
except ValidationError as e:
    print(f"Validation error: {e.message}")
except RateLimitError:
    print("Rate limit exceeded")
except ServerError:
    print("Server error")
except AgentOfficeError as e:
    print(f"General error: {e.message}")
```
