Skip to content

achyutniroula/test-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

PromptShop Test Agent (OpenRouter Edition) This project provides a lightweight Python agent that reads a prompt from input.json, sends it to an OpenAI‑compatible API (OpenRouter), and prints the model’s response. It is structured to work both as a standalone script and inside PromptShop’s agent execution system.

Overview

Uses OpenRouter, a provider offering free access to multiple LLMs through an OpenAI‑compatible API. Loads API keys securely through .env using python-dotenv. Reads user input from input.json and falls back to a default prompt if the file is missing or invalid. Produces clean, predictable console output suitable for testing in PromptShop.

Project Structure main.py requirements.txt README.md .env input.json (optional for local testing)

Installation Clone the repository: Shellgit clone https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.gitcd YOUR_REPO_NAMEShow more lines Install dependencies: Shellpip install -r requirements.txtpip install python-dotenvShow more lines

Environment Setup Create a .env file in the project directory and add your OpenRouter API key: OPENROUTER_API_KEY=your_openrouter_key_here

You can create a free key at: https://openrouter.ai Avoid adding quotes around the key. Make sure .env is not committed to version control.

Input Format The agent expects a JSON file named input.json: JSON{ "prompt": "Tell me something interesting."}Show more lines If the file is missing or invalid, the agent will use a default prompt.

Running the Script Locally Shellpython main.pyShow more lines Example output: Received prompt: Tell me something interesting.

--- AI Response --- (Generated text here)

How It Works

Loads environment variables from .env. Reads the prompt from input.json. Sends the prompt to a free OpenRouter model such as mistralai/mistral-7b-instruct using the OpenAI‑compatible client. Prints the formatted response to standard output.

This makes the script suitable for automated evaluation and for PromptShop’s execution environment.

Using With PromptShop When creating a listing in PromptShop:

Product type: agent Enable execution: Yes Runtime: Python Entrypoint: main.py Repository URL: link to your GitHub repo

Add an input field:

Name: prompt Type: textarea Required: Yes

PromptShop will pass user input into your agent's input.json during execution.

Requirements

Python 3.9 or newer openai Python package python-dotenv An OpenRouter API key

All dependencies are listed in requirements.txt.

License This project is open-source and may be used for personal or educational purposes.

About

A simple Python agent that reads a prompt, sends it to a free OpenAI‑compatible API (OpenRouter), and returns the model’s response.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages