Skip to main content

AbsTime Python API Library

AbsTime resolves natural language time expressions for AI systems.

Built for agents, assistants, and workflows that need accurate time resolution.

This library provides convenient access to the AbsTime REST API from Python.

Install

pip install abstime

Quickstart

import os

from abstime import AbsTime

client = AbsTime(api_key=os.environ["ABSTIME_API_KEY"])

result = client.resolve(
    text="the last Friday of this month at 2 pm",
    ref_time="2026-04-09T17:30:00Z",
    ref_timezone="America/Los_Angeles",
)

print(result.time)
print(result.view)
# 2026-04-24T21:00:00Z
# Apr 24, 2026 2 PM

Output

The core result fields are:

Field Meaning Example Use
time Resolved UTC timestamp 2026-04-24T21:00:00Z Store, compare, or pass to downstream systems
view Human-readable local time Apr 24, 2026 2 PM Show the result in user interfaces
confidence Resolution confidence signal C0 Guide result presentation and handling

Understand confidence:

  • C0: a clear resolution; safe to use directly.
  • C1: less obvious but the most reasonable resolution; still safe to use directly.
  • C2: sometimes arguable; user confirmation is recommended.

Input

The core input fields are:

Field Meaning Use Instead of
text Natural language time expression two days before Christmas Schedule a meeting with Lily two days before Christmas.
ref_time UTC reference time 2026-04-09T17:30:00Z 2026-04-09T10:30:00-07:00
ref_timezone IANA reference timezone America/Los_Angeles PST

Handling Errors

When the library is unable to connect to the API, for example due to a network failure or timeout, an abstime.APIConnectionError is raised.

When the API returns a non-success status code, a subclass of abstime.AbsTimeError is raised.

import abstime

client = abstime.AbsTime()

try:
    result = client.resolve(
        text="the last Friday of this month at 2 pm",
        ref_time="2026-04-09T17:30:00Z",
        ref_timezone="America/Los_Angeles",
    )
except abstime.InputError as exc:
    print(f"Invalid input: {exc}")
except abstime.RateLimitError as exc:
    print(f"Request ID: {exc.request_id}")
except abstime.APIConnectionError:
    print("The API could not be reached.")

Error codes are as follows:

Status Code Error
400 InputError
401 AuthenticationError
403 PermissionDeniedError
429 RateLimitError
>=500 InternalError
N/A APIConnectionError

Request IDs

All successful responses provide a request_id from the X-Request-Id response header.

print(result.request_id)

For failed requests, catch the error and read exc.request_id:

import abstime

try:
    client.resolve(
        text="the last Friday of this month at 2 pm",
        ref_time="2026-04-09T17:30:00Z",
        ref_timezone="America/Los_Angeles",
    )
except abstime.AbsTimeError as exc:
    print(exc.request_id)

Retries and Timeouts

The client retries certain transient failures once by default with a short backoff.

Requests time out after 15 seconds by default.

You can configure both when creating the client.

client = abstime.AbsTime(
    timeout=5,
    max_retries=0,
)

Async Usage

Import AsyncAbsTime instead of AbsTime and use await with each call:

import asyncio

from abstime import AsyncAbsTime

client = AsyncAbsTime()


async def main() -> None:
    result = await client.resolve(
        text="the last Friday of this month at 2 pm",
        ref_time="2026-04-09T17:30:00Z",
        ref_timezone="America/Los_Angeles",
    )
    print(result.time)


asyncio.run(main())

The synchronous and asynchronous clients are otherwise identical.

Requirements

  • Python 3.9+

Docs

See docs.abstime.ai for the full API contract, response details, and integration guides.

Metadata

Release files for abstime 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for abstime 0.1.0
File Size Uploaded Provenance
abstime-0.1.0.tar.gz 8.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for abstime 0.1.0
File Interpreter ABI Platform
abstime-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.0 kB

Release files / abstime-0.1.0.tar.gz

Download URL abstime-0.1.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
629ac26804130ca059a124e27061bd019fc7648a99f89058dfc4305056776072
BLAKE2b-256 checksum
How to use checksums
275bb9b2e88f1e23755500352feba8fbbc4de80e6a4dc7a509c577c98d69e634
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release files / abstime-0.1.0-py3-none-any.whl

Download URL abstime-0.1.0-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3cb85ac445dde821a2f5ee2d5a9aa7daa611716808b7272983e03f14548e6bf4
BLAKE2b-256 checksum
How to use checksums
d023ddec15aaf124b0d98c98eb0307f1c076c5bf5f2b307c0ced50ca3caa75b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Security for abstime 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page