Skip to content
  • Auto
  • Light
  • Dark
DiscordForumGitHubSign up
Tools
Advanced usage
View as Markdown
Copy Markdown

Open in Claude
Open in ChatGPT

Using Tool Variables

You can use tool variables to specify environment variables available to your custom tools. For example, if you set a tool variable PASSWORD to banana, then write a custom function that prints os.getenv('PASSWORD') in the tool, the function will print banana.

To assign tool variables in the Agent Development Environment (ADE), click on Env Vars to open the Environment Variables viewer:

Once in the Environment Variables viewer, click + to add a new tool variable if one does not exist.

You can also assign tool variables on agent creation in the API with the tool_exec_environment_variables parameter:

curl
curl -X POST https://api.letta.com/v1/agents \
-H "Authorization: Bearer $LETTA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"memory_blocks": [],
"llm":"openai/gpt-4o-mini",
"tool_exec_environment_variables": {
"API_KEY": "your-api-key-here"
}
}'