-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Please check the self upgradation capability in this OWL #582
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
yte121
wants to merge
23
commits into
camel-ai:main
Choose a base branch
from
yte121:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit introduces a file upload feature to the Gradio web interface, allowing users to attach files directly to their tasks. Key changes: - Adds a `gr.File` component to the UI in `owl/webapp.py`. - Modifies the backend function `run_owl` to accept an `uploaded_file` path and appends it to the user's prompt for the agents to process. - Updates the Gradio event handlers to correctly pass the file path from the new UI component to the backend. - Improves the UI by updating the default prompt text and example questions to guide users on how to use the new file upload capability.
This commit introduces two major features to the Gradio web interface to improve usability: 1. **Integrated File Management:** - Adds a `gr.File` component to the UI, allowing users to upload files directly instead of specifying a local path in the prompt. - The backend is updated to append the uploaded file's path to the task prompt for the agents to process. 2. **Session and Project History:** - Adds a "History" tab to the UI to view past runs. - After each successful run, the final answer and full conversation log are saved to a unique, timestamped directory under `owl/history/`. - The "History" tab contains a dropdown to select a past run and view its saved artifacts. A refresh button is included, and the list automatically updates after a new run is completed.
This commit introduces three major features to the Gradio web interface to improve usability and customization: 1. **Integrated File Management:** - Adds a `gr.File` component to the UI, allowing users to upload files directly. - The backend appends the uploaded file's path to the task prompt. 2. **Session and Project History:** - Adds a "History" tab to the UI to view past runs. - Saves the final answer and log of each successful run to a timestamped directory in `owl/history/`. - The "History" tab allows browsing and viewing of past run details. 3. **UI for Toolkit Management:** - Adds a `gr.CheckboxGroup` to the UI for selecting which toolkits to use. - Refactors `examples/run.py` to dynamically load tools based on the user's selection. - The web app logic in `owl/webapp.py` uses `inspect` to gracefully handle modules that do not support dynamic toolkit selection, ensuring backward compatibility.
This commit introduces UI components to allow users to configure the AI model and its temperature directly from the web interface. Key changes: - Adds a `gr.Dropdown` for model selection and a `gr.Slider` for temperature to `owl/webapp.py`, nested within an accordion for a clean UI. - Refactors `examples/run.py` to accept `model_name` and `temperature` as optional parameters in its `construct_society` function. - Updates the backend logic in `owl/webapp.py` to pass these parameters down to the agent creation logic. - Uses the `inspect` module to ensure backward compatibility by only passing the new parameters to functions that support them.
This commit introduces UI components to allow users to configure the AI model and its temperature directly from the web interface. Key changes: - Adds a `gr.Dropdown` for model selection and a `gr.Slider` for temperature to `owl/webapp.py`, nested within an accordion for a clean UI. - Refactors `examples/run.py` to accept `model_name` and `temperature` as optional parameters in its `construct_society` function. - Updates the backend logic in `owl/webapp.py` to pass these parameters down to the agent creation logic. - Uses the `inspect` module to ensure backward compatibility by only passing the new parameters to functions that support them.
This change introduces the initial phase of OpenRouter integration, allowing users to select OpenRouter from the web UI and specify a custom model name. Key changes: - Adds a new example script `examples/run_openrouter.py` that configures the agent society to use the OpenRouter API. - Updates `owl/webapp.py` to include "run_openrouter" in the list of selectable modules. - Adds a conditional text input field in the UI that appears when OpenRouter is selected, allowing users to enter a specific model name (e.g., "mistralai/mistral-7b-instruct"). - Modifies the backend logic to dynamically pass the `openrouter_model_name` to the agent creation process using Python's `inspect` module, ensuring backward compatibility. - Updates the `.env_template` to include a placeholder for the `OPENROUTER_API_KEY`.
…, and cooldown. This change builds upon the basic OpenRouter integration by introducing a resilient key management system, making the feature more robust and suitable for heavier usage. Key changes: - Creates a new `owl/key_manager.py` file containing two new classes: - `KeyManager`: Manages a pool of API keys provided via a comma-separated environment variable (`OPENROUTER_API_KEY`). It handles key rotation and enforces a cooldown period for keys that fail. - `ResilientOpenAICompatibleModel`: A wrapper class that inherits from `OpenAICompatibleModel`. It uses the `KeyManager` to dynamically select an API key for each request. It overrides the `step` method to catch API errors (e.g., authentication, rate limits) and automatically retries with the next available key after putting the failed key on cooldown. - Updates `examples/run_openrouter.py` to use the new `ResilientOpenAICompatibleModel` instead of the standard `ModelFactory`. This integrates the resilient key management logic into the agent society. This completes the implementation of the advanced OpenRouter features, providing a seamless and error-resistant experience when using the OpenRouter provider.
This feature significantly improves user experience by displaying the turn-by-turn dialogue as it happens, rather than waiting for the entire process to complete. Key changes: - Refactors the UI in `owl/webapp.py`, replacing the static `gr.Markdown` log display with an interactive `gr.Chatbot` component. The old log view is preserved in a new "Full Logs" tab. - Modifies the `run_society` function in `owl/utils/enhanced_role_playing.py` to accept an optional `message_queue`. It places each turn's data into this queue as it's generated. - Implements a new `stream_conversation` generator function in `owl/webapp.py`. This function runs the agent society in a background thread and listens to the message queue, yielding live updates to the `gr.Chatbot` component. - Updates all associated event handlers to support the new UI components and streaming logic.
This feature makes it significantly easier for users to run OWL with local models, improving flexibility and privacy. Key changes: - Refactors `examples/run_ollama.py` to accept a dynamic model name as a parameter, replacing the previously hardcoded model names. It also simplifies the model configuration and allows the Ollama server URL to be configured via an environment variable (`OLLAMA_API_BASE_URL`). - Integrates the Ollama runner into the `owl/webapp.py` UI. This includes adding a `run_ollama` option to the module dropdown and a conditional text input for the user to specify their desired model. - Updates the backend logic in the web app to be fully compatible with the new parameterized Ollama script. - Adds a new section to the `README.md` file with detailed instructions on how to set up and use Ollama with the OWL system.
feat: Enhance Local Model Support via Ollama
… a comprehensive update to the project's documentation. Features Implemented: 1. **OpenRouter Integration:** * Adds `run_openrouter.py` to support a wide variety of models. * Implements a `KeyManager` in `owl/key_manager.py` for API key pooling, rotation, and cooldown, making the integration resilient. * Integrates OpenRouter into the web UI with a dedicated model selection input. 2. **Real-time Streaming UI:** * Refactors the web UI in `owl/webapp.py` to use a `gr.Chatbot` component. * Implements a queue-based system to stream agent conversations to the UI in real-time, greatly improving user experience. 3. **Enhanced Ollama (Local Model) Support:** * Refactors `examples/run_ollama.py` to support dynamic model selection. * Integrates Ollama into the web UI, allowing users to specify a local model to run. 4. **Comprehensive Documentation:** * Updates the `README.md` with detailed sections on how to use the new OpenRouter and Ollama integrations. * Updates the Web Interface features list to include the new real-time streaming capability. This submission encapsulates the full scope of work completed, bringing the project to a new level of functionality and usability.
…ntation updates to the OWL framework. Key Features Implemented: 1. **Managed Self-Upgrade Capability:** * Adds a `SystemToolkit` and a set of helper scripts (`backup.sh`, `upgrade.sh`, `test.sh`, `restore.sh`) that empower an agent to perform a safe, managed upgrade of its own codebase. * Includes a `run_upgrade.py` example to orchestrate the backup -> upgrade -> test -> restore workflow. 2. **Real-time Streaming UI:** * Refactors the web UI to use a `gr.Chatbot` component that streams the agent's conversation in real-time, greatly improving user experience. 3. **Enhanced Model Support:** * **OpenRouter:** Integrates OpenRouter as a provider, featuring a resilient `KeyManager` for API key pooling, rotation, and cooldown. * **Ollama:** Enhances local model support by integrating Ollama into the web UI with dynamic model selection. 4. **Comprehensive Documentation:** * Updates the `README.md` with detailed instructions for all the new features, including OpenRouter, Ollama, and the new real-time streaming UI. This submission encapsulates the full scope of work completed, bringing the project to a new level of functionality, resilience, and usability.
…st capabilities to read, write, and query CSV files. This feature includes: 1. **`owl/utils/csv_toolkit.py`**: A new file containing the `CSVToolkit` class. It is implemented using Python's native `csv` module for maximum compatibility and includes three main methods: * `read_csv`: Reads a CSV file into a JSON string format suitable for LLM processing. * `write_csv`: Writes a JSON string of data into a new CSV file. * `query_csv`: Performs a simple 'key=value' query on a CSV file. * All methods include robust error handling. 2. **`examples/run_csv_task.py`**: A new example script that demonstrates a realistic, multi-step workflow using the toolkit to read, query, and write a CSV file. 3. **`examples/data/sample_employees.csv`**: A new sample data file for the example script. 4. **`README.md` Update**: The `CSVToolkit` has been added to the list of available toolkits in the main documentation.
…le of self-improvement and self-upgrading. This feature is the culmination of several underlying components, providing a persistent agent that continuously works to improve the codebase. Key Features & Components: 1. **Unified `DeveloperToolkit` (`owl/utils/developer_toolkit.py`):** * A new, comprehensive toolkit that provides the agent with all necessary capabilities. * Includes tools for codebase introspection (`list_files`, `read_file`), code modification (`write_file`), and testing (`run_tests`). * Integrates git operations (`check_for_git_updates`) and a complete, safe upgrade workflow (`run_upgrade_from_git`). 2. **Helper Scripts (`scripts/`):** * A new `scripts` directory containing robust shell scripts for `backup`, `upgrade`, `test`, and `restore` operations, forming the backbone of the safe upgrade process. 3. **Daemon Agent Workflow (`examples/run_developer_daemon.py`):** * A new example that runs the agent in a persistent `while True` loop. * The agent's behavior is guided by a detailed prompt, instructing it to first check for external git updates and apply them, and if none are found, to work on an internal development task from a predefined "backlog". * The workflow includes a short delay between cycles to ensure efficient resource usage. 4. **UI Integration and Documentation:** * The new Daemon Developer mode is accessible from the web UI's dropdown menu. * The `README.md` has been updated with a new "Advanced Usage" section explaining this powerful new feature and how to use it. This represents a significant step towards a truly autonomous, self-improving software agent.
…ng in an experimental Autonomous Developer Agent capable of self-improvement. This submission encapsulates the full scope of work from the development session, including all prerequisite features and the final agent. Key Features Implemented: 1. **Autonomous Developer Agent (`run_developer_daemon.py`):** * A persistent agent that runs in a continuous loop to improve the codebase. * It can check for external `git` updates and apply them safely using a backup-test-restore workflow. * It can also work on internal development tasks from a predefined "backlog", using a new `DeveloperToolkit` to read, write, and test its own source code. 2. **Supporting Toolkits & Scripts:** * **`DeveloperToolkit`**: A unified toolkit providing tools for file I/O, git operations, and system tests. * **Security Guardrails**: The toolkit includes path restrictions on file writing and script execution to mitigate risks. * **Helper Scripts**: A new `scripts/` directory contains robust shell scripts for `backup`, `upgrade`, `test`, and `restore`. 3. **Core Feature Enhancements (Prerequisites):** * **Streaming UI:** The web interface now streams agent conversations in real-time. * **Enhanced Model Support:** Includes robust integrations for OpenRouter (with key pooling) and Ollama (with UI configuration). * **`CSVToolkit`**: A new tool for agent-based data manipulation. 4. **Comprehensive Documentation:** * The `README.md` has been updated with instructions for all new features, including a dedicated "Advanced Usage" section with security warnings for the new developer agent.
…oper Agent by implementing critical safeguards. Key Security Enhancements: 1. **Human-in-the-Loop Confirmation:** * High-risk tools in the `DeveloperToolkit` (`write_file` and `run_upgrade_from_git`) now print a detailed security prompt to the console before execution. * The operation will only proceed if the human operator explicitly types "yes", preventing unintended or malicious actions. 2. **Path Restrictions:** * The `write_file` tool is now restricted to writing only within the `owl/`, `examples/`, and `scripts/` directories, preventing the agent from modifying arbitrary system files. * The `_run_command` helper is restricted to executing shell scripts only from the `scripts/` directory. 3. **Updated Documentation:** * The `README.md` has been updated with a "Security Considerations" section for the developer agent, clearly explaining the risks and the new confirmation feature. 4. **Agent Prompt Awareness:** * The prompt for the `run_developer_daemon.py` has been updated to make the agent aware that some of its actions require human approval. These changes make the powerful self-modification features significantly safer to use and represent a critical step in the responsible development of autonomous agents.
feat: Add major features and comprehensive documentation
…rimental Autonomous Developer Agent. It includes critical security guardrails and encapsulates all features developed in this session. Key Features & Enhancements: 1. **Autonomous Developer Agent (`run_developer_daemon.py`):** * A persistent agent that runs in a continuous loop to check for external git updates and work on an internal development backlog. 2. **Hardened `DeveloperToolkit` (`owl/utils/developer_toolkit.py`):** * **Human-in-the-Loop Security:** High-risk tools (`write_file`, `run_upgrade_from_git`) now print a security prompt to the console and require explicit 'yes' confirmation from the user before proceeding. * **Path Restrictions:** The toolkit now enforces strict path restrictions, ensuring file writes and script executions only occur within designated project directories. * **Unified Tools:** The toolkit provides a comprehensive set of functions for code introspection, modification, testing, and safe upgrades. 3. **Supporting Infrastructure:** * Includes the `CSVToolkit` for data manipulation. * Includes robust integrations for OpenRouter and Ollama. * Includes a real-time streaming UI for better user experience. 4. **Comprehensive Documentation:** * The `README.md` has been thoroughly updated to document all new features, including the new security measures and how to run the various agent modes. This submission represents the successful completion of a series of ambitious features, culminating in a powerful, more secure, and well-documented autonomous agent.
…zes a comprehensive set of features developed in this session. 1. **Configurable Launcher (`start.py`):** * A new `start.py` script in the root directory provides a clean, single entry point for the application. * Uses `argparse` to allow users to specify a custom `--port` and `--share` option for the Gradio web UI. * `owl/webapp.py` was refactored to support being launched from this external script. 2. **Comprehensive Feature Set:** * This submission also includes the complete, hardened implementation of the **Autonomous Developer Agent**, which can inspect its own code, perform safe git-based upgrades, and work on a backlog of development tasks. * Includes all supporting toolkits (`DeveloperToolkit`, `SystemToolkit`, `CSVToolkit`), helper scripts, and UI integrations (OpenRouter, Ollama, Streaming UI). 3. **Final Documentation:** * The `README.md` has been thoroughly updated to reflect all new features and provide clear instructions on how to run the application using the new `start.py` script.
feat: Add configurable launcher script and finalize all features
…t use the `OpenAICompatibleModel` class, such as the OpenRouter and Ollama integrations. The `model_platform` keyword argument was being incorrectly passed to the model constructor, causing a crash at runtime. This argument is used by the `ModelFactory` but not by the model's `__init__` method itself. The fix removes the extraneous `model_platform` argument from the constructor calls in the following files: - `examples/run_openrouter.py` - `examples/run_ollama.py` This resolves the user-reported bug and ensures that the OpenRouter and Ollama examples run correctly.
This commit fixes a `TypeError` that occurred when running agents tha…
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.