Skip to content
Merged
Show file tree
Hide file tree
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
30 changes: 18 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,32 @@

jobs:
main:
timeout-minutes: 20
timeout-minutes: 10
name: Lint & Build & Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "poetry"

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Set up Python
run: uv python install

Choose a reason for hiding this comment

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

This should not be necessary AFAIK, uv sync downloads the correct Python when creating venv


- name: Install dependencies
run: poetry install --no-interaction
run: uv sync --all-extras --locked --dev

- name: Code Lint
run: poetry run poe lint
run: uv run poe lint

- name: Type check task with mypy
run: poetry run poe type-check -- -- --show-error-context --pretty
run: uv run poe type-check -- --show-error-context --pretty

- name: Code Format
run: poetry run poe format
run: uv run poe format

- name: Build
run: poetry build
run: uv build
Comment on lines +11 to +39

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 1 day ago

The best practice for GitHub Actions workflows is to explicitly specify the permissions key at either the workflow (root) level or at the job level. For this workflow, adding permissions: { contents: read } at the top level will ensure that all jobs default to the minimal required permissions, adhering to the principle of least privilege.

To fix the issue, add the following block on a new line after the workflow name declaration (after line 1 and before on: at line 3):

permissions:
  contents: read

No changes are required elsewhere, as the workflow otherwise appears standard.


Suggested changeset 1
.github/workflows/main.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,4 +1,6 @@
 name: Lint, Build
+permissions:
+  contents: read
 
 on:
   push:
EOF
@@ -1,4 +1,6 @@
name: Lint, Build
permissions:
contents: read

