Skip to content

Jules wip 10459775938551966727 #739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
00a29e1
Add files via upload
TGreen87 May 19, 2025
85d4d19
Add files via upload
TGreen87 May 19, 2025
a22dde0
Delete setup.sh
TGreen87 May 19, 2025
6ac4bd3
Delete AGENTS.md
TGreen87 May 19, 2025
7ae938a
Delete agents.md
TGreen87 May 19, 2025
a6e087a
Add files via upload
TGreen87 May 19, 2025
2d9d358
Update setup.sh
TGreen87 May 19, 2025
24e2b3a
Delete setup.sh
TGreen87 May 19, 2025
7c08cbd
Create setup.sh
TGreen87 May 19, 2025
1046308
Update agents.md
TGreen87 May 19, 2025
41544a3
chore: make setup.sh executable
TGreen87 May 19, 2025
4dd8f9e
fix: remove duplicate ModelResponse export
TGreen87 May 19, 2025
c043255
Merge pull request #1 from TGreen87/codex/remove-duplicate-modelrespo…
TGreen87 May 19, 2025
b9d0b1c
Cache screenshots and use references
TGreen87 May 19, 2025
4b5c3af
update i18n search front matter
TGreen87 May 19, 2025
c7c57b4
docs: update agent guidelines
TGreen87 May 19, 2025
d566393
Merge pull request #2 from TGreen87/codex/optimize-screenshot-logic-w…
TGreen87 May 19, 2025
716e483
Merge pull request #4 from TGreen87/codex/update-instructions-and-rep…
TGreen87 May 19, 2025
5d2d616
Merge pull request #3 from TGreen87/codex/update-translate-docs-py-fo…
TGreen87 May 19, 2025
7fe2478
fix: add trailing periods to comments
TGreen87 May 19, 2025
66bf69b
Merge branch 'main' into codex/fix-comments-lacking-trailing-periods
TGreen87 May 19, 2025
c416370
Merge pull request #5 from TGreen87/codex/fix-comments-lacking-traili…
TGreen87 May 19, 2025
7b67ddf
Add ExecutiveAssistant agent and Deepgram voice support
TGreen87 May 19, 2025
e60e90d
Add ExecutiveAssistant agent and Deepgram voice support
TGreen87 May 19, 2025
dcba0b6
Merge pull request #7 from TGreen87/codex/start-code-for-executive-as…
TGreen87 May 19, 2025
ae2da28
Merge pull request #6 from TGreen87/codex/start-code-for-executive-as…
TGreen87 May 20, 2025
11f3581
Resolve merge conflicts in PR #8: Improve comment style consistency (#9)
Copilot May 21, 2025
7b825ec
docs: clarify setup script usage (#10)
TGreen87 May 21, 2025
3b54f20
Update agents.md
TGreen87 May 21, 2025
9c4e7ee
Resolve merge conflicts and improve code style consistency (#11)
Copilot May 21, 2025
67bc844
Jules was unable to complete the task in time. Please review the work…
google-labs-jules[bot] May 22, 2025
e2183e8
Jules was unable to complete the task in time. Please review the work…
google-labs-jules[bot] May 24, 2025
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
69 changes: 0 additions & 69 deletions AGENTS.md

This file was deleted.

7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ mypy:
uv run mypy .

.PHONY: tests
tests:
uv run pytest
tests:
uv run pytest

.PHONY: verify
verify: format lint mypy tests

.PHONY: coverage
coverage:
Expand Down
131 changes: 131 additions & 0 deletions agents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# agents.md – OpenAI Agents SDK Bootstrap Guide

Welcome! This guide explains **how to initialise and integrate the OpenAI Agents SDK ≥ 0.0.15** into your Codex project fork.
It assumes you have already cloned the repository and run `setup.sh`.

---

## 1 Prerequisites

| Tool | Locked Version | Notes |
|------|----------------|-------|
| Python | 3.12.10 | Installed via `pyenv` |
| Node JS | 22.15.1 | Required for tooling / CI |
| OpenAI Agents SDK | 0.0.15 | Installed into `.venv` |
| uv | 0.7.5 | Ultra‑fast resolver used by `setup.sh` |

In addition, ensure *git*, *curl* and *GNU Make* are on your `PATH`.

---

## 2 Repository Layout (after bootstrap)

.
├── .github/ ← CI workflows
├── agents/ ← Your custom agents live here
├── src/ ← Application code
├── tests/ ← Pytest suite
├── setup.sh ← Environment bootstrap (run when bootstrapping a new environment)
├── uv.lock ← Pinned dependency hashes (uv‑generated)
└── agents.md ← **You are here**

---

## 3 First‑time Setup (quick recap)

1. `./setup.sh` – installs Python 3.12.10 with *pyenv*, creates `.venv`, installs uv, OpenAI Agents SDK 0.0.15, pre‑commit hooks, and Node 22.15.1.
2. `source .venv/bin/activate` – activate the virtual‑env.
3. `make verify` – runs `format`, `lint`, `mypy` and `tests`.

---

## 4 Scaffolding a New Agent

1. Generate a skeleton:

python -m agents.cli new --name "MyToolAgent" --task "Summarise pull‑requests"

This creates:

agents/my_tool_agent/
├── __init__.py
├── schema.py ← Pydantic schemas for tool I/O
├── tools.py ← Tool implementations
├── plan.yaml ← High‑level chain‑of‑thought recipe
└── tests/

2. Implement business logic in `tools.py`.
3. Describe the task graph in `plan.yaml`.
4. Add unit tests in `tests/`.
5. Register the agent in `src/agents_registry.py`:

from agents.my_tool_agent import MyToolAgent
AGENT_REGISTRY.register(MyToolAgent)

---

## 5 Local Invocation

Activate the environment and run:

agents run my-tool-agent --input /path/to/file.md

Logs stream in **structured JSON**; pretty‑printing is provided by `jq` or the bundled `scripts/format‑logs.py`.

---

## 6 CI / CD Workflow Skeleton

Workflow file: `.github/workflows/agents.yml`

name: agents
on:
pull_request:
paths: ['agents/**', 'src/**', 'tests/**']
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install uv==0.7.5 && uv pip install --system -r uv.lock
- run: make verify

A separate `deploy.yml` promotes passing revisions to your chosen runtime (e.g. Netlify Functions or AWS Lambda).

---

## 7 Security & Compliance Guidelines

* **Never** store API keys in git; use GitHub Actions secrets or `.env`.
* Tools must validate and sanitise all external input before execution.
* Follow the principle of least privilege when invoking network or file‑system resources.
* All code **must** pass `ruff`, `mypy` and `pytest -q`.

---

## 8 Contributor Workflow

1. Fork → create feature branch.
2. `make dev` – watch mode with hot‑reloading.
3. Ensure `make verify` passes before committing.
4. Push and open a PR; CI must be green.
5. At least **one reviewer** from `CODEOWNERS` approves & merges.

_Style guideline_: write comments as full sentences and end them with a period.

---

## 9 Next Steps

* Read the OpenAI Agents SDK docs.
* Explore `examples/` shipped with the SDK.
* Extend `setup.sh` to install GPU‑dependent libraries if required.
* Optional: enable *OpenTelemetry* tracing via `export AGENTS_TRACE=1`.


## 10 Future Steps
* Always ensure dependencies for features are added to ./setup.sh when an error occurs, or is predicted to be required
* Make recommendations for advanced functionality, adding a UI / UX using Next.js 15.3, Tailwind CSS 4.1.3, Shadcn/ui 2.5.0, React 19.1
37 changes: 37 additions & 0 deletions agents/executive_assistant/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from __future__ import annotations

# mypy: ignore-errors

"""Executive Assistant agent.

This agent orchestrates other agents and provides voice capabilities using
Deepgram STT and TTS models. It maintains short-term and long-term memory and
can retrieve information via a simple RAG component.
"""
from agents import Agent # noqa: E402

from .memory import LongTermMemory, ShortTermMemory # noqa: E402
from .rag import Retriever # noqa: E402
from .tools import get_calendar_events, send_email # noqa: E402


class ExecutiveAssistantState:
"""Holds resources used by the Executive Assistant."""

def __init__(self, memory_path: str = "memory.json") -> None:
self.short_memory = ShortTermMemory()
self.long_memory = LongTermMemory(memory_path)
self.retriever = Retriever()


executive_assistant_agent = Agent(
name="ExecutiveAssistant",
instructions=(
"You are an executive assistant. Use the available tools to help the user. "
"Remember important facts during the conversation for later retrieval."
),
model="gpt-4o-mini",
tools=[get_calendar_events, send_email],
)

__all__ = ["ExecutiveAssistantState", "executive_assistant_agent"]
40 changes: 40 additions & 0 deletions agents/executive_assistant/memory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from __future__ import annotations

import json
from pathlib import Path
from typing import Any


class ShortTermMemory:
"""In-memory store for conversation turns."""

def __init__(self) -> None:
self._messages: list[dict[str, str]] = []

def add(self, role: str, content: str) -> None:
"""Add a message to memory."""
self._messages.append({"role": role, "content": content})

def to_list(self) -> list[dict[str, str]]:
"""Return the last 20 messages."""
return self._messages[-20:]


class LongTermMemory:
"""Simple file backed memory store."""

def __init__(self, path: str | Path) -> None:
self._path = Path(path)
if self._path.exists():
self._data = json.loads(self._path.read_text())
else:
self._data = []

def add(self, item: Any) -> None:
"""Persist an item to disk."""
self._data.append(item)
self._path.write_text(json.dumps(self._data))

def all(self) -> list[Any]:
"""Return all persisted items."""
return list(self._data)
18 changes: 18 additions & 0 deletions agents/executive_assistant/rag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from __future__ import annotations

from collections.abc import Iterable


class Retriever:
"""Very small RAG retriever stub."""

def __init__(self, corpus: Iterable[str] | None = None) -> None:
self._corpus = list(corpus or [])

def add(self, document: str) -> None:
"""Add a document to the corpus."""
self._corpus.append(document)

def search(self, query: str) -> list[str]:
"""Return documents containing the query string."""
return [doc for doc in self._corpus if query.lower() in doc.lower()]
17 changes: 17 additions & 0 deletions agents/executive_assistant/tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from __future__ import annotations

from agents import function_tool


@function_tool
def get_calendar_events(date: str) -> str:
"""Retrieve calendar events for a given date."""
# TODO: Integrate with calendar API.
return f"No events found for {date}."


@function_tool
def send_email(recipient: str, subject: str, body: str) -> str:
"""Send a simple email."""
# TODO: Integrate with email service.
return "Email sent."
7 changes: 7 additions & 0 deletions agents/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[project]
name = "custom-agents"
version = "0.0.0"
requires-python = ">=3.9"

[tool.hatch.build.targets.wheel]
packages = ["executive_assistant"]
11 changes: 4 additions & 7 deletions docs/scripts/translate_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
# gpt-4.5 needed this for better quality
ENABLE_SMALL_CHUNK_TRANSLATION = False

SEARCH_EXCLUSION = """---
search:
exclude: true
---
"""

def search_front_matter(lang_code: str) -> str:
return f"---\nsearch:\n lang: {lang_code}\n---\n"


# Define the source and target directories
Expand Down Expand Up @@ -239,8 +237,7 @@ def translate_file(file_path: str, target_path: str, lang_code: str) -> None:
for idx, code_block in enumerate(code_blocks):
translated_text = translated_text.replace(f"CODE_BLOCK_{idx:02}", code_block)

# FIXME: enable mkdocs search plugin to seamlessly work with i18n plugin
translated_text = SEARCH_EXCLUSION + translated_text
translated_text = search_front_matter(lang_code) + translated_text
# Save the combined translated content
with open(target_path, "w", encoding="utf-8") as f:
f.write(translated_text)
Expand Down
Loading