Skip to content

Commit 068ba6b

Browse files
committed
updated agent file
1 parent 51c00ac commit 068ba6b

1 file changed

Lines changed: 56 additions & 6 deletions

File tree

AGENTS.md

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,61 @@ uv run pytest -m smolagents -v
5555
uv run pytest -m interface -v
5656
```
5757

58+
## Typing
59+
60+
### Type Checker
61+
62+
The project uses the `ty` type checker.
63+
64+
```bash
65+
# Check types across the project
66+
uv run ty check
67+
68+
# View documentation
69+
uv run ty --help
70+
```
71+
72+
Documentation: [https://docs.astral.sh/ty/](https://docs.astral.sh/ty/)
73+
74+
### Philosophy & Priorities
75+
76+
**Types exist to help users and catch bugs—not to satisfy theoretical purity.**
77+
78+
This library uses type hinting to:
79+
80+
- Provide better IDE autocomplete and error detection
81+
- Document expected types clearly
82+
- Catch real errors before runtime
83+
84+
However, **pragmatism over pedantry**: if a typing pattern improves usability and robustness, use it—even if it technically violates some typing rule.
85+
86+
**Example:** `MACSBenchmark` narrows its environment type to `MACSEnvironment` (instead of generic `Environment`). This violates strict subtyping rules but provides users with:
87+
88+
- Precise autocomplete for MACS-specific methods
89+
- Clear documentation that MACS requires its own environment
90+
- Better error messages during development
91+
- Prevents mixing incompatible components (e.g., `Tau2Environment` cannot be passed to `MACSBenchmark`)
92+
93+
Unless there's a graceful alternative that preserves usability, choose the pattern that helps users most.
94+
95+
**Guiding principle:** Orient yourself on existing patterns in the codebase. Consistency matters more than theoretical correctness.
96+
97+
### Syntax Rules
98+
99+
- **Unions:** Use `A | B` notation (not `Union[A, B]`)
100+
- **Optional:** Prefer `Optional[X]` over `X | None` for explicitness
101+
- **Collections:** Use `List[...]`, `Dict[..., ...]`, `Sequence[...]` instead of `list`, `dict`, `sequence`
102+
103+
**Example:**
104+
105+
```python
106+
def process_data(
107+
items: List[str],
108+
config: Optional[Dict[str, Any]] = None
109+
) -> str | int:
110+
...
111+
```
112+
58113
## Dependency Management
59114

60115
Three types of dependencies:
@@ -220,7 +275,7 @@ Example workflow:
220275
uv sync --all-extras --all-groups
221276

222277
# Before committing
223-
uv run ruff format . && uv run ruff check . --fix && uv run pytest -v
278+
uv run ruff format . && uv run ruff check . --fix && uv run pytest -v && uv run ty check
224279

225280
# Run example
226281
uv run python examples/amazon_collab.py
@@ -235,11 +290,6 @@ uv add --optional <extra-name> <package-name>
235290
uv run pytest tests/test_core/test_agent.py -v
236291
```
237292

238-
## Type Hinting
239-
240-
This repository uses proper type hinting. For unions use the `A | B` notation. For optional imports, prefer `Optional[...]` as it is more explicit.
241-
For lists and dictionaries, use `Dict[...,...]`, `List[...]`, `Sequence[...]` etc. instead of `list`, `dict`.
242-
243293
## Security and Confidentiality
244294

245295
**IMPORTANT:** This project contains confidential research material.

0 commit comments

Comments
 (0)