How mjyanna/promptagent works
PromptAgent searches for high-performing task prompts: the configured entry point builds a task, base and optimization models, a world model, and a search algorithm; search expands prompts using sampled task examples and retains candidates by evaluation reward. The README also documents standalone prompt testing and multiple task/model families. Source excerpts confirm MCTS and beam-search interaction with the world model, plus gradient-descent feedback; wiring for unsampled task and model implementations is represented only at the documented subsystem level.
Main entry points: language_model Model adapters · agent.py Prompt agent · gradient_descent.py Prompt feedback · world_model.py World model
Components 21
Run orchestration
- CLI entry
src/main.py - Prompt agent
src/prompt_optim_agent/agent.py - Prompt testing
src/test.py - Optimized prompts
src/prompt_optim_agent/search_algo/mcts.py
Tasks and evaluation
- Task registry
src/tasks/__init__.py - Task implementations
src/tasks - Task interface
src/tasks/base_task.py - Task datasets
datasets
Prompt optimization
- World model
src/prompt_optim_agent/world_model/world_model.py - Prompt feedback
src/prompt_optim_agent/world_model/gradient_descent.py - Optimization templates
src/prompt_optim_agent/world_model/prompts/gradient_descent_prompts.py - Search registry
src/prompt_optim_agent/search_algo/__init__.py - MCTS search
src/prompt_optim_agent/search_algo/mcts.py - Beam search
src/prompt_optim_agent/search_algo/beam_search.py
Model backends
- Model registry
src/prompt_optim_agent/language_model/__init__.py - Model adapters
src/prompt_optim_agent/language_model
Other components
- User
- OpenAI API
- PaLM API
- Hugging Face
- CTranslate2
Connections 27
- User → CLI entry: configures run
- CLI entry → Prompt agent: starts agent
- User → Prompt testing: supplies prompt
- Prompt testing → Task registry: selects task
- Prompt testing → Model registry: selects model
- Prompt agent → Task registry: creates task
- Task registry → Task implementations: dispatches task
- Task implementations → Task interface: uses interface
- Task implementations → Task datasets: loads examples
- Prompt agent → Model registry: creates models
- Model registry → Model adapters: dispatches backend
- Prompt agent → World model: creates world model
- Prompt agent → Search registry: creates search
- Search registry → MCTS search: dispatches algorithm
- Search registry → Beam search: dispatches algorithm
- MCTS search → World model: expands and evaluates
- Beam search → World model: expands and evaluates
- World model → Prompt feedback: generates candidates
- Prompt feedback → Task interface: formats and scores
- Prompt feedback → Model adapters: runs base model
- Prompt feedback → Model adapters: requests revisions
- Prompt feedback → Optimization templates: uses templates
- MCTS search → Optimized prompts: records search output
- Model adapters → OpenAI API: calls API
- Model adapters → PaLM API: calls API
- Model adapters → Hugging Face: loads or runs model
- Model adapters → CTranslate2: runs model