Skip to main content

Functionsmith

Overview

Functionsmith is a general-purpose problem-solving agent using dynamic function calling.

USING THIS AGENT IS UNSAFE. It directly runs LLM-produced code, and thus should only be used for demonstration purposes.

See a sample session output.

Notebook usage

Open the demo notebook.

Command-line usage

Install with:

pip install functionsmith

To run with the default task investigating a CSV file with airport data:

export GOOGLE_API_KEY=my-api-key
wget https://raw.githubusercontent.com/davidmegginson/ourairports-data/refs/heads/main/airports.csv
functionsmith_cli

Implementation

This agent uses dynamic function calling, which means that instead of relying on a fixed set of tools predefined in the agent in normal LLM function calling, we let the agent itself write with all the functions it needs.

The functionsmith system prompt asks the agent to first write any low-level function it needs, as well as tests for them. The agent loop will try to run these functions and ask the LLM to make corrections if necessary. Once all the functions are ready, the agent will write and run the code to solve the actual user task.

The agent does not use function calling features of LLM clients. Instead, it simply tries to parse all the python or tool_use sections present in the raw LLM output. It keeps all function definitions as well as their source code in memory. Each call to the LLM is preceded by the function definitions to let the LLM know what functions are available locally.

The functions are not saved permanently, though this feature can be added.

TODO(simonf): add an Earth Engine-specific notebook agent.

Attribution

Functionsmith was written by Simon Ilyushchenko (simonf@google.com). I am grateful to Renee Johnston and other Googlers for implementation advice, as well as to Earth Engine expert advisors Jeffrey Cardille, Erin Trochim, Morgan Crowley, and Samapriya Roy, who helped me choose the right training tasks.

Metadata

Release files for functionsmith 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for functionsmith 0.1.4
File Size Uploaded
functionsmith-0.1.4.tar.gz 15.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for functionsmith 0.1.4
File Interpreter ABI Platform
functionsmith-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 32.2 kB

Release files / functionsmith-0.1.4.tar.gz

Download URL functionsmith-0.1.4.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1aebc9f3916bff6de5f7d47834e3b214fa46a8175e5e48ba5a19775d13cf1a86
BLAKE2b-256 checksum
How to use checksums
e50b47a6aeb442415d5e941ac138c5c63eec18687366aab11f520c08dc76a40b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.7

Release files / functionsmith-0.1.4-py3-none-any.whl

Download URL functionsmith-0.1.4-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38a51aeb371ce0634c708f4981898876d25f32d49dca7f694aa56d747df14c7f
BLAKE2b-256 checksum
How to use checksums
0ff2763e2b2ff9c9970079c8dbb9ffc797bb06150f4555065a113908e008a374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page