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

# Python SDK

> Use AgentLine from Python.

# Python SDK

```bash theme={null}
pip install agentline-ai
```

```python theme={null}
from agentline_ai import AgentLine

client = AgentLine(api_key="al_live_...")
```

> PyPI `agentline` is already taken, so the Python distribution is
> **`agentline-ai`** (import `agentline_ai`). The Node package is not on npm
> yet. See [Node](https://docs.agentline.cloud/sdk/node.md).

## Resources

The client is grouped by resource, mirroring the [API Reference](https://docs.agentline.cloud/api-reference):

```python theme={null}
client.agents     # create, list, get, update, delete
client.numbers    # buy, list, get, attach, reassign, release (destructive)
client.calls      # create, list, get, get_transcript, hangup, push_context
client.messages   # send, list, list_conversations
client.events     # poll, peek
client.webhooks   # list, set, delete, test
client.billing    # get_balance, get_expenditure, get_summary, ...
client.voice      # list, get, set, reset
```

## End-to-end example

```python theme={null}
from agentline_ai import AgentLine

client = AgentLine(api_key="al_live_...")

agent = client.agents.create(
    name="Support Bot",
    system_prompt="You are a helpful assistant.",
    initial_greeting="Hello! How can I help you today?",
)
client.numbers.buy(agent_id=agent.id, country="US", area_code="415")

# +15555550100 is the test line: nothing is dialled or billed.
call = client.calls.create(agent_id=agent.id, to_number="+15555550100")
print(call["id"], call["status"])

print(client.calls.get_transcript(call["id"]))
```

`calls.create` and `messages.send` return plain dicts, so read their fields as
`call["id"]` and `call["status"]`. Agents and numbers return typed objects
(`agent.id`).

To test without dialling or texting anyone, use the test line `+15555550100`
(any `+1 555` number). See [Calls](https://docs.agentline.cloud/guides/calls.md#test-without-dialling-anyone).

The SDK is generated from the same OpenAPI spec as this API reference, so the
SDK and docs always match.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.