A Python-based AI agent that demonstrates human-in-the-loop interaction, allowing users to control and validate AI actions before they are executed.
This agent is designed to share fun content (facts, quotes, and jokes) while maintaining human oversight. It implements a pre-execution hook system that requires user approval before any action is taken, ensuring safe and controlled AI operations.
Human-in-the-Loop (HITL) workflows integrate human judgment and oversight into automated processes. These workflows pause at critical points for human review, validation, or decision-making before proceeding. This approach combines the efficiency of automation with human expertise and oversight where it matters most.
- Human Verification: Every action requires explicit user approval
- Retry Mechanism: Supports up to 3 retries for failed operations
- Interactive Console: Rich text-based interface with clear visual feedback
- Multiple Content Types: Can share:
- Interesting facts
- Motivational quotes
- Jokes
- Python 3.10
- Nebius API key (set in .env file)
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Create a
.envfile with your Nebius API key:NEBIUS_API_KEY=your_api_key_here
Run the agent using:
python main.pyThe agent will:
- Present the proposed action
- Show the arguments to be used
- Ask for your approval with options:
y: Proceed with the actionn: Cancel the actionretry: Retry with new data (up to 3 times)
The agent uses:
- The Nebius LLM model (meta-llama/Llama-3.3-70B-Instruct)
- Pre-execution hooks for action verification
- Rich console output for better user experience
- Iterator-based response streaming
- Maximum retry limit of 3 attempts
- Graceful cancellation support
- Clear error messages and status indicators
This implementation is based on the following Agno documentation:
- Human in the Loop - Documentation for implementing human validation in agent workflows
- Retry Functions - Documentation for implementing retry mechanisms in agent functions
