翻篇收录说明
翻篇网页快照

From Zero to One: Building An Autonomous and Open Data Scientist Agent from Scratch

https://www.together.ai/blog/building-an-autonomous-and-open-data-scientist-agent-from-scratch

最近抓取:2026-12-05 07:31:18(北京时间)

最近内容变化:2026-12-02 18:59:50(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Build a data scientist agent using Together’s open-source models and Code Interpreter—easy to implement, solid benchmarks, and full code on GitHub.

正文摘录

All blog postsResearchPublished 6/12/2025From Zero to One: Building An Autonomous and Open Data Scientist Agent from ScratchAuthorsFederico Bianchi, Shang Zhu, Zain Hasan, Ben Athiwaratkun and James ZouTable of contents40+ Models Chosen for Production...40+ Models Chosen for Production...40+ Models Chosen for Production...Links in this articleOpen source codebaseTogether Code InterpreterData Science Agent CookbookTLDR. This blog post shows how to build an effective data scientist agent from scratch using Together’s open-source Models and Together Code Interpreter. While straightforward to implement, our agent performs well on several different use cases and benchmarks. We open source our codebase on GitHub.IntroductionThe daily work of data science requires us to sift through messy, incomplete information to extract actionable insights. This is often a process that requires multiple steps, ranging from data cleaning to model training and data analysis. Considering the explosion in capabilities of large language models, it is natural to start thinking about how to use readily available open-source technologies as a foundation for building agents that can effectively manipulate and analyze data.While human data scientists need to remain at the heart of these processes, AI agents can help support some of the workload and reduce the burden of analytical tasks.Today, we show how to implement a simple yet effective data scientist agent that can solve data science tasks. The implementation of this agent will be end-to-end, from the design of the pipeline to the implementation and the testing. We will do this using models and tools that are accessible on the Together Cloud, making this development surprisingly accessible. This “recipe” we share today for data science can be extended to other agents in other settings.In particular, we will follow a ReAct (Yao et al., 2023) pattern: the agent will first “think” and then “act”. Each action the agent generates is a Python snippet (e.g., `import pandas as pd; pd.read_csv(...)`). This is strongly inspired by the smolagents package, which is in turn inspired by the CodeAct (Wang et al., 2024) and the original ReAct paper.A CLI interface for configuring and launching DeepSeek V3 to run automated analysis on the ESOL dataset.‍The Open Data Scientist’s actions have to be executed. While conceptually this is an “easy” step, in practice it is not: code execution is, by nature, a very unsafe operation; even more so in the context of language models, where you do not know what the code generated by the language model is going to look like. To solve this problem and to run code safely and efficiently, we will use the Together Code Interpreter (TCI). TCI elegantly abstracts away the complexity of sandboxed Python execution, providing a clean API that accepts code and returns structured results. This architectural choice has strong implications for our agent's design—it becomes inherently modular and maintainable. Since the code execution layer is completely decoupled from the reasoning logic, we can modify prompts, adjust the ReAct patterns, or add new analytical capabilities without touching the execution infrastructure. The agent's behavior becomes highly tunable through prompt engineering alone, while TCI ensures consistent, reliable execution regardless of the complexity of the generated Python code.After having implemented the agent, we will focus on evaluation by providing quantitative and qualitative results regarding its performance. We will discuss some best practices on how to start building agents from scratch.Our data scientist agent implementation serves as a transparent example for understanding how to use open source models and TCI to build an agent and to evaluate agentic pipelines. Since this entire solution can be composed using Together Cloud features with just a single API key, this blog post is a good reference for those looking to understand the fundamentals of building reasoning-driven AI assistants.Why build agents from scratch?This is a good question! Considering the number of frameworks out there, one might not need to dive into lower-level implementations. However, in the context of agentic models, it is actually good to know how things work at a lower level of abstraction. Observing the steps a language model must take to interact with the external world is helpful in better understanding how the agent solves problems and how to improve general agent architectures. Even more so, considering how many edge cases one ends up encountering in the process of building agent architectures. Indeed, another interesting feature is that the Open Data Scientist agent we are going to build here is “hackable” and adaptable to different use cases.A CodeAct Data ScientistReAct The ReAct framework was introduced by Yao et al., 2023 to improve language agents. The idea behind the ReAct framework is encapsulated in its name: Reasoning and Action. The agent's activity unfolds using the following cyclical set of steps: the agent is tasked with a goal, reasons about what the next step could be, and then prepares the inputs to an action (which is then executed). Each action generates an observation from the environment, which is used as a source of new information for the next React step. To clarify, the agent operates entirely through text generation. When we say the agent "reasons about the task," we mean it outputs natural language that articulates its step-by-step thinking process. When we say the agent "prepares the next action," we mean it generates structured text that specifies which function to call and with what parameters. Both reasoning and action preparation are fundamentally text generation tasks that enable the agent to interface with external tools and environments.What does this mean in practice? In our "system prompt," we ask the language model first to write its reasoning and then to specify an actual action. Why let the agent reason?Letting the agent reason is inspired by chain-of-thought approaches, which show language models benefit from "thinking problems out loud". This is essentially a preparation step before acting:Reason: The agent develops a description of its reasoningAction: The agent designs an action to executeObservation: The environment returns information to the agentConsider an agent whose task is to answer "What's the weather in NYC?". This could unfold as follows: The language model would reason, "I need to use the weather API tool to find the weather in NYC," and then construct the function call weather("NYC"). In reality, the entire process can occur within a single generation from the language model, where it's prompted to first think and then produce what's known as a tool call. Once the language model generates the text, we can extract this action and execute it. We collect the output of the action (called observation) and add it to the context of the model. We then sample more tokens from the language model, which now is influenced by the additional observation of the context and will be able to provide an answer to the question above.1CodeActThere are a few different ways one can build a ReAct pipeline. The Open Data Scientist will follow the CodeAct format and ask the model to output all actions as Python code. This approach comes with some advantages and disadvantages, but it is generally a very flexible way for the agent to design actions: the agent can express more complex operations than what would be possible with simple tool calling, since it can, in practice, combine multiple operations in a few lines of python code.2At each step, the language model inside our CodeAct agent will perform two possible actions: 1) generate a thought and then Python code as an action or 2) generate a thought and output a final answer for the user. Here’s an example:Once we receive a response from the agent, we will examine the content and extract the actions by looking at sentences that start with “Thought” and “Action” to identify what the agent intends to execute. This simplifies our loop and makes it highly effective. We send the Action to the environment and once we obtain the results, we add it back to the chat context of the LLM so that the agent knows what has happened.Together Code InterpreterNote: TCI allows you to execute code safely in the cloud. For users who would prefer to execute code locally, we also release a simple (but very limited) local code sandbox as an alternative. More details available on the codebase.The Together Code Interpreter allows us to run Python code in a safe environment and to collect the output of any line of code we send to it. TCI is fast and effective. At the start of a new task, we allocate a code interpreter sandbox and load the required files to do the analysis. TCI allocates a sandbox that stays alive for 60 minutes and can be used to run operations much like it was a Jupyter notebook. TCI comes pre-installed with essential data science libraries like pandas, numpy, matplotlib, and scikit-learn, while supporting dynamic installation of additional packages: for example, one of the examples below requires installing RDkit, a library for cheminformatics. The platform handles rich output types including visualizations and maintains persistent state across code executions within a session.To simplify setup, in our repository, we also share a simple local code sandbox that is good for testing and building. This is also useful in case you want to run the agent on some local files, without having the need to upload them on the cloud.Simple, yet effective, and we make it accessible to everyoneTo make the open-source data scientist even more accessible, we developed a command line tool for the users to try out.The Open Data Scientist agent can be triggered with one command line call: `open-data-scientist –executor tci --write-report`Below is an example report generated by our command line tool, provided with a ch