1. Testing Pre-define Demo

AgentJet provides a complete feature set for tuning agents. You can try starting training an agent right away by running a demo:

ajet --conf tutorial/example_math_agent/math_agent.yaml

2. Minimum Example

Let's begin with the simplest example: a math agent with a tool call.

train_math_agent.py
from ajet import AgentJetJob

# refer to `https://modelscope.github.io/AgentJet/en/tune_your_first_agent/` on how to write your own workflow
from tutorial.example_math_agent.math_agent_simplify import MathToolWorkflow

model_path = "YOUR_MODEL_PATH"
job = AgentJetJob(
    n_gpu=8,
    algorithm='grpo',
    model=model_path,
    # LoRA (optional): lora_rank=8, lora_alpha=16, lora_target_modules="all-linear"
    # Full argument list: run `help(AgentJetJob)` or check `ajet/copilot/job.py`
)
job.set_workflow(MathToolWorkflow)
job.set_data(type="hf", dataset_path='openai/gsm8k')

# [Optional] Save yaml file for manual adjustment
# job.dump_job_as_yaml('saved_experiments/math.yaml')

# [Optional] Load yaml file from manual adjustment
# job.load_job_from_yaml('saved_experiments/math.yaml')

# Start training
tuned_model = job.tune()

AgentJetJob Parameters

Run help(AgentJetJob) to see all available parameters including batch_size, num_repeat, max_prompt_length, max_response_length, max_model_len, lora_rank, lora_alpha, lora_target_modules, and more.

CLI Alternative

The code above is equivalent to running in terminal:

ajet --conf ./saved_experiments/math.yaml

3. Compare with Community Training Curves

Explore our rich library of examples to kickstart your journey:

5. Next Steps