What Programming Language Is Deer-Flow Written In? A Complete Technical Breakdown
Deer-Flow is written in Python for the backend and TypeScript for the frontend, forming a polyglot architecture that powers its AI agent system and web interface.
The bytedance/deer-flow repository is a full-stack AI agent framework that leverages the strengths of two distinct programming languages. Understanding what programming language Deer-Flow is written in requires examining both its server-side logic and its client-side interface, as each serves a specific architectural purpose.
Python Backend Architecture
The core server-side logic of Deer-Flow is implemented entirely in Python, utilizing modern async frameworks and AI orchestration libraries.
Core Server Components
The backend architecture centers on FastAPI for the API gateway and LangGraph for agent orchestration. In backend/src/gateway/app.py, the application entry point initializes the FastAPI instance and registers routers for models, memory, and skills. The agent logic itself resides in backend/src/agents/lead_agent/agent.py, which implements the LangGraph-based AI agent that coordinates tool execution and sandbox environments.
Key Python Files
Several critical Python modules define the system's behavior:
backend/src/gateway/app.py: Defines the FastAPI application factory and route registrationbackend/src/agents/lead_agent/agent.py: Implements the core LangGraph agent logicbackend/src/config/app_config.py: Handles environment configuration and application settings
# backend/src/gateway/app.py – FastAPI entry point
from fastapi import FastAPI
def create_app() -> FastAPI:
app = FastAPI(
title="DeerFlow API Gateway",
version="0.1.0",
)
# Register routers for models, memory, and skills
app.include_router(models.router)
app.include_router(memory.router)
return app
# Run with: uvicorn backend.src.gateway.app:app --host 0.0.0.0 --port 8000
TypeScript Frontend Implementation
The user-facing web interface of Deer-Flow is built with TypeScript, providing type safety and modern React patterns for the client application.
Web UI and Build System
The frontend utilizes Vite as the build tool and React for the component architecture. The TypeScript configuration in frontend/tsconfig.json establishes strict type checking and path mapping for the project. The build system compiles TypeScript to JavaScript while maintaining type definitions for API contracts and component props.
Key TypeScript Files
The frontend structure demonstrates typical TypeScript React patterns:
frontend/tsconfig.json: Configures compiler options, strict mode, and path aliasesfrontend/src/typings/md.d.ts: Contains TypeScript declarations for markdown module typesfrontend/src/components/: Houses React components with.tsxextensions and defined interfaces
// frontend/src/components/ModelList.tsx
import React, { useEffect, useState } from "react";
interface Model {
name: string;
description: string;
}
export const ModelList: React.FC = () => {
const [models, setModels] = useState<Model[]>([]);
useEffect(() => {
fetch("/api/models")
.then((res) => res.json())
.then(setModels)
.catch(console.error);
}, []);
return (
<ul>
{models.map((m) => (
<li key={m.name}>
<strong>{m.name}</strong>: {m.description}
</li>
))}
</ul>
);
};
How the Languages Interact
Deer-Flow's polyglot architecture relies on HTTP API communication between the TypeScript frontend and Python backend. The FastAPI gateway exposes REST endpoints that the React components consume via standard fetch requests. This separation allows the Python backend to handle computationally intensive AI agent operations while the TypeScript frontend manages stateful UI interactions and real-time updates.
Summary
- Deer-Flow is written in Python and TypeScript, utilizing a polyglot architecture that separates backend logic from frontend presentation.
- The Python backend in
backend/src/handles AI agents, FastAPI routing, and configuration using modern async frameworks. - The TypeScript frontend in
frontend/src/provides a React-based web interface compiled with Vite for type-safe component development. - Both languages communicate via REST APIs, with the Python gateway serving data to the TypeScript client components.
Frequently Asked Questions
Is Deer-Flow written entirely in Python?
No, Deer-Flow is not written entirely in Python. While the backend AI agents, API gateway, and server logic are implemented in Python, the user interface is built separately using TypeScript and React. This separation allows the project to leverage Python's strengths in AI/ML while utilizing TypeScript for type-safe frontend development.
What frontend framework does Deer-Flow use?
Deer-Flow uses React with TypeScript for its frontend framework. The build system is managed by Vite, as evidenced by the presence of frontend/tsconfig.json and the component structure in frontend/src/components/. This combination provides modern development features like hot module replacement and strict type checking.
Why does Deer-Flow use TypeScript instead of JavaScript?
Deer-Flow uses TypeScript instead of JavaScript to enforce type safety across the frontend codebase. The frontend/tsconfig.json configuration enables strict type checking, which helps catch errors during development rather than at runtime. This is particularly valuable for an AI agent framework where the frontend must reliably communicate with the Python backend API and handle complex data structures.
Can I extend Deer-Flow using only Python?
Yes, you can extend Deer-Flow's backend functionality using only Python. The core architecture in backend/src/agents/ and backend/src/tools/ is designed for Python extension, allowing you to add new AI agents, tools, and API endpoints without modifying the TypeScript frontend. However, any changes to the user interface would require working with the TypeScript/React codebase in frontend/src/.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →