> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getbindu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 1.3 Joke Generator

> Simple agent that generates jokes on demand

Simple agent that generates jokes on demand.

## Code

```python theme={null}
import os
from bindu.penguin.bindufy import bindufy
from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.models.openrouter import OpenRouter
from dotenv import load_dotenv

load_dotenv()

agent = Agent(
    instructions=(
        "You are a witty joke-telling agent. "
        "Your job is to entertain users with clever, clean, and funny jokes. "
        "You can tell puns, dad jokes, tech jokes, and situational humor. "
        "Keep the tone light, playful, and human-like. "
        "If a topic is given, tailor the joke to that topic."
    ),
    model=OpenRouter(
        id="openai/gpt-oss-120b",
        api_key=os.getenv("OPENROUTER_API_KEY")
    ),
    tools=[DuckDuckGoTools()],
)

config = {
    "author": "your.email@example.com",
    "name": "joke_agent",
    "description": "A research assistant agent",
    "deployment": {
        "url": "http://localhost:3773",
        "expose": True,
        "cors_origins": ["http://localhost:5173"]
    },
    
}

def handler(messages: list[dict[str, str]]):
    result = agent.run(input=messages)
    return result

bindufy(config, handler)

#bindufy(config, handler, launch=True)
# This will create a tunnel to your agent and expose it on port 3773
```

## How It Works

**Instructions**

* Defines agent personality as joke teller
* Specifies joke types: puns, dad jokes, tech jokes
* Sets tone: light, playful, human-like
* Allows topic-specific jokes

**Tools**

* `DuckDuckGoTools()`: Search for trending jokes
* Optional but adds topical humor capability

**Model**

* `openai/gpt-oss-120b`: Advanced reasoning for humor
* Via OpenRouter API
* Sometimes it can generate offensive or inappropriate jokes :P

## Dependencies

```bash theme={null}
uv init
uv add bindu agno python-dotenv
```

## Environment Setup

Create `.env` file:

```bash theme={null}
OPENROUTER_API_KEY=your_openrouter_api_key_here
```

## Run

```bash theme={null}
uv run agno_example.py
```

Try: "Tell me a joke about Python programming"

## Example API Calls

> [accordion] Message Send Request
>
> ```json theme={null}
> {
>   "jsonrpc": "2.0",
>   "method": "message/send",
>   "params": {
>     "message": {
>       "role": "user",
>       "kind": "message",
>       "messageId": "9f11c870-5616-49ad-b187-d93cbb100001",
>       "contextId": "9f11c870-5616-49ad-b187-d93cbb100002",
>       "taskId": "9f11c870-5616-49ad-b187-d93cbb100003",
>       "parts": [
>         {
>           "kind": "text",
>           "text": " tell me a dad joke"
>         }
>       ]
>     },
>     "configuration": {
>       "acceptedOutputModes": ["application/json"]
>     }
>   },
>   "id": "9f11c870-5616-49ad-b187-d93cbb100003"
> }
> ```

> [accordion] Task get Request
>
> ```json theme={null}
> {
>   "jsonrpc": "2.0",
>   "method": "tasks/get",
>   "params": {
>     "taskId": "9f11c870-5616-49ad-b187-d93cbb100003"
>   },
>   "id": "9f11c870-5616-49ad-b187-d93cbb100004"
> }
> ```

## Frontend Setup

```bash theme={null}
# Clone the Bindu repository
git clone https://github.com/GetBindu/Bindu

# Navigate to frontend directory
cd frontend

# Install dependencies
npm install

# Start frontend development server
npm run dev
```

Open [http://localhost:5173](http://localhost:5173) and try to chat with joke generator


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.