Advanced Configuration
Setting Environment Variables
You can pass info like auth tokens dynamically or secrets/api keys as environment variables to your tools:
# Python
adapter.add_environment_variable("API_KEY", "your-api-key")
adapter.add_environment_variable("DEBUG", "true")
// TypeScript
adapter.addEnvironmentVariable("API_KEY", "your-api-key");
adapter.addEnvironmentVariable("DEBUG", "true");
Example use-cases
Passing Authentication Tokens
You can easily pass authentication tokens to your tools after login using environment variables.
Basic Example
from anthropic import Anthropic
from reacter_openapitools import AnthropicAdapter
import requests
anthropic_client = Anthropic(api_key="your-anthropic-api-key")
adapter = AnthropicAdapter(api_key="your OpenAPI Tools Apikey - https://openapitools.com/dashboard/settings")
# Login to get token
login_response = requests.post(
"http://api.example.com/login",
json={"username": "user", "password": "pass"}
)
token = login_response.json()["token"]
# Pass the token to your tools
adapter.add_environment_variable("token", token)
chatbot = adapter.create_anthropic_chatbot(
anthropic_client=anthropic_client,
llm_config={"model": "claude-3-7-sonnet-20250219"}
)
response = chatbot["invoke"]("Show me my orders")
print(response["text"])
That’s it! Your tools will now have access to the authentication token.
Last updated on