The client¶
ArangoAIClient is the entry point to the SDK. You
construct it once with your credentials, and every area of the SDK is a
namespace on it: client.project, client.secret_profile and
client.files today.
Everything that belongs to one project happens on an
AiProjectHandle obtained from client.project, for
example sales.autograph to deploy AutoGraph. See Projects and
AutoGraph.
Creating a client¶
from arango_ai_sdk import ArangoAIClient
client = ArangoAIClient(
base_url="https://<your-deployment>:8529",
username="<username>",
password="<password>",
db_name="_system", # optional, this is the default
)
base_urlThe full endpoint of your deployment, port included, exactly as the deployment publishes it.
username,passwordThe account to authenticate with. The password is held in memory for the client’s lifetime because token renewal needs it. It is never exposed again; there is deliberately no
passwordproperty.db_nameThe database to connect to. Defaults to
_system.verifyTLS certificate verification, keyword only.
True(the default) checks the deployment’s certificate against the system’s trusted authorities; a path names a CA bundle to use instead;Falsedisables the check, for deployments that publish a self-signed certificate.
One client, one database, any number of projects¶
A client is the connection: one endpoint, one account, one database, one token
shared by everything built on it. It is not bound to a project. You create or
fetch projects through client.project and get back a handle for each one:
sales = client.project.create(project_name="sales", project_type="autograph")
support = client.project.get(project_name="support")
Both handles share the client’s connection, so working with ten projects means ten handles under one client, not ten sign-ins. Everything project-scoped lives on the handle; nothing on the client asks you which project you mean.
Reading back the configuration¶
The client exposes what it was constructed with as read-only properties:
base_url, username and db_name. The password is not readable.
One thread at a time¶
A client, and everything reached through it, is meant to be used from one thread at a time. To upload or query in parallel, give each thread its own client: each signs in on its own and they share no state.
Closing the client¶
client.close()
close() releases the HTTP sessions and sockets the client keeps open. Call it
when you are done, typically in a finally block. Calling it more than once is
safe.
What can fail at construction¶
Signing in happens inside the constructor, so these problems surface immediately rather than on your first real call:
InvalidCredentialsErrorThe deployment rejected the username or password, or the account cannot access the database.
DatabaseNotFoundErrordb_namedoes not exist on the deployment.PlatformUnreachableErrorThe deployment could not be reached within the retry budget.
See Errors for the complete list.