on:
push:
Copilot is powered by AI and may make mistakes. Always verify output.
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
4 changes: 2 additions & 2 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ With the githooks installed the following will run automatically on a commit:
* [mypy](https://github.com/python/mypy) is used to check for type errors
* a simple format check is applied to the commit message to verify for use of [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary)

Additional tools are integrated into poetry via the [poetry plugin](https://poethepoet.natn.io/poetry_plugin.html)
Additional tools are provided via [Poe the Poet](https://github.com/nat-n/poethepoet) tasks and can be run with uv.

Choose a reason for hiding this comment

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

It's also possible to ditch Poe and use project scripts:

https://github.com/i-am-bee/beeai-platform/blob/a5911f59be15fc9685144ac791575aaebc0687b7/apps/beeai-cli/pyproject.toml#L39-L41

...just mind the caveat that if the project is a library, these scripts get installed alongside it. So it's only usable for apps.

(Or we could unify and use Mise, but I'm probably overthinking this.)


Tools can also be run directly via the command line (run within `poetry shell` or prefix with `poetry run`):
Tools can be run directly via the command line (activate the venv or prefix commands with `uv run`):

* `poe lint` - lints and formats your code

Choose a reason for hiding this comment

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

I think you should write these as prefixed (uv run poe lint etc.) so people skimming this could just copy the command

* `poe format` - formats your code
Expand Down
56 changes: 22 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ This starter template helps you **quickly** get started with the [BeeAI framewor
## 📋 Requirements

- **Python Version 3.11+**

Choose a reason for hiding this comment

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

Technically you don't need this anymore, uv will download correct Python if not present when creating the venv

- **Poetry Version 2.0+** for Python package management - See [installation guide](https://python-poetry.org/docs/#installation)
- **uv** (fast Python package manager) - See installation: https://docs.astral.sh/uv/getting-started/installation/

Choose a reason for hiding this comment

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

I'd leave it as before since all the other links in this section are text links

Suggested change
- **uv** (fast Python package manager) - See installation: https://docs.astral.sh/uv/getting-started/installation/
- **uv** (fast Python package manager) - See [installation guide](https://docs.astral.sh/uv/getting-started/installation/)

- **Container system** (with Compose support):
- [Docker](https://www.docker.com/)
- [Rancher](https://www.rancher.com/) (For macOS, use VZ instead of QEMU)
- [Podman](https://podman.io/) (Requires [Compose](https://podman-desktop.io/docs/compose/setting-up-compose) and rootful machine)
- **LLM Provider** - External [WatsonX](https://www.ibm.com/watsonx) (OpenAI, Groq, ...) or local [Ollama](https://ollama.com)
- **IDE/Code Editor** (e.g., WebStorm, VSCode) - Optional but recommended for smooth smooth configuration handling
- **IDE/Code Editor** (e.g., WebStorm, VSCode) - Optional but recommended for smooth configuration handling

---

Expand All @@ -44,25 +44,19 @@ cd beeai-framework-py-starter

**Step 2:** Install dependencies
```sh
poetry install
uv sync
```

**Step 3:** Install and start the poetry environment
```sh
poetry self add poetry-plugin-shell
poetry shell
```

**Step 4:** Create an `.env` file with the contents from `.env.template`
**Step 3:** Create an `.env` file with the contents from `.env.template`

**Step 5:** [Ollama](https://ollama.com/) must be installed and running, with the granite3.3 model pulled.
**Step 4:** [Ollama](https://ollama.com/) must be installed and running, with the granite3.3 model pulled.
```sh
ollama pull granite3.3
```

**Step 6:** Start all services related to [beeai-code-interpreter](https://github.com/i-am-bee/beeai-code-interpreter)
**Step 5:** Start all services related to [beeai-code-interpreter](https://github.com/i-am-bee/beeai-code-interpreter)
```sh
poe infra --type start
uv run poe infra --type start
```

> [!NOTE]
Expand All @@ -76,21 +70,12 @@ Get complete visibility of the agent's inner workings via [OpenInference Instrum

### Instructions

1. (Optional) In order to see spans in [Phoenix](https://github.com/Arize-ai/phoenix), begin running a Phoenix server. This can be done in one command using docker.
1. In order to see spans in [Phoenix](https://github.com/Arize-ai/phoenix), begin running a Phoenix server. This can be done in one command using docker.

```
docker run -p 6006:6006 -i -t arizephoenix/phoenix
docker run -p 6006:6006 -i -t arizephoenix/phoenix:latest
```

or via the command line:

```
brew install i-am-bee/beeai/arize-phoenix
brew services start arize-phoenix
```

see https://docs.beeai.dev/observability/agents-traceability for more details.

2. Run the agent `python beeai_framework_starter/agent_observe.py`
3. You should see your spans exported in your console. If you've set up a locally running Phoenix server, head to [**localhost:6006**](http://localhost:6006/projects) to see your spans.

Expand All @@ -100,37 +85,38 @@ see https://docs.beeai.dev/observability/agents-traceability for more details.

### 🤖 Agent

Now that you’ve set up your project, let’s run the agent example located at `/beeai_framework_starter/agent_react.py`.
Now that you’ve set up your project, let’s run the agent example.

You have two options:

**Option 1:** Interactive mode
```sh
python beeai_framework_starter/agent.py
uv run python beeai_framework_starter/agent.py

Choose a reason for hiding this comment

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

Suggested change
uv run python beeai_framework_starter/agent.py
uv run beeai_framework_starter/agent.py

```

**Option 2:** Define your prompt up front
```sh
python beeai_framework_starter/agent.py <<< "I am going out tomorrow morning to walk around Boston. What should I plan to wear?"
uv run python beeai_framework_starter/agent.py <<< "I am going out tomorrow morning to walk around Boston. What should I plan to wear?"

Choose a reason for hiding this comment

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

Suggested change
uv run python beeai_framework_starter/agent.py <<< "I am going out tomorrow morning to walk around Boston. What should I plan to wear?"
uv run beeai_framework_starter/agent.py <<< "I am going out tomorrow morning to walk around Boston. What should I plan to wear?"

```

> [!NOTE]
> Notice this prompts triggers the agent to call a tool.
> Notice that this prompt triggers the agent to call a tool.

---

### 🧑‍💻 Code interpreter agent

Now let's run the code interpreter agent example located at `/beeai_framework_starter/agent_code_interpreter.py`.

Try the `Python Tool` and ask the agent to perform a complex calculation:
Try the `PythonTool` and ask the agent to perform a complex calculation:
```sh
python beeai_framework_starter/agent_code_interpreter.py <<< "Calculate 534*342?"
uv run python beeai_framework_starter/agent_code_interpreter.py <<< "Calculate 534*342?"

Choose a reason for hiding this comment

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

Suggested change
uv run python beeai_framework_starter/agent_code_interpreter.py <<< "Calculate 534*342?"
uv run beeai_framework_starter/agent_code_interpreter.py <<< "Calculate 534*342?"

```

Try the `SandBox tool` and run a custom Python function `get_riddle()`:
Try the `SandboxTool` and run a custom Python function `get_riddle()`:

```sh
python beeai_framework_starter/agent_code_interpreter.py <<< "Generate a riddle"
uv run python beeai_framework_starter/agent_code_interpreter.py <<< "Generate a riddle"

Choose a reason for hiding this comment

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

Suggested change
uv run python beeai_framework_starter/agent_code_interpreter.py <<< "Generate a riddle"
uv run beeai_framework_starter/agent_code_interpreter.py <<< "Generate a riddle"

```

---
Expand All @@ -140,13 +126,15 @@ python beeai_framework_starter/agent_code_interpreter.py <<< "Generate a riddle"
This example demonstrates a **multi-agent workflow** where different agents work together to provide a comprehensive understanding of a location.

The workflow includes three agents:

1. **Researcher:** Gathers information about the location using the Wikipedia tool.
2. **WeatherForecaster:** Retrieves and reports weather details using the OpenMeteo API.
3. **DataSynthesizer:** Combines the historical and weather data into a final summary.

To run the workflow:

```sh
python beeai_framework_starter/agent_workflow.py
uv run python beeai_framework_starter/agent_workflow.py

Choose a reason for hiding this comment

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

Suggested change
uv run python beeai_framework_starter/agent_workflow.py
uv run beeai_framework_starter/agent_workflow.py

```

---
Expand All @@ -157,4 +145,4 @@ For additional examples to try, check out the examples directory of BeeAI framew

## Development

If you are developing with this repository as a base, or updating this template, see additional information in [DEVELOP.md].
If you are developing with this repository as a base, or updating this template, see additional information in [./DEVELOP.md].
Loading