You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/attached_assets/Pasted-Traceback-most-recen...

47 lines
2.2 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Traceback (most recent call last):
File "/home/runner/workspace/examples/mcp_example/mcp_client.py", line 1, in <module>
from swarms import Agent
File "/home/runner/workspace/swarms/__init__.py", line 9, in <module>
from swarms.agents import * # noqa: E402, F403
File "/home/runner/workspace/swarms/agents/__init__.py", line 1, in <module>
from swarms.agents.agent_judge import AgentJudge
File "/home/runner/workspace/swarms/agents/agent_judge.py", line 4, in <module>
from swarms.structs.agent import Agent
File "/home/runner/workspace/swarms/structs/__init__.py", line 1, in <module>
from swarms.structs.agent import Agent
File "/home/runner/workspace/swarms/structs/agent.py", line 1870
logger.info(f"Adding response filter: {filter_word}")
IndentationError: unexpected indent
`IndentationError: unexpected indent` means Python found a line that is indented farther than the block it lives in.
In `agent.py` the culprit is inside **`add_response_filter`** (around line 1870).
Just move the `logger.info(…)` line two spaces to the **left** (so it lines up with the first statement in the function) and, while youre there, fix the small typo in the attribute name.
```python
# ── swarms/structs/agent.py ─────────────────────────────
# Response Filtering
def add_response_filter(self, filter_word: str) -> None:
"""
Add a response filter to filter out certain words from the response.
"""
logger.info(f"Adding response filter: {filter_word}")
# attribute is self.response_filters (an "s"), not self.reponse_filters
self.response_filters.append(filter_word)
```
Full diffstyle patch  (*only the three changed lines shown*):
```diff
@@
- logger.info(f"Adding response filter: {filter_word}")
- self.reponse_filters.append(filter_word)
+ logger.info(f"Adding response filter: {filter_word}")
+ self.response_filters.append(filter_word)
```
After you save the file:
```bash
black swarms/structs/agent.py # optional but keeps everything wellindented
python -m py_compile swarms/structs/agent.py
```
Compilation should pass and the `mcp_client.py` script will start without the indentation error.