diff --git a/.github/workflows/news_summarizer_agent.yaml b/.github/workflows/news_summarizer_agent.yaml new file mode 100644 index 0000000..b12fd9c --- /dev/null +++ b/.github/workflows/news_summarizer_agent.yaml @@ -0,0 +1,62 @@ +name: news_summarizer_agent + +on: + workflow_dispatch: + inputs: + text: + type: string + default: "https://example.com,https://www.youtube.com/watch?v=xxx" + required: true + description: "Comma-separated list of URLs to summarize" + scraper_type: + type: choice + options: + - mock + - httpx + - youtube_transcript + default: mock + required: true + description: "Scraper implementation" + summarizer_type: + type: choice + options: + - mock + - llm + default: mock + required: true + description: "Summarizer implementation" + notifier_type: + type: choice + options: + - mock + - slack + default: mock + required: true + description: "Notifier implementation" + +env: + SCRAPER_TYPE: ${{ inputs.scraper_type }} + SUMMARIZER_TYPE: ${{ inputs.summarizer_type }} + NOTIFIER_TYPE: ${{ inputs.notifier_type }} + AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} + AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + +jobs: + news_summarizer_agent: + runs-on: "ubuntu-latest" + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - name: Set up uv + shell: bash + run: pipx install uv + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: 3.13 + - name: Running NewsSummarizerAgent with scraper=${{ env.SCRAPER_TYPE }}, summarizer=${{ env.SUMMARIZER_TYPE }}, notifier=${{ env.NOTIFIER_TYPE }} + shell: bash + run: | + make install-deps + uv run python scripts/agent_operator.py news-summarizer-agent --urls "${{ inputs.text }}" diff --git a/template_langgraph/internals/notifiers.py b/template_langgraph/internals/notifiers.py index 724c6fc..4233cf9 100644 --- a/template_langgraph/internals/notifiers.py +++ b/template_langgraph/internals/notifiers.py @@ -71,12 +71,17 @@ def __init__(self, settings=get_notifier_settings()): def notify(self, text: str): logger.info(f"Slack notify with text: {text}") with httpx.Client() as client: - client.post( + response = client.post( self.webhook_url, json={ "text": text, }, ) + if response.status_code != 200: + logger.error( + f"Failed to send Slack notification: {response.text}, actual status code: {response.status_code}" + ) + raise httpx.HTTPStatusError(f"Failed to send Slack notification: {response.json()}") def get_notifier(settings: Settings = None) -> BaseNotifier: