init
Browse files- example_usage.py +21 -0
example_usage.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
# Load agent configuration
|
| 5 |
+
with open("tunnel_farming_agent.json", "r") as f:
|
| 6 |
+
agent_config = json.load(f)
|
| 7 |
+
|
| 8 |
+
# Example API call to the agent
|
| 9 |
+
def query_agent(query):
|
| 10 |
+
url = "https://your-n8n-instance.com/webhook/invoke-tunnel-farming-agent"
|
| 11 |
+
payload = {
|
| 12 |
+
"query": query,
|
| 13 |
+
"user_id": "example_user",
|
| 14 |
+
"session_id": "example_session"
|
| 15 |
+
}
|
| 16 |
+
response = requests.post(url, json=payload)
|
| 17 |
+
return response.json()
|
| 18 |
+
|
| 19 |
+
# Example usage
|
| 20 |
+
response = query_agent("What is the current soil moisture level?")
|
| 21 |
+
print(response)
|