langchain-latam-synth
LangChain tool for generating realistic, privacy-safe synthetic financial data for Latin American fintech applications.
langchain-latam-synth exposes the LatAm Synth generator as a ready-to-use LangChain tool for AI agents, testing, QA, demos, machine-learning experiments, data pipelines, and agent evaluation without using personally identifiable information.
The package provides one tool:
generate_latam_financial_data
It generates linked synthetic:
- financial users
- savings goals
- deposit and withdrawal transactions
The underlying generator is LatAm Synth, executed through its hosted Apify Actor.
Installation
pip install -U langchain-latam-synth
Requires Python 3.10+.
Authentication
The tool runs the hosted LatAm Synth Actor on Apify, so you need an Apify API token.
Set it as the APIFY_TOKEN environment variable:
macOS / Linux
export APIFY_TOKEN="your-apify-token"
Windows PowerShell
$env:APIFY_TOKEN = "your-apify-token"
Do not hard-code API tokens in source code or commit them to GitHub.
Quick start
from langchain_latam_synth import generate_latam_financial_data
result = generate_latam_financial_data.invoke(
{
"users": 25,
"seed": 42,
"countries": ["Colombia", "Mexico"],
}
)
print(result["run_id"])
print(len(result["users"]))
print(len(result["goals"]))
print(len(result["transactions"]))
The tool returns a dictionary with:
run_id
generator
users
goals
transactions
Tool arguments
| Argument | Type | Default | Description |
|---|---|---|---|
users |
int |
25 |
Number of synthetic users to generate. Accepted range: 1–200. |
seed |
int |
42 |
Random seed for reproducible datasets. |
countries |
list[str] | None |
None |
Optional list of Latin American countries to include. |
Example:
result = generate_latam_financial_data.invoke(
{
"users": 100,
"seed": 7,
"countries": ["Colombia"],
}
)
Use inside a LangChain agent
Because generate_latam_financial_data is a LangChain tool, it can be passed directly to an agent.
from langchain.agents import create_agent
from langchain_latam_synth import generate_latam_financial_data
agent = create_agent(
model="claude-sonnet-4-6",
tools=[generate_latam_financial_data],
)
response = agent.invoke(
{
"messages": [
{
"role": "user",
"content": (
"Generate a small synthetic Colombian fintech dataset "
"for testing a savings recommendation agent."
),
}
]
}
)
A model with tool-calling support can decide when to invoke LatAm Synth based on the user's request.
Example agent use cases
langchain-latam-synth is useful when an agent needs realistic financial test data without accessing production customer data.
Examples include:
- generating QA fixtures for fintech applications
- evaluating financial AI agents
- testing savings or recommendation assistants
- creating synthetic datasets for demos and POCs
- bootstrapping ML experiments
- validating data pipelines
- generating reproducible test datasets for regression tests
Privacy
LatAm Synth is designed to generate synthetic financial behavior for development and experimentation.
The generator produces synthetic users, savings goals, and transactions rather than returning production customer records. It is intended for scenarios where realistic financial structure is useful but personally identifiable information should not be used.
For details about the source generator and its statistical calibration, see the LatAm Synth repository.
How it works
The LangChain integration is intentionally small:
LangChain agent
|
| tool call
v
generate_latam_financial_data
|
| Apify API
v
LatAm Synth Actor
|
v
synthetic users + goals + transactions
The package starts the hosted Actor, waits for the run to finish, reads the generated JSON output, and returns the structured data to LangChain.
Related MCP access
LatAm Synth is also available independently to MCP-compatible AI clients through the hosted Apify MCP Server.
MCP endpoint:
https://mcp.apify.com?tools=active_yardstick/latam-synth
Official MCP Registry server name:
io.github.jmendozapuche/latam-fintech-synthetic-data
The MCP server and this LangChain package are two different integration paths to the same underlying LatAm Synth generator:
LangChain agents -> langchain-latam-synth -> Apify Actor
MCP clients -> Apify MCP Server -> Apify Actor
See the LatAm Synth repository for MCP configuration details.
Development
git clone https://github.com/jmendozapuche/langchain-latam-synth.git
cd langchain-latam-synth
pip install -e .
pip install pytest
pytest -v
The test suite validates the tool name and schema, input limits, and required Apify authentication.
Links
- PyPI package
- GitHub repository
- LatAm Synth source generator
- LatAm Synth Apify Actor
- Official MCP Registry
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_latam_synth-0.1.1.tar.gz.
File metadata
- Download URL: langchain_latam_synth-0.1.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
709c6cdfd7316258301d8b4f0bd021540be50be9ee9276a1bf6d4e117b5174d7
|
|
| MD5 |
3e17a598ef2036ce0a6f0fd832d4e9bd
|
|
| BLAKE2b-256 |
7b100bf35a693a25bbcf5ab2224ed9d1705693c3ed09c293dd11c819410e6f8b
|
File details
Details for the file langchain_latam_synth-0.1.1-py3-none-any.whl.
File metadata
- Download URL: langchain_latam_synth-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21ebbec0dc2584bd13745495ac950b0bd7e15d739c932e1ceb69da9c97876102
|
|
| MD5 |
f8a429cfde192d0aa333a28433930803
|
|
| BLAKE2b-256 |
4de0f0b9a985796f2cd353d32decbebc0412f713bc9d20ab37914d3692f085e4
|