LangChain Integration
Wrap gork API endpoints with@tool to empower any LangChain agent:
from langchain_core.tools import tool
import requests, os
GORK_KEY = os.getenv("GORK_API_KEY")
@tool
def gork_send_email(inbox_id: str, to: str, subject: str, body: str) -> str:
"""Send an outbound email from a managed agent inbox."""
res = requests.post(
"https://api.gork.email/v1/messages/send",
headers={"Authorization": f"Bearer {GORK_KEY}"},
json={"inboxId": inbox_id, "to": [to], "subject": subject, "text": body}
)
return f"Dispatched email: {res.json()['data']['id']}"
@tool
def gork_read_thread(inbox_id: str, thread_id: str) -> dict:
"""Retrieve full conversational history for an email thread."""
res = requests.get(
f"https://api.gork.email/v1/inboxes/{inbox_id}/threads/{thread_id}",
headers={"Authorization": f"Bearer {GORK_KEY}"}
)
return res.json()["data"]
CrewAI Integration
from crewai import Agent, Task, Crew
from crewai.tools import tool
import requests, os
GORK_KEY = os.getenv("GORK_API_KEY")
@tool("send_sales_email")
def send_sales_email(inbox_id: str, recipient: str, subject: str, text: str) -> str:
"""Dispatches a personalized email to a prospective lead."""
res = requests.post(
"https://api.gork.email/v1/messages/send",
headers={"Authorization": f"Bearer {GORK_KEY}"},
json={"inboxId": inbox_id, "to": [recipient], "subject": subject, "text": text}
)
return f"Status: {res.status_code}"