Skip to content

Building AI agents, atomically

Linting, fix tests, formatting, add code quality automation

KennyVaneetvelde3bb2bac96bd7
diff --git a/.flake8 b/.flake8
index 4399ec4..8f36406 100644
--- a/.flake8
+++ b/.flake8
@@ -1,5 +1,6 @@
[flake8]
-max-line-length = 127
+max-line-length = 150
max-complexity = 10
count = true
statistics = true
+ignore = E203
diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml
new file mode 100644
index 0000000..0cebd45
--- /dev/null
+++ b/.github/workflows/code-quality.yml
@@ -0,0 +1,49 @@
+name: Code Quality & Tests
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+ workflow_dispatch:
+
+jobs:
+ quality:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+
+ - name: Install Poetry
+ run: |
+ python -m pip install --upgrade pip
+ pip install poetry
+
+ - name: Configure Poetry
+ run: |
+ poetry config virtualenvs.create true
+ poetry config virtualenvs.in-project true
+
+ - name: Cache Poetry virtualenv
+ uses: actions/cache@v4
+ id: cache
+ with:
+ path: ./.venv
+ key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
+
+ - name: Install Dependencies
+ if: steps.cache.outputs.cache-hit != 'true'
+ run: poetry install
+
+ - name: Run Black Check
+ run: poetry run black --check atomic-agents atomic-assembler atomic-examples atomic-forge
+
+ - name: Run Flake8
+ run: poetry run flake8 --extend-exclude=.venv atomic-agents atomic-assembler atomic-examples atomic-forge
+
+ - name: Run Tests
+ run: poetry run pytest --cov=atomic_agents atomic-agents
diff --git a/README.md b/README.md
index 87257ac..d7c74ed 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,7 @@ If you want to learn more about the motivation and philosophy behind Atomic Agen
</a>
---
+
If you just want to dive into the code straight away, I suggest checking out the quickstart video below:
### [Watch the Quickstart Video](https://www.youtube.com/watch?v=CyZxRU0ax3Q)
@@ -320,9 +321,9 @@ We welcome contributions! Please see the [Developer Guide](/guides/DEV_GUIDE.md)
1. Fork the repository
2. Create a new branch (`git checkout -b feature-branch`)
3. Make your changes
-4. Run tests (`pytest --cov atomic_agents`)
-5. Format your code (`black atomic_agents atomic_assembler`)
-6. Lint your code (`flake8 atomic_agents atomic_assembler`)
+4. Run tests (`poetry run pytest --cov=atomic_agents atomic-agents`)
+5. Format your code (`poetry run black atomic-agents atomic-assembler atomic-examples atomic-forge`)
+6. Lint your code (`poetry run flake8 --extend-exclude=.venv atomic-agents atomic-assembler atomic-examples atomic-forge`)
7. Commit your changes (`git commit -m 'Add some feature'`)
8. Push to the branch (`git push origin feature-branch`)
9. Open a pull request
diff --git a/atomic-agents/.coveragerc b/atomic-agents/.coveragerc
deleted file mode 100644
index 6fa6eb9..0000000
--- a/atomic-agents/.coveragerc
+++ /dev/null
@@ -1,12 +0,0 @@
-[report]
-show_missing=true
-exclude_lines =
- @abstractmethod
- @abc.abstractmethod
-exclude_also =
- if __name__ == .__main__.:
-
-[run]
-omit =
- */__init__.py
- */tests/*
diff --git a/atomic-agents/atomic_agents/agents/base_agent.py b/atomic-agents/atomic_agents/agents/base_agent.py
index db0c4f4..50c25d6 100644
--- a/atomic-agents/atomic_agents/agents/base_agent.py
+++ b/atomic-agents/atomic_agents/agents/base_agent.py
@@ -240,6 +240,6 @@ if __name__ == "__main__":
console.print("\n[bold]Agent initialized and ready to use![/bold]")
# Run the agent with a sample input
- sample_input = agent.input_schema(chat_message="Hello, how are you?")
+ sample_input = agent.input_schema(chat_message="Please give me 3 cute squirrel facts")
response = agent.run(sample_input)
console.print(f"[bold]Response:[/bold] {response.chat_message}")
diff --git a/atomic-agents/tests/agents/test_base_agent.py b/atomic-agents/tests/agents/test_base_agent.py
index a0952a6..3b32d31 100644
--- a/atomic-agents/tests/agents/test_base_agent.py
+++ b/atomic-agents/tests/agents/test_base_agent.py
@@ -2,7 +2,6 @@ import pytest
from unittest.mock import Mock, call, patch
from pydantic import BaseModel
import instructor
-import inspect
from atomic_agents.agents.base_agent import (
BaseIOSchema,
BaseAgent,
@@ -60,6 +59,7 @@ def test_initialization(agent, mock_instructor, mock_memory, mock_system_prompt_
assert agent.output_schema == BaseAgentOutputSchema
assert agent.temperature == 0
+
def test_reset_memory(agent, mock_memory):
initial_memory = agent.initial_memory
agent.reset_memory()
@@ -82,23 +82,10 @@ def test_get_response(agent, mock_instructor, mock_memory, mock_system_prompt_ge
model="gpt-4o-mini",
messages=[{"role": "system", "content": "System prompt"}, {"role": "user", "content": "Hello"}],
response_model=BaseAgentOutputSchema,
+ temperature=0,
)
-def test_run(agent, mock_memory):
- mock_input = BaseAgentInputSchema(chat_message="Test input")
- mock_output = BaseAgentOutputSchema(chat_message="Test output")
-
- agent.get_response = Mock(return_value=mock_output)
-
- result = agent.run(mock_input)
-
- assert result == mock_output
- assert agent.current_user_input == mock_input
-
- mock_memory.add_message.assert_has_calls([call("user", mock_input), call("assistant", mock_output)])
-
-
def test_get_context_provider(agent, mock_system_prompt_generator):
mock_provider = Mock(spec=SystemPromptContextProviderBase)
mock_system_prompt_generator.context_providers = {"test_provider": mock_provider}
@@ -157,7 +144,6 @@ def test_base_agent_io_str_and_rich():
assert test_io.__rich__() is not None # Just check if it returns something, as we can't easily compare Rich objects
-# Update the existing test_run function to use the actual methods instead of mocks
def test_run(agent, mock_memory):
mock_input = BaseAgentInputSchema(chat_message="Test input")
mock_output = BaseAgentOutputSchema(chat_message="Test output")
diff --git a/atomic-agents/tests/lib/components/test_agent_memory.py b/atomic-agents/tests/lib/components/test_agent_memory.py
index 11c37ba..2d1ee2a 100644
--- a/atomic-agents/tests/lib/components/test_agent_memory.py
+++ b/atomic-agents/tests/lib/components/test_agent_memory.py
@@ -1,7 +1,7 @@
import pytest
import json
from typing import List, Dict
-from pydantic import BaseModel, Field
+from pydantic import Field
from atomic_agents.lib.components.agent_memory import AgentMemory, Message
from atomic_agents.lib.base.base_io_schema import BaseIOSchema
@@ -73,13 +73,6 @@ def test_manage_overflow(memory):
assert memory.history[0].content.test_field == "Message 2"
-def test_serialize_content(memory):
- content = TestInputSchema(test_field="Test")
- serialized = memory._serialize_content(content)
- assert isinstance(serialized, str)
- assert json.loads(serialized) == {"test_field": "Test"}
-
-
def test_get_history(memory):
memory.add_message("user", TestInputSchema(test_field="Hello"))
memory.add_message("assistant", TestOutputSchema(test_field="Hi there"))
@@ -243,12 +236,6 @@ def test_memory_turn_consistency():
assert memory.history[2].turn_id == new_turn_id
-def test_serialize_non_baseioschema():
- memory = AgentMemory()
- result = memory._serialize_content("Not a BaseIOSchema")
- assert result == "Not a BaseIOSchema"
-
-
def test_agent_memory_delete_turn_id(memory):
mock_input = TestInputSchema(test_field="Test input")
mock_output = TestInputSchema(test_field="Test output")
diff --git a/atomic-agents/tests/lib/components/test_system_prompt_generator.py b/atomic-agents/tests/lib/components/test_system_prompt_generator.py
index cc07233..3d6bd40 100644
--- a/atomic-agents/tests/lib/components/test_system_prompt_generator.py
+++ b/atomic-agents/tests/lib/components/test_system_prompt_generator.py
@@ -1,4 +1,3 @@
-import pytest
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptContextProviderBase
diff --git a/atomic-assembler/atomic_assembler/app.py b/atomic-assembler/atomic_assembler/app.py
index 8890773..2af92fc 100644
--- a/atomic-assembler/atomic_assembler/app.py
+++ b/atomic-assembler/atomic_assembler/app.py
@@ -1,14 +1,13 @@
import logging
from textual import on
from textual.app import App
-from textual.screen import Screen
from pathlib import Path
import webbrowser
from atomic_assembler.screens.main_menu import MainMenuScreen
from atomic_assembler.screens.file_explorer import FileExplorerScreen
from atomic_assembler.screens.atomic_tool_explorer import AtomicToolExplorerScreen
-from atomic_assembler.constants import GITHUB_BRANCH, Mode
+from atomic_assembler.constants import Mode
class AtomicAssembler(App):
diff --git a/atomic-assembler/atomic_assembler/main.py b/atomic-assembler/atomic_assembler/main.py
index 61ebe02..cda921f 100644
--- a/atomic-assembler/atomic_assembler/main.py
+++ b/atomic-assembler/atomic_assembler/main.py
@@ -1,7 +1,5 @@
import logging
-import sys
import argparse
-from atomic_assembler.constants import GITHUB_BASE_URL
from atomic_assembler.app import AtomicAssembler
diff --git a/atomic-assembler/atomic_assembler/screens/atomic_tool_explorer.py b/atomic-assembler/atomic_assembler/screens/atomic_tool_explorer.py
index 6724492..6fc96a1 100644
--- a/atomic-assembler/atomic_assembler/screens/atomic_tool_explorer.py
+++ b/atomic-assembler/atomic_assembler/screens/atomic_tool_explorer.py
@@ -1,5 +1,5 @@
from textual.app import ComposeResult
-from textual.widgets import Static, Footer, Header
+from textual.widgets import Static, Footer
from textual.binding import Binding
from textual.screen import Screen
from textual.message import Message
diff --git a/atomic-assembler/atomic_assembler/screens/file_explorer.py b/atomic-assembler/atomic_assembler/screens/file_explorer.py
index cdaa932..c329628 100644
--- a/atomic-assembler/atomic_assembler/screens/file_explorer.py
+++ b/atomic-assembler/atomic_assembler/screens/file_explorer.py
@@ -1,10 +1,9 @@
import logging
from textual.app import ComposeResult
-from textual.widgets import Static, Footer, Header
+from textual.widgets import Static, Footer
from textual.binding import Binding
-from textual import events, on
+from textual import on
from textual.reactive import reactive
-from textual.containers import Container
from textual.screen import Screen
from pathlib import Path
from typing import List, Optional, Dict, Callable
diff --git a/atomic-assembler/atomic_assembler/screens/tool_info_screen.py b/atomic-assembler/atomic_assembler/screens/tool_info_screen.py
index e94e299..ad610fe 100644
--- a/atomic-assembler/atomic_assembler/screens/tool_info_screen.py
+++ b/atomic-assembler/atomic_assembler/screens/tool_info_screen.py
@@ -1,6 +1,6 @@
from textual.app import ComposeResult
from textual.containers import VerticalScroll
-from textual.widgets import Header, Footer, Markdown
+from textual.widgets import Footer, Markdown
from textual.binding import Binding
from textual.screen import Screen
diff --git a/atomic-assembler/atomic_assembler/utils.py b/atomic-assembler/atomic_assembler/utils.py
index 5f44294..6a804b2 100644
--- a/atomic-assembler/atomic_assembler/utils.py
+++ b/atomic-assembler/atomic_assembler/utils.py
@@ -6,7 +6,7 @@ import tempfile
import git
import yaml
from pathlib import Path
-from atomic_assembler.constants import GITHUB_BASE_URL, GITHUB_BRANCH, TOOLS_SUBFOLDER
+from atomic_assembler.constants import GITHUB_BRANCH, TOOLS_SUBFOLDER
class GithubRepoCloner:
@@ -18,7 +18,7 @@ class GithubRepoCloner:
def clone(self):
try:
- repo = git.Repo.clone_from(self.repo_url, self.repo_path, branch=GITHUB_BRANCH)
+ _ = git.Repo.clone_from(self.repo_url, self.repo_path, branch=GITHUB_BRANCH)
logging.info(f"Repository cloned to {self.repo_path} on branch {GITHUB_BRANCH}")
except git.GitCommandError as e:
logging.error(f"Failed to clone repository: {e}")
diff --git a/atomic-assembler/atomic_assembler/widgets/confirmation_modal.py b/atomic-assembler/atomic_assembler/widgets/confirmation_modal.py
index 68a65e0..fc8ff91 100644
--- a/atomic-assembler/atomic_assembler/widgets/confirmation_modal.py
+++ b/atomic-assembler/atomic_assembler/widgets/confirmation_modal.py
@@ -3,7 +3,7 @@ from textual.screen import ModalScreen
from textual.widgets import Static
from textual.containers import Vertical
from textual.app import ComposeResult
-from atomic_assembler.constants import PRIMARY_COLOR, SECONDARY_COLOR
+from atomic_assembler.constants import PRIMARY_COLOR
from typing import Callable
diff --git a/atomic-assembler/atomic_assembler/widgets/gradient_title.py b/atomic-assembler/atomic_assembler/widgets/gradient_title.py
index 1210e25..0046cb6 100644
--- a/atomic-assembler/atomic_assembler/widgets/gradient_title.py
+++ b/atomic-assembler/atomic_assembler/widgets/gradient_title.py
@@ -1,6 +1,5 @@
import math
from typing import List
-from logging import Logger
from pyfiglet import Figlet
from rich.align import Align
diff --git a/atomic-assembler/atomic_assembler/widgets/new_item_input.py b/atomic-assembler/atomic_assembler/widgets/new_item_input.py
index 2014203..78ef29e 100644
--- a/atomic-assembler/atomic_assembler/widgets/new_item_input.py
+++ b/atomic-assembler/atomic_assembler/widgets/new_item_input.py
@@ -1,7 +1,6 @@
from textual.widgets import Input
from textual.binding import Binding
from textual.message import Message
-from pathlib import Path
class NewItemInput(Input):
diff --git a/atomic-assembler/atomic_assembler/widgets/tool_info_display.py b/atomic-assembler/atomic_assembler/widgets/tool_info_display.py
index 9fa70ff..8dbe703 100644
--- a/atomic-assembler/atomic_assembler/widgets/tool_info_display.py
+++ b/atomic-assembler/atomic_assembler/widgets/tool_info_display.py
@@ -4,9 +4,7 @@ from textual.containers import ScrollableContainer
from textual.widgets import Static
from textual.app import ComposeResult
from atomic_assembler.constants import (
- BORDER_STYLE,
PRIMARY_COLOR,
- SECONDARY_COLOR,
)
diff --git a/atomic-examples/deep-research/deep_research/agents/choice_agent.py b/atomic-examples/deep-research/deep_research/agents/choice_agent.py
index 3697f21..9f3ea13 100644
--- a/atomic-examples/deep-research/deep_research/agents/choice_agent.py
+++ b/atomic-examples/deep-research/deep_research/agents/choice_agent.py
@@ -1,7 +1,6 @@
import instructor
import openai
from pydantic import Field
-from typing import Dict, Optional
from atomic_agents.agents.base_agent import BaseIOSchema, BaseAgent, BaseAgentConfig
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator
diff --git a/atomic-examples/deep-research/deep_research/agents/qa_agent.py b/atomic-examples/deep-research/deep_research/agents/qa_agent.py
index a099e43..c12b549 100644
--- a/atomic-examples/deep-research/deep_research/agents/qa_agent.py
+++ b/atomic-examples/deep-research/deep_research/agents/qa_agent.py
@@ -19,7 +19,11 @@ class QuestionAnsweringAgentOutputSchema(BaseIOSchema):
answer: str = Field(..., description="The answer to the question.")
follow_up_questions: list[str] = Field(
...,
- description="Specific questions about the topic that would help the user learn more details about the subject matter. For example, if discussing a Nobel Prize winner, suggest questions about their research, impact, or related scientific concepts.",
+ description=(
+ "Specific questions about the topic that would help the user learn more details about the subject matter. "
+ "For example, if discussing a Nobel Prize winner, suggest questions about their research, impact, or "
+ "related scientific concepts."
+ ),
)
diff --git a/atomic-examples/deep-research/deep_research/agents/query_agent.py b/atomic-examples/deep-research/deep_research/agents/query_agent.py
index 54091e8..3032fe9 100644
--- a/atomic-examples/deep-research/deep_research/agents/query_agent.py
+++ b/atomic-examples/deep-research/deep_research/agents/query_agent.py
@@ -21,7 +21,10 @@ query_agent = BaseAgent(
model=ChatConfig.model,
system_prompt_generator=SystemPromptGenerator(
background=[
- "You are an expert search engine query generator with a deep understanding of which queries will maximize the number of relevant results.",
+ (
+ "You are an expert search engine query generator with a deep understanding of which"
+ "queries will maximize the number of relevant results."
+ )
],
steps=[
"Analyze the given instruction to identify key concepts and aspects that need to be researched",
diff --git a/atomic-examples/deep-research/deep_research/main.py b/atomic-examples/deep-research/deep_research/main.py
index fd0d09f..264b0b9 100644
--- a/atomic-examples/deep-research/deep_research/main.py
+++ b/atomic-examples/deep-research/deep_research/main.py
@@ -5,15 +5,10 @@ from deep_research.agents.qa_agent import (
QuestionAnsweringAgentOutputSchema,
)
from deep_research.agents.choice_agent import choice_agent, ChoiceAgentInputSchema
-from deep_research.config import ChatConfig
from deep_research.tools.searxng_search import SearxNGSearchTool, SearxNGSearchToolConfig, SearxNGSearchToolInputSchema
from deep_research.tools.webpage_scraper import WebpageScraperTool, WebpageScraperToolInputSchema
from deep_research.context_providers import ContentItem, CurrentDateContextProvider, ScrapedContentContextProvider
-from atomic_agents.lib.components.agent_memory import AgentMemory
-from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig
-from deep_research.agents.choice_agent import ChoiceAgentInputSchema, choice_agent
-
from rich import print
@@ -54,7 +49,11 @@ def initialize_conversation_memory() -> None:
# Create the initial response using the output schema
initial_answer = QuestionAnsweringAgentOutputSchema(
- answer="""Quantum computing is a revolutionary technology that uses quantum mechanics to perform computations. Unlike classical computers that use bits (0 or 1), quantum computers use quantum bits or 'qubits' that can exist in multiple states simultaneously due to superposition.""",
+ answer=(
+ "Quantum computing is a revolutionary technology that uses quantum mechanics to perform computations."
+ "Unlike classical computers that use bits (0 or 1), quantum computers use quantum bits or 'qubits' "
+ "that can exist in multiple states simultaneously due to superposition."
+ ),
follow_up_questions=[
"What are the main challenges in building a practical quantum computer?",
"How does quantum entanglement contribute to quantum computing power?",
@@ -114,18 +113,22 @@ def chat_loop() -> None:
choice_agent_output = choice_agent.run(
ChoiceAgentInputSchema(
user_message=user_message,
- decision_type="Should we perform a new web search? TRUE if we need new or updated information, FALSE if existing context is sufficient. Consider: 1) Is the context empty? 2) Is the existing information relevant? 3) Is the information recent enough?",
+ decision_type=(
+ "Should we perform a new web search? TRUE if we need new or updated information, FALSE if existing "
+ "context is sufficient. Consider: 1) Is the context empty? 2) Is the existing information relevant? "
+ "3) Is the information recent enough?"
+ ),
)
)
if choice_agent_output.decision:
- print(f"\n[bold yellow]Performing new search[/bold yellow]")
+ print("\n[bold yellow]Performing new search[/bold yellow]")
print(f"Reason: {choice_agent_output.reasoning}")
# Perform search and update context
perform_search_and_update_context(user_message, scraped_content_context_provider)
else:
- print(f"\n[bold green]Using existing context[/bold green]")
+ print("\n[bold green]Using existing context[/bold green]")
print(f"Reason: {choice_agent_output.reasoning}")
# Get and display the answer
diff --git a/atomic-examples/deep-research/deep_research/tools/searxng_search.py b/atomic-examples/deep-research/deep_research/tools/searxng_search.py
index f6f271e..4d1582e 100644
--- a/atomic-examples/deep-research/deep_research/tools/searxng_search.py
+++ b/atomic-examples/deep-research/deep_research/tools/searxng_search.py
@@ -1,4 +1,3 @@
-import os
from typing import List, Literal, Optional
import asyncio
from concurrent.futures import ThreadPoolExecutor
@@ -205,9 +204,7 @@ if __name__ == "__main__":
load_dotenv()
rich_console = Console()
- search_tool_instance = SearxNGSearchTool(
- config=SearxNGSearchToolConfig(base_url="http://localhost:8080", max_results=5)
- )
+ search_tool_instance = SearxNGSearchTool(config=SearxNGSearchToolConfig(base_url="http://localhost:8080", max_results=5))
search_input = SearxNGSearchTool.input_schema(
queries=["Python programming", "Machine learning", "Artificial intelligence"],
diff --git a/atomic-examples/deep-research/deep_research/tools/webpage_scraper.py b/atomic-examples/deep-research/deep_research/tools/webpage_scraper.py
index 60721e2..32d0fdd 100644
--- a/atomic-examples/deep-research/deep_research/tools/webpage_scraper.py
+++ b/atomic-examples/deep-research/deep_research/tools/webpage_scraper.py
@@ -1,4 +1,4 @@
-from typing import List, Optional
+from typing import Optional
from urllib.parse import urlparse
import re
diff --git a/atomic-examples/orchestration-agent/orchestration_agent/orchestrator.py b/atomic-examples/orchestration-agent/orchestration_agent/orchestrator.py
index 3a5688d..7c59551 100644
--- a/atomic-examples/orchestration-agent/orchestration_agent/orchestrator.py
+++ b/atomic-examples/orchestration-agent/orchestration_agent/orchestrator.py
@@ -1,4 +1,4 @@
-from typing import Union, List
+from typing import Union
import openai
from pydantic import Field
from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig
@@ -181,4 +181,3 @@ if __name__ == "__main__":
# Reset the memory after each response
orchestrator_agent.memory = AgentMemory()
-
diff --git a/atomic-examples/orchestration-agent/orchestration_agent/tools/searxng_search.py b/atomic-examples/orchestration-agent/orchestration_agent/tools/searxng_search.py
index f6f271e..4d1582e 100644
--- a/atomic-examples/orchestration-agent/orchestration_agent/tools/searxng_search.py
+++ b/atomic-examples/orchestration-agent/orchestration_agent/tools/searxng_search.py
@@ -1,4 +1,3 @@
-import os
from typing import List, Literal, Optional
import asyncio
from concurrent.futures import ThreadPoolExecutor
@@ -205,9 +204,7 @@ if __name__ == "__main__":
load_dotenv()
rich_console = Console()
- search_tool_instance = SearxNGSearchTool(
- config=SearxNGSearchToolConfig(base_url="http://localhost:8080", max_results=5)
- )
+ search_tool_instance = SearxNGSearchTool(config=SearxNGSearchToolConfig(base_url="http://localhost:8080", max_results=5))
search_input = SearxNGSearchTool.input_schema(
queries=["Python programming", "Machine learning", "Artificial intelligence"],
diff --git a/atomic-examples/web-search-agent/web_search_agent/agents/question_answering_agent.py b/atomic-examples/web-search-agent/web_search_agent/agents/question_answering_agent.py
index 5066f87..5859613 100644
--- a/atomic-examples/web-search-agent/web_search_agent/agents/question_answering_agent.py
+++ b/atomic-examples/web-search-agent/web_search_agent/agents/question_answering_agent.py
@@ -16,8 +16,12 @@ class QuestionAnsweringAgentOutputSchema(BaseIOSchema):
"""This schema defines the output schema for the QuestionAnsweringAgent."""
markdown_output: str = Field(..., description="The answer to the question in markdown format.")
- references: List[HttpUrl] = Field(..., max_items=3, description="A list of up to 3 HTTP URLs used as references for the answer.")
- followup_questions: List[str] = Field(..., max_items=3, description="A list of up to 3 follow-up questions related to the answer.")
+ references: List[HttpUrl] = Field(
+ ..., max_items=3, description="A list of up to 3 HTTP URLs used as references for the answer."
+ )
+ followup_questions: List[str] = Field(
+ ..., max_items=3, description="A list of up to 3 follow-up questions related to the answer."
+ )
# Create the question answering agent
diff --git a/atomic-examples/web-search-agent/web_search_agent/main.py b/atomic-examples/web-search-agent/web_search_agent/main.py
index 063e952..fcb9a6d 100644
--- a/atomic-examples/web-search-agent/web_search_agent/main.py
+++ b/atomic-examples/web-search-agent/web_search_agent/main.py
@@ -28,12 +28,7 @@ console = Console()
memory = AgentMemory()
# Initialize the SearxNGSearchTool
-search_tool = SearxNGSearchTool(
- config=SearxNGSearchToolConfig(
- base_url=os.getenv("SEARXNG_BASE_URL"),
- max_results=5
- )
-)
+search_tool = SearxNGSearchTool(config=SearxNGSearchToolConfig(base_url=os.getenv("SEARXNG_BASE_URL"), max_results=5))
# Initialize the BaseAgent
agent = BaseAgent(
@@ -57,10 +52,8 @@ for query in generated_queries.queries:
console.print(f"- {query}")
# Perform searches using the generated queries
-search_input = SearxNGSearchToolInputSchema(
- queries=generated_queries.queries,
- category="general"
-)
+search_input = SearxNGSearchToolInputSchema(queries=generated_queries.queries, category="general")
+
class SearchResultsProvider(SystemPromptContextProviderBase):
def __init__(self, title: str):
diff --git a/atomic-examples/youtube-summarizer/youtube_summarizer/agent.py b/atomic-examples/youtube-summarizer/youtube_summarizer/agent.py
index 1570734..ccde8ed 100644
--- a/atomic-examples/youtube-summarizer/youtube_summarizer/agent.py
+++ b/atomic-examples/youtube-summarizer/youtube_summarizer/agent.py
@@ -1,6 +1,6 @@
import instructor
import openai
-from pydantic import BaseModel, Field
+from pydantic import Field
from typing import List, Optional
from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig, BaseIOSchema
diff --git a/atomic-examples/youtube-summarizer/youtube_summarizer/main.py b/atomic-examples/youtube-summarizer/youtube_summarizer/main.py
index 3809ced..e87016a 100644
--- a/atomic-examples/youtube-summarizer/youtube_summarizer/main.py
+++ b/atomic-examples/youtube-summarizer/youtube_summarizer/main.py
@@ -2,8 +2,6 @@ import os
from dotenv import load_dotenv
from rich.console import Console
-from atomic_agents.lib.components.agent_memory import AgentMemory
-
from youtube_summarizer.tools.youtube_transcript_scraper import (
YouTubeTranscriptTool,
YouTubeTranscriptToolConfig,
diff --git a/atomic-examples/youtube-to-recipe/youtube_to_recipe/main.py b/atomic-examples/youtube-to-recipe/youtube_to_recipe/main.py
index 141940f..1d9a171 100644
--- a/atomic-examples/youtube-to-recipe/youtube_to_recipe/main.py
+++ b/atomic-examples/youtube-to-recipe/youtube_to_recipe/main.py
@@ -2,8 +2,6 @@ import os
from dotenv import load_dotenv
from rich.console import Console
-from atomic_agents.lib.components.agent_memory import AgentMemory
-
from youtube_to_recipe.tools.youtube_transcript_scraper import (
YouTubeTranscriptTool,
YouTubeTranscriptToolConfig,
diff --git a/atomic-forge/tools/calculator/tests/test_calculator.py b/atomic-forge/tools/calculator/tests/test_calculator.py
index f30662d..07ff082 100644
--- a/atomic-forge/tools/calculator/tests/test_calculator.py
+++ b/atomic-forge/tools/calculator/tests/test_calculator.py
@@ -1,11 +1,9 @@
import os
import sys
-import io
-from unittest.mock import patch
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
-from tool.calculator import (
+from tool.calculator import ( # noqa: E402
CalculatorTool,
CalculatorToolInputSchema,
CalculatorToolOutputSchema,
diff --git a/atomic-forge/tools/searxng_search/tests/test_searxng_search.py b/atomic-forge/tools/searxng_search/tests/test_searxng_search.py
index be19f2e..adf643d 100644
--- a/atomic-forge/tools/searxng_search/tests/test_searxng_search.py
+++ b/atomic-forge/tools/searxng_search/tests/test_searxng_search.py
@@ -2,14 +2,12 @@ import os
import sys
import pytest
from unittest.mock import patch, AsyncMock, MagicMock
-import aiohttp
from aiohttp import ClientSession
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
-from tool.searxng_search import (
+from tool.searxng_search import ( # noqa: E402
SearxNGSearchTool,
- SearxNGSearchResultItemSchema,
SearxNGSearchToolInputSchema,
SearxNGSearchToolOutputSchema,
SearxNGSearchToolConfig,
diff --git a/atomic-forge/tools/webpage_scraper/tool/webpage_scraper.py b/atomic-forge/tools/webpage_scraper/tool/webpage_scraper.py
index 70154bc..5513c7b 100644
--- a/atomic-forge/tools/webpage_scraper/tool/webpage_scraper.py
+++ b/atomic-forge/tools/webpage_scraper/tool/webpage_scraper.py
@@ -1,4 +1,4 @@
-from typing import List, Optional
+from typing import Optional
from urllib.parse import urlparse
import re
diff --git a/atomic-forge/tools/youtube_transcript_scraper/tests/test_youtube_transcript_scraper.py b/atomic-forge/tools/youtube_transcript_scraper/tests/test_youtube_transcript_scraper.py
index 860518a..f9a9422 100644
--- a/atomic-forge/tools/youtube_transcript_scraper/tests/test_youtube_transcript_scraper.py
+++ b/atomic-forge/tools/youtube_transcript_scraper/tests/test_youtube_transcript_scraper.py
@@ -8,7 +8,7 @@ from youtube_transcript_api import NoTranscriptFound, TranscriptsDisabled
# Add the parent directory of 'tests' to the Python path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
-from tool.youtube_transcript_scraper import (
+from tool.youtube_transcript_scraper import ( # noqa: E402
YouTubeTranscriptTool,
YouTubeTranscriptToolInputSchema,
YouTubeTranscriptToolOutputSchema,
@@ -123,7 +123,6 @@ def test_youtube_transcript_tool_transcripts_disabled():
def test_fetch_video_metadata_no_items():
mock_api_key = "mock_api_key"
- mock_video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
with patch("tool.youtube_transcript_scraper.build") as mock_build:
mock_youtube = MagicMock()