All examples
Multi-tool pipeline

Data analysis

Reads a file, computes on it, and reports the number the tools produced.

json_tooltext_processingpython_replfile_operations

The program, and what it printed

This ran against effGen with gemini:gemini-3.1-flash-lite. The pane under the code is that run’s output, pasted — so where the answer depends on a live API or on the model’s wording, yours will differ. The pane is the shape that run actually had, not a tidied one.

python
import json
from pathlib import Path

from effgen import Agent, AgentConfig
from effgen.tools.builtin import FileOperations, JSONTool, PythonREPL, TextProcessingTool

Path("orders.json").write_text(json.dumps({
    "orders": [
        {"id": 1, "region": "emea", "total": 240.5},
        {"id": 2, "region": "amer", "total": 1204.0},
        {"id": 3, "region": "emea", "total": 87.25},
    ]
}))

agent = Agent(AgentConfig(
    model="gemini:gemini-3.1-flash-lite",
    name="data-analysis",
    system_prompt="Use the tools to read and compute. Report the numbers the tools returned.",
    tools=[JSONTool(), TextProcessingTool(), PythonREPL(), FileOperations()],
    max_iterations=8,
))

response = agent.run(
    "Read orders.json, and report the total value of the emea orders."
)

print(response.text)
print()
print("tool calls:", response.tool_calls.total)
for call in response.tool_calls:
    print(" ", call.name, "->", "error" if call.error else "ok")
what it printed
The total value of the emea orders is 327.75.

tool calls: 2
  file_operations -> ok
  python_repl -> ok

What it does

Four tools that chain: file operations to read, a JSON tool to query and validate, a Python REPL to compute, and text processing to summarise. The agent picks which it needs. The value of running the sum through a REPL rather than asking the model for it is that arithmetic on a small model is where errors come from, and a tool does not guess.

What the run shows

  • Two tool calls, in the order the agent chose them: read the file, then compute over what it read.
  • FileOperations confines reads to an allowed directory. A path outside it is refused by name rather than read.
  • The REPL session persists across calls within a run, so a variable defined in one call is available in the next.

The full script

The program above is the short version. The one in the repository at examples/advanced/data_processing_agent.py covers more cases and takes a --model flag. It ships with the package, so it runs from the command line without cloning anything:

effgen examples run advanced/data_processing_agent
Read it on GitHub