A conversational CLI agent that generates realistic sample user data and saves it to JSON files. Built with LangChain and LangGraph.
- Natural language interface - just describe what you want
- Generates realistic user data (names, emails, usernames, ages, registration dates)
- Save generated data directly to JSON files
- Model-agnostic: works with OpenAI, Anthropic, Gemini, Groq, Ollama, and more
You: Generate 5 users aged 20-30 and save them to users.json
You: Create 3 users with company.com email addresses
You: Make 10 users with last names Smith, Jones, and Williams
- Python 3.10+
- uv package manager
-
Clone the repo:
git clone https://github.com/your-username/datagen-agent.git cd datagen-agent -
Install dependencies:
uv sync
-
Create a
.envfile in the project root and add your API key (see Configuration):GROQ_API_KEY=your-key-here -
Run the agent:
uv run main.py
The agent is model-agnostic. By default it uses Groq (free tier available), but you can swap to any supported provider.
from langchain_groq import ChatGroq
llm = ChatGroq(model="llama-3.3-70b-versatile", temperature=0)Get a free API key at console.groq.com.
from langchain_ollama import ChatOllama
llm = ChatOllama(model="llama3.2", temperature=0)Install Ollama from ollama.com, then run ollama pull llama3.2.
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o", temperature=0)OPENAI_API_KEY=your-key-here
from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(model="claude-sonnet-4-20250514", temperature=0)ANTHROPIC_API_KEY=your-key-here
from langchain_google_genai import ChatGoogleGenerativeAI
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)GOOGLE_API_KEY=your-key-here
| Tool | Description |
|---|---|
generate_sample_users |
Generates user objects with id, name, email, username, age, and registration date |
write_json |
Writes a dictionary to a JSON file |
read_json |
Reads and returns the contents of a JSON file |
datagen-agent/
├── main.py # Agent definition, tools, and CLI loop
├── pyproject.toml # Dependencies managed by uv
├── .env # API keys (not committed)
└── .gitignore
| Command | Description |
|---|---|
uv run main.py |
Start the agent |
uv sync |
Install/reinstall all dependencies |
uv add <package> |
Add a new dependency |
uv remove <package> |
Remove a dependency |
quit / exit |
Exit the agent |
MIT