Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,28 @@ client = Agentex(
tasks = client.tasks.list()
```

## Hello World

A minimal example to get started with the Agentex Python library:

```python
import os
from agentex import Agentex


def hello_world() -> None:
client = Agentex(
api_key=os.environ.get("AGENTEX_SDK_API_KEY"),
)
tasks = client.tasks.list()
print("Hello, World! Connected to Agentex successfully.")
print(f"Found {len(tasks.data)} tasks.")
Comment on lines +54 to +56
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tasks.data will raise AttributeError

client.tasks.list() returns a List[TaskListResponseItem] (a plain Python list), not an object with a .data attribute. Accessing tasks.data will raise AttributeError: 'list' object has no attribute 'data' at runtime.

This can be confirmed in src/agentex/types/task_list_response.py where the return type is defined as:

TaskListResponse: TypeAlias = List[TaskListResponseItem]

The same pattern applies to client.agents.list() and client.spans.list() — they all return plain lists.

Suggested change
tasks = client.tasks.list()
print("Hello, World! Connected to Agentex successfully.")
print(f"Found {len(tasks.data)} tasks.")
tasks = client.tasks.list()
print("Hello, World! Connected to Agentex successfully.")
print(f"Found {len(tasks)} tasks.")
Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 54-56

Comment:
**`tasks.data` will raise `AttributeError`**

`client.tasks.list()` returns a `List[TaskListResponseItem]` (a plain Python list), not an object with a `.data` attribute. Accessing `tasks.data` will raise `AttributeError: 'list' object has no attribute 'data'` at runtime.

This can be confirmed in `src/agentex/types/task_list_response.py` where the return type is defined as:
```python
TaskListResponse: TypeAlias = List[TaskListResponseItem]
```

The same pattern applies to `client.agents.list()` and `client.spans.list()` — they all return plain lists.

```suggestion
    tasks = client.tasks.list()
    print("Hello, World! Connected to Agentex successfully.")
    print(f"Found {len(tasks)} tasks.")
```

How can I resolve this? If you propose a fix, please make it concise.



if __name__ == "__main__":
hello_world()
```

While you can provide an `api_key` keyword argument,
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
to add `AGENTEX_SDK_API_KEY="My API Key"` to your `.env` file
Expand Down