Skip to main content

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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

functionsmith-0.1.4.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

functionsmith-0.1.4-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file functionsmith-0.1.4.tar.gz.

File metadata

  • Download URL: functionsmith-0.1.4.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.7

File hashes

Hashes for functionsmith-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1aebc9f3916bff6de5f7d47834e3b214fa46a8175e5e48ba5a19775d13cf1a86
MD5 aadfdaddb7cae5610d468e7a0df121d8
BLAKE2b-256 e50b47a6aeb442415d5e941ac138c5c63eec18687366aab11f520c08dc76a40b

See more details on using hashes here.

File details

Details for the file functionsmith-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: functionsmith-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.7

File hashes

Hashes for functionsmith-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 38a51aeb371ce0634c708f4981898876d25f32d49dca7f694aa56d747df14c7f
MD5 e6ac005c5fd651800e2400cb37e63c21
BLAKE2b-256 0ff2763e2b2ff9c9970079c8dbb9ffc797bb06150f4555065a113908e008a374

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page