AgentBrew: Offline Tool-Use Agent Learning from Raw Real-World Trajectories
Organizations: Nanyang Technological University · Kuaishou Technology · Southeast University
Abstract
LLM-based agents are increasingly deployed in real-world applications through tool-use APIs, yet training them for specific environments remains fundamentally difficult: real-world applications provide no pre-defined tasks or verifiers, no faithful simulators, and limited budget for large-scale environment interaction. In this paper, we propose AgentBrew, an offline training framework that learns effective tool-use policies from a single batch of raw interaction trajectories, without task verifiers or iterative on-policy rollouts. The agent first explores the target environment to collect a raw trajectory corpus without quality filtering. To extract training signal from this noisy corpus, retrospective task inference reconstructs an aligned instruction for each trajectory based on its actual outcome, and PMI-Based credit assignment decomposes the trajectory's total information about the inferred instruction into additive per-action credits via pointwise mutual information (PMI). These credits weight the policy training objective, amplifying informative actions while suppressing ineffective ones. On three real-world MCP applications (GitHub, Notion, PostgreSQL), AgentBrew improves Qwen3-32B by +8.7 Acc / +9.7 Score on average, surpassing Qwen3-235B (+2.3 / +4.4) and outperforming rejection sampling (+5.9 / +10.3). These results demonstrate that fine-grained offline learning can recover useful supervision from raw trajectories that filtering-based approaches would discard. The code is available at https://github.com/alphatogo/AgentBrew
Figures & tables
| Method | GitHub | Notion | Postgres | Average | ||||
| Acc. | Score | Acc. | Score | Acc. | Score | Acc. | Score | |
| Frontier Proprietary Models | ||||||||
| GPT-5 | 64.2 | 85.4 | 42.9 | 83.4 | 42.9 | 61.7 | 50.0 | 76.8 |
| Claude Sonnet-4.5 | 57.1 | 76.9 | 39.3 | 84.6 | 38.1 | 53.3 | 44.8 | 71.6 |
| Gemini-3 Pro | 60.7 | 81.2 | 53.6 | 86.2 | 57.1 | 75.1 | 57.1 | 80.8 |
| Open-Source Foundation Models | ||||||||
| Task Instruction | Acc. | Score |
| Original | 7.1 | 65.6 |
| Inferred | 14.2 | 70.1 |
| Method | Training Paradigm | GitHub | Notion | Postgres | Avg. | ||||
| Acc. | Score | Acc. | Score | Acc. | Score | Acc. | Score | ||
| Qwen3-14B | No additional training | 7.1 | 48.2 | 0 | 48.8 | 19.0 | 31.3 | 8.7 | 42.8 |
| Toucan-14B | SFT on 1.5M synthetic trajs. | 0 | 45.2 | 0 | 42.5 | 0 | 11.4 | 0.0 | 33.3 |
| AWM-14B | Online RL on synthetic envs. | 7.1 | 45.4 | 0 | 44.5 | 23.8 | 38.0 | 10.3 | 42.6 |
| AgentBrew-14B | Offline transfer | 17.9 | 56.3 | 14.2 | 69.8 | 28.6 | 40.0 | 20.2 | 55.3 |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Env. | #Tools | Tools |
| GitHub | 41 | create_repository, get_repository, list_repositories, fork_repository, get_repository_languages, get_file_contents, create_or_update_file, delete_file, push_files, create_issue, get_issue, list_issues, update_issue, add_issue_comment, create_pull_request, get_pull_request, list_pull_requests, get_pull_request_files, create_pull_request_review, merge_pull_request, create_branch, list_branches, list_commits, list_workflow_runs, get_workflow_run, list_workflow_jobs, cancel_workflow_run, search_repositories, search_code, search_issues, search_users, list_code_scanning_alerts, get_code_scanning_alert, list_dependabot_alerts, get_dependabot_alert, list_secret_scanning_alerts, get_secret_scanning_alert, list_global_security_advisories, list_org_repository_security_advisories, list_repository_security_advisories, create_pull_request_with_copilot |
| Notion | 19 | get-user, get-users, get-self, post-database-query, post-search, get-block-children, patch-block-children, retrieve-a-block, update-a-block, delete-a-block, retrieve-a-page, patch-page, post-page, create-a-database, update-a-database, retrieve-a-database, retrieve-a-page-property, retrieve-a-comment, create-a-comment |
| Postgres | 9 | list_schemas, list_objects, get_object_details, execute_sql, explain_query, get_top_queries, analyze_workload_indexes, analyze_query_indexes, analyze_db_health |
| GitHub (14) | Notion (12) | PostgreSQL (15) | |||
| Project bootstrap & self-review | Database creation & schema design | Bulk migration & transformation | |||
| Multi-source code integration | Cross-database relation & sync | Hierarchy-aware CRUD & integrity | |||
| Ecosystem metrics & reporting | Batch query, filter & migration | Dashboard reporting & aggregates | |||
| Decision-based comparative forking | Batch updates & coordinated edits | SQL query debugging & fixing | |||
| Simulated issue automation | Aggregate computation & dashboards | Query optimization & indexing | |||
| Fork-and-fix contribution | Multi-source query & synthesis | Operational workflow management | |||
Tool-Using Agents
Tool-using agents plan and act through external tools, APIs, software interfaces, and environments to complete tasks beyond language generation.
See all 290 papers