Revolutionizing AI Agents for Software Tasks
Imagine you're a developer racing to build an AI agent that can autonomously fix bugs in complex codebases. Traditionally, you'd need thousands of hand-labeled examples to train it effectively. But what if you could achieve state-of-the-art performance with just 78 carefully selected demonstrations? That's the game-changing promise of Agency-Focused Supervision (AFS), a fresh approach from researchers at Stanford, UC Berkeley, and other top institutions.
In real-world software engineering, AI agents promise to handle repetitive tasks like debugging, refactoring, and even full program synthesis. Tools like SWE-bench test these agents on GitHub issues from popular repos. However, scaling them has been bottlenecked by data hunger—most methods require massive datasets. AFS flips the script by prioritizing 'agency,' the agent's ability to plan strategically, reflect on actions, and use tools independently. This isn't just theory; it's backed by impressive results you can replicate today.
The Data Dilemma in Training AI Agents
Let's paint a scenario: You're at a startup, and your team needs an AI that resolves real GitHub issues without constant human oversight. Benchmarks like SWE-bench Verified (300 challenging tasks from Python repos) demand high resolution rates—fixing issues end-to-end. Baseline agents like ReAct score a measly 12.9%, Reflexion hits 14.4%, and even advanced ones like OpenHands top out at 16.9% on similar setups.
Why the struggle? Standard supervised fine-tuning (SFT) drowns in low-quality trajectories—endless loops of trial-and-error without smart planning. Researchers found that simply scaling data quantity doesn't cut it; quality matters more. Enter AFS, detailed in the paper 'Agency Can Scale Software Agents Zero-Shot' by John Yang and team. They distill supervision signals from high-agency behaviors, proving you don't need 10,000+ examples to compete.
Key Insight: What Makes an Agent 'Agentic'?
Agency here means more than executing commands—it's about depth:
- Planning: Breaking tasks into subgoals with foresight.
- Reflection: Critiquing past actions and pivoting.
- Tool Use: Calling external tools (e.g., file editors, testers) purposefully.
In practice, think of an agent debugging a Pandas script. A low-agency one might edit blindly; a high-agency one plans: 'Check imports → Test data load → Isolate error → Propose fix → Verify.' AFS scores these behaviors quantitatively.
How Agency-Focused Supervision Works
AFS isn't a black box—it's a principled pipeline you can implement. Here's the breakdown:
-
Collect Raw Trajectories: Run a base agent (like Qwen2.5-Coder-7B-Instruct) on tasks to generate interaction logs.
-
Compute Agency Scores: For each step, score on:
- Planning depth (e.g., number of subgoals).
- Reflection frequency (self-critiques).
- Tool diversity and relevance. A simple formula aggregates these into a per-trajectory score.
-
Agency Pruning: Ruthlessly filter—keep only the top 1% (e.g., 78 trajectories from 7,800). This prunes noise, focusing on gold-standard behaviors.
-
Distill into Supervision: Fine-tune a new model (AgencyCoder-7B-Instruct) purely on these pruned demos. No task-specific rewards—just agency imitation.
The magic? Zero-shot transfer. Train on general software tasks, deploy on unseen SWE-bench issues.
# Pseudocode for Agency Scoring (inspired by the method)
def agency_score(trajectory):
planning = len(extract_subgoals(trajectory))
reflection = count_reflections(trajectory)
tool_use = diversity_score(tools_used(trajectory))
return 0.4 * planning + 0.3 * reflection + 0.3 * tool_use
# Pruning example
trajectories = generate_raw(7800)
pruned = sorted(trajectories, key=agency_score, reverse=True)[:78]
train_model(pruned)
This is actionable—plug it into your agent framework like LangChain or AutoGen.
Stunning Results on Real Benchmarks
Tested on SWE-bench Verified:
- AgencyCoder-7B: 37.4% resolution rate—3x better than baselines.
- Vs. ReAct (12.9%), Reflexion (14.4%), SWE-Agent (16.9%), OpenHands (16.9%).
Scaling analysis is eye-opening:
| Training Trajectories | Resolution Rate |
|---|---|
| 78 (AFS) | 37.4% |
| 300 (Uniform) | ~20% |
| 7,800 (Uniform) | ~30% |
With just 78, AFS matches models trained on 10k+ uniform samples. Ablations confirm agency pruning is key—random pruning flops.
Real-world app: A dev team uses this to bootstrap an internal agent for legacy code fixes. Start with 100 runs on your repo issues, prune to 78, fine-tune in hours on a single GPU.
Why This Matters for Builders and Researchers
For developers: AFS democratizes agent training. No more scraping massive datasets—focus on quality interactions. Integrate with tools like GitHub Copilot or Cursor for hybrid human-AI workflows.
Example scenario: Automating CI/CD fixes.
- Agent detects failing test.
- Plans: 'Reproduce locally → Diff changes → Hypothesize bug → Patch → Rerun.'
- High-agency paths get amplified.
Researchers: This opens doors to data-efficient RLHF alternatives. Future work? Multi-agent agencies or domain adaptation (e.g., web dev).
The code and details are open-source on GitHub, including full pipelines, scoring scripts, and models. Fork it, tweak for your stack—Hugging Face weights coming soon.
Broader Implications and Getting Started
In an era of trillion-parameter models, data efficiency is king. AFS shows agency as a universal signal, potentially transferable to robotics or business automation.
Quick Start Guide:
- Clone the repo:
git clone https://github.com/johnma2006/agency-scales - Generate trajectories on your tasks.
- Run pruning script.
- Fine-tune with LoRA on consumer hardware.
Challenges remain: Compute for trajectory gen (~A100 hours), but yields high ROI. Experiment with your own benchmarks like HumanEval or custom repos.
This approach isn't hype—it's a scalable path to reliable software agents. Whether you're solo-coding or leading an AI team, AFS equips you to build smarter, faster.
<div style="text-align: center; margin-top: 2rem;"> <a href="https://www.marktechpost.com/2025/10/06/a-new-agency-focused-supervision-approach-scales-software-ai-agents-with-only-78-examples/" target="_blank" rel="noopener noreferrer" class="view-full-resource-btn" style="display: inline-block; background-color: #f97316; color: white; padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: 600; transition: background-color 0.2s;">View Full Resource</a> </div>
Stay ahead of the AI curve
The most important updates, news, and content — delivered in one weekly newsletter.