The LLMClient lets you connect to the ATP Agent Server, retrieve toolkit context, and execute tools or workflows using JSON payloads—perfect for LLM-based agents.It supports:
import openaifrom atp_sdk.clients import LLMClientopenai_client = openai.OpenAI(api_key="YOUR_OPENAI_API_KEY")llm_client = LLMClient(api_key="YOUR_ATP_LLM_CLIENT_API_KEY")# Get toolkit contextcontext = llm_client.get_toolkit_context( toolkit_id="your_toolkit_id", provider="openai", user_prompt="Create a company and then list contacts.")# Use OpenAI to generate tool callsresponse = openai_client.chat.completions.create( model="gpt-4o", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Create a company and then list contacts."} ], tools=context["tools"], tool_choice="auto")# Extract and execute tool callstool_calls = response.choices[0].message.tool_callsif tool_calls: result = llm_client.call_tool( toolkit_id="your_toolkit_id", tool_calls=tool_calls, provider="openai", user_prompt="Create a company and then list contacts." ) print(f"Tool call result: {result}")
import anthropicfrom atp_sdk.clients import LLMClientanthropic_client = anthropic.Anthropic(api_key="YOUR_ANTHROPIC_API_KEY")llm_client = LLMClient(api_key="YOUR_ATP_LLM_CLIENT_API_KEY")# Get toolkit contextcontext = llm_client.get_toolkit_context( toolkit_id="your_toolkit_id", provider="anthropic", user_prompt="Create a company and then list contacts.")# Use Anthropic to generate tool callsresponse = anthropic_client.messages.create( model="claude-3-opus-20240229", max_tokens=1024, messages=[ {"role": "user", "content": "Create a company and then list contacts."} ], tools=context["tools"])# Extract and execute tool callstool_calls = response.contentif tool_calls[-1].type == "tool_calls": result = llm_client.call_tool( toolkit_id="your_toolkit_id", tool_calls=tool_calls[-1].content, provider="anthropic", user_prompt="Create a company and then list contacts." ) print(f"Tool call result: {result}")
from mistralai.client import MistralClientfrom atp_sdk.clients import LLMClientmistral_client = MistralClient(api_key="YOUR_MISTRAL_API_KEY")llm_client = LLMClient(api_key="YOUR_ATP_LLM_CLIENT_API_KEY")# Get toolkit contextcontext = llm_client.get_toolkit_context( toolkit_id="your_toolkit_id", provider="mistralai", user_prompt="Create a company and then list contacts.")# Use Mistral to generate tool callsresponse = mistral_client.chat( model="mistral-large-latest", messages=[{"role": "user", "content": "Create a company and then list contacts."}], tools=context["tools"])# Extract and execute tool callstool_calls = response.choices[0].message.tool_callsif tool_calls: result = llm_client.call_tool( toolkit_id="your_toolkit_id", tool_calls=tool_calls, provider="mistralai", user_prompt="Create a company and then list contacts." ) print(f"Tool call result: {result}")