All examples
External API

Weather, with no API key

A live third-party API an agent can reach with nothing configured.

weatherjson_tool

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
from effgen import Agent, AgentConfig
from effgen.tools.builtin import JSONTool, WeatherTool

agent = Agent(AgentConfig(
    model="gemini:gemini-3.1-flash-lite",
    name="weather-agent",
    system_prompt=(
        "Use the weather tool for current conditions. Report the temperature, "
        "the conditions and the wind speed."
    ),
    tools=[WeatherTool(), JSONTool()],
    max_iterations=6,
))

response = agent.run("What is the weather in Blacksburg, Virginia right now?")

print(response.text)
print()
print("tool calls:", response.tool_calls.total)
for call in response.tool_calls:
    print(" ", call.name, call.arguments)
what it printed
The current weather in Blacksburg, Virginia is as follows:

*   **Temperature:** 25.1°C
*   **Conditions:** Partly cloudy
*   **Wind Speed:** 14.7 km/h

tool calls: 1
  weather {"location": "Blacksburg, Virginia", "operation": "current"}

What it does

The weather tool goes to Open-Meteo, which needs no key, so this is the shortest path from a fresh install to an agent that calls something real. The JSON tool is there for when you want to reshape the response rather than read it. It is a small example, and the reason it is on this page is that it is the one you can run first.

What the run shows

  • One tool call. The arguments are the model's, chosen from the tool's schema — a location string and an operation.
  • The temperature, conditions and wind speed in the answer are the ones the API returned at the moment of the run.
  • Nothing in this example reads an environment variable, so there is no key to get wrong.

The full script

The program above is the short version. The one in the repository at examples/web_retrieval/weather_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 web_retrieval/weather_agent
Read it on GitHub