Human
Humans: ask a person, get an approval, send a notice, request a connection.
noclick.Human(*, email=None, phone=None, user=..., client=None)A person to reach. user.human (or noclick.Human(), meaning the
user current at each call, or the one a session or user-pinned key acts
for) is the user; noclick.Human.owner() is your account's owner;
noclick.Human(email=...) is anyone else.
Every method returns an Operation: .wait() for the outcome.
In an agent's tools=, a person gives the agent tools that notify them,
ask them, or hand them the conversation (only).
via says where a message goes: "auto" (the default), or a list of
"web" (only the page: you pass request.url on), "email", and for the
owner "whatsapp" and "imessage", sent from NoClick's own numbers to the
number they text NoClick from. "auto" is the app the owner last texted
NoClick on, else email. "sms" and "call" raise noclick.NotAvailable
for now. What couldn't be sent is listed in undelivered, never implied.
NoneNoneWho the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
None)Reach the person behind a user, or anyone by email:
user = noclick.User.from_id("user_42")
user.human.notify("Your export is ready. It's in your dashboard.")
noclick.Human(email="finance@acme.com").approve("Refund $95.00 to Ana Lima?")noclick.Human() is the user you're acting for, and the only way to
reach a person from a session or a key pinned to a user:
with noclick.as_user(noclick.User.from_id("user_42")):
noclick.Human().ask("Which time works for your cleaning?", options=["Thu 10:30", "Fri 14:00"])ownerclassmethod
noclick.Human.owner(*, client=None) -> HumanYour account's owner: the person behind the account, reached by email and on
the app they text NoClick from. Only your account reaches them: it always acts as
your account, inside as_user too, and a user's session or a key pinned to a user
raises noclick.PermissionDenied.
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
None)The owner, to message, ask, put in an agent's tools= or answer_with.
Tell the owner something on the app they text NoClick on:
noclick.Human.owner().notify("The site is live: https://morrowbakery.com")Or give an agent a way to reach them:
assistant = noclick.Agent.from_name(
"assistant", create_if_missing=True, instructions="You run the bakery's errands.",
tools=["search", noclick.Human.owner()],
)answer_withasync
human.answer_with(agent, *, conversation=None) -> HumanSend what this person texts or says to NoClick's own numbers (its WhatsApp and
iMessage numbers and its voice number) to agent (an noclick.Agent or id of your
account's). A text's reply goes back on the app they texted on once the agent's turn
ends, and texts sent while it's busy go in its next turn, in order; on a call, each thing
they say is a turn whose reply is read aloud as it's written. None hands them back to
NoClick's assistant. Only Human.owner() reaches NoClick's numbers: your users reach an
agent on a number of your own (PhoneNumber.answer_with).
conversation is the agent's conversation each text or call lands in, a template over
{channel} (whatsapp, imessage or call); omitted, "owner". Give an inbox
and a number the same key and the person's email, calls and texts are one conversation.
NoneThis person.
Make an agent the owner's assistant on every channel:
owner = noclick.Human.owner()
assistant = noclick.Agent.from_name("assistant")
owner.answer_with(assistant)
noclick.Inbox.from_name("assistant", create_if_missing=True, agent=assistant, senders="owner",
conversation="owner")
assistant.message("What's on today?", conversation="owner") # the same threadansweringasync
human.answering() -> Any | NoneThe agent this person's texts to NoClick's own numbers go to (answer_with), or
None when NoClick's assistant answers them.
The noclick.Agent, or None.
agent = noclick.Human.owner().answering()
print(agent.name if agent else "NoClick's assistant")reachasync
human.reach() -> OwnerReachNoClick's own numbers the owner texts it on, whether a phone of theirs is linked
(never which), and the address they email their assistant at (email, None
before it has one). Show a number only once a phone is linked: a text from a phone the
account hasn't linked starts an account of its own, and linking one is the owner's,
signed in to NoClick. Your account's own key reads it, never a user's.
reach = noclick.Human.owner().reach()
if reach.phone_linked:
for line in reach.lines:
print(f"{line.app}: {line.number}")set_timezoneasync
human.set_timezone(timezone) -> NoneWhere the signed-in owner is, from their browser (an IANA zone such as "Europe/London"):
the clock of the account's assistant, and of each of its own agents NoClick placed, moves
there; a zone chosen through the API stays. The signed-in owner's alone: a key raises
noclick.PermissionDenied.
noclick.Human.owner().set_timezone("Europe/London")claim_email_addressasync
human.claim_email_address() -> OwnerEmailAddress | NoneThe address the owner emails their assistant at (reach().email), claiming a
readable one, from their own address, the first time it's wanted; None where NoClick
takes no mail. The signed-in owner's alone: a key raises noclick.PermissionDenied.
The noclick.OwnerEmailAddress, or None.
mail = noclick.Human.owner().claim_email_address()
print(f"Email your assistant at {mail.address}" if mail else "No email here")rename_email_addressasync
human.rename_email_address(name) -> OwnerEmailAddressRenames the address the owner emails their assistant at to name (the part before
the @) on its domain, keeping whether its mail is taken; claimed at that name where it had
none. Mail to the old address no longer reaches the assistant. Raises
noclick.Conflict when the name is someone else's and noclick.InvalidRequest for a
name no address takes. The signed-in owner's alone.
The noclick.OwnerEmailAddress at its new name.
mail = noclick.Human.owner().rename_email_address("bakery-desk")
print(mail.address) # bakery-desk@noclick.emailadd_emailasync
human.add_email(email) -> NoneSend a code to email for the owner of an account made by texting NoClick (which
has none); confirm_email with the code makes it theirs. Raises
noclick.Conflict when the account already has an email, noclick.RateLimited
after too many codes.
owner = noclick.Human.owner()
owner.add_email("maya@morrowbakery.com")
owner.confirm_email(input("The code in that email: "))confirm_emailasync
human.confirm_email(code) -> OwnerEmailThe code add_email sent: on a match the email is the owner's to sign in with,
or, when an account already has it, that account takes this one in (merged).
Whether an account has the email is said only once the code matches.
The confirmed email.
confirmed = noclick.Human.owner().confirm_email("482913")
print(confirmed.email, "merged" if confirmed.merged else "added")only
human.only(*tools) -> HumanOperationsSome of the tools this person gives an agent, for tools=. In an agent's tools
a Human gives it three, each addressed only to this person: notify (a
message), ask (a question, with options if it has some, or a pick from one of
their connected accounts: the turn waits,
awaiting_human, and the answer arrives as the conversation's next turn) and
hand_off (the conversation goes to this person: a page and an email with the
transcript, the agent's summary and a reply box; their replies post as person
messages, the agent stays quiet until agent.hand_back(conversation), and on a
call it's transferred to the person's phone). Policy names them
human.notify, human.ask and human.hand_off.
noclick.Human() there is the user each turn acts for; user.human is that user;
noclick.Human.owner() is your account's owner and noclick.Human(email=..., phone=...)
anyone else, neither of which a user's own agent may name.
A ref to just those tools of this person, to list in tools=.
Let a support agent ask a manager before a big refund, but never hand them the chat:
manager = noclick.Human(email="ops@acme.com", phone="+14155550123")
support = noclick.Agent.from_name(
"support", create_if_missing=True,
instructions="You answer billing questions. Ask the manager before refunding over $200.",
tools=["stripe.create_refund", manager.only("notify", "ask")],
)Or let it hand an upset customer to a person, who replies from their page:
person = noclick.Human(email="support-lead@acme.com")
support = noclick.Agent.from_name(
"support", create_if_missing=True,
instructions="Hand the conversation to a person when the customer asks for one.",
tools=["search", person.only("hand_off")],
)askasync
human.ask(
message, *, options=None, pick=None, multiple=False, connect=None, secret=None,
via='auto', expires_in=None
) -> HumanRequestAsk a question; .wait() returns an Answer.
pick asks, in place of options, for something in a connected account:
{"connection": ..., "field": ..., "arguments": ...}, the connection (a Connection,
or its id or name) and the field its lookup lists (connection.lookup names them:
repository, team_id, channel), with the values that field depends on. NoClick
reads the choices from the account, the person picks from it, and an account that holds
just one answers at once with it, asking nobody. multiple lets them choose several of
the options, or of a pick's choices.
connect asks the owner which of the account's connections a workflow step uses:
{"integration": "slack", "step": {"workflow": wf, "step_id": "post"}} (or
credential_type in place of integration; step["slot"] narrows it to one kind).
Their page lists the connections that fit and connects another with the provider's own
sign-in; NoClick sets the one they choose on the step as them, never as you, and an account
holding just one that fits answers at once with it. Needs the workflows scope.
secret asks for a secret's values: {"name": "warehouse", "keys": ["WAREHOUSE_TOKEN"]},
typed on NoClick's page (its link carries a key, so the request's id alone opens nothing),
kept as the account's secret name (made, or those keys replaced) and never shown to you
or a model; with "step": {"workflow": wf, "step_id": "agent"} (the owner's only), the
agent step's shell gets it too. Needs the secrets scope. Your code can answer either
with HumanRequest.answer.
NoneNoneFalseNoneNone'auto'NoneThe request, already sent. wait() blocks until the person answers
and gives what they picked (choice, a pick's value beside it; each of
several in choices and values) and wrote (text).
Offer choices, then wait for the pick:
human = noclick.User.from_id("user_42").human
request = human.ask(
"Which time works for your cleaning?", options=["Thu 10:30", "Fri 14:00", "Neither"],
)
answer = request.wait()
print(answer.choice or answer.text)Ask which repositories, from the person's own GitHub:
answer = noclick.Human.owner().ask(
"Which repositories should the reviewer watch?",
pick={"connection": "github", "field": "repository"}, multiple=True,
).wait()
print(answer.values) # ['acme/site', 'acme/api']With via=["web"] nothing is sent: pass the answer page on
yourself. expires_in is in seconds (or a timedelta):
human = noclick.User.from_id("user_42").human
request = human.ask("What should we call your workspace?", via=["web"], expires_in=3600)
print(request.url)Ask the owner which Slack a step posts with, and for the token an agent step needs:
wf = noclick.Workflow.from_id("wf_123")
owner = noclick.Human.owner()
slack = owner.ask("Which Slack should the Post step use?",
connect={"integration": "slack", "step": {"workflow": wf, "step_id": "post"}})
token = owner.ask("The warehouse API token, please.",
secret={"name": "warehouse", "keys": ["WAREHOUSE_TOKEN"],
"step": {"workflow": wf, "step_id": "agent"}})
print(slack.wait().connection, token.wait().secret)approveasync
human.approve(message, *, details=None, via='auto', expires_in=None) -> HumanRequestAsk for a yes/no; .wait() returns True when approved.
None'auto'NoneThe request, already sent. wait() gives True if they approve
and False if they decline.
Put what the person needs to decide in details; it's shown on the page:
finance = noclick.Human(email="finance@acme.com")
approved = finance.approve(
"Refund $95.00 to Ana Lima?",
details={"invoice": "INV-1042", "reason": "Charged for a cancelled visit"},
).wait()
if approved:
issue_refund()In a web server, save the request's id and pick the answer up later:
request = noclick.User.from_id("user_42").human.approve("Publish the new pricing page?")
save(request.id)
approved = noclick.Operation.from_id(saved_id).wait() # later, from anywherenotifyasync
human.notify(message, *, via='auto') -> HumanRequestSend a notice (the operation succeeds once it's sent).
'auto'The request, already sent and its operation already succeeded, so
wait() returns None at once. undelivered names any channel that failed.
human = noclick.User.from_id("user_42").human
human.notify("Your export is ready. It's in your dashboard.")connectasync
human.connect(connection, *, reason=None, redirect_url=None) -> ConnectLinkAsk this person to connect connection (a Connection or its
name, this person's own); .wait() returns the connected
Connection.
NoneNoneThe link, already emailed: its url and when it expires_at.
wait() gives the connected Connection.
Email the user a link to connect their calendar, and wait until they have:
user = noclick.User.from_id("user_42")
calendar = noclick.Connection.from_name(
"calendar", integration="google_calendar", create_if_missing=True, user=user,
)
calendar = user.human.connect(calendar, reason="to book your appointments").wait()A connection the user already has can be named instead:
user = noclick.User.from_id("user_42")
user.human.connect("calendar", redirect_url="https://app.example.com/settings")HumanRequest
class HumanRequest(Operation)A request to a person; also the operation that finishes when they answer.
- Inherits from Operation.
| request_id | str | None | The request's own id (the operation's is |
| request_status | str | None |
|
| request | dict[str, Any] | The request as created: |
| url | str | None | The page where the person answers ( |
| delivered_via | list[str] | |
| undelivered | list[dict[str, Any]] | Channels that failed, each with a |
| file | HumanFileAsk | None | A file question's file where the agent works ( |
| note | str | None | What the approver wrote with their answer ( |
listclassmethodasync
noclick.HumanRequest.list(
*, status=None, status_not=None, kind=None, answerable=None, limit=None,
user_filter=None, user=..., client=None
) -> list[HumanRequest]Requests your code and agents sent, newest first (or the first limit).
answerable="owner": only those the signed-in account owner may answer;
answerable="code": only those your code may answer with approve or
decline. A call NoClick holds for the account's owner (a purchase or a
deletion, whose request["owner_only"] is true) is listed only for a key that
names the approvals:answer scope, and never one made with that key or one
whose terms a person accepts (see noclick.Approval).
NoneNoneNoneNoneReturn at most this many.
None)Which users a read covers: noclick.ALL_USERS, noclick.NO_USER, a User, or your id for one. It filters without acting as that user.
None)Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
None)Every matching request, fetched page by page. Each is also the
operation you can wait() on; request_status is the request's own status.
for request in noclick.HumanRequest.list(status="pending", kind="approve"):
print(request.request["message"], request.url)
waiting_on_you = noclick.HumanRequest.list(answerable="owner")
yours_to_answer = noclick.HumanRequest.list(status="pending", kind="approve", answerable="code")list_pageclassmethodasync
noclick.HumanRequest.list_page(
*, cursor=None, limit=None, status=None, status_not=None, kind=None,
answerable=None, user_filter=None, user=..., client=None
) -> PageOne page of requests; pass next_cursor back as cursor.
The next_cursor of the page before; omit it for the first page.
None)Return at most this many.
None)NoneNoneNoneNoneWhich users a read covers: noclick.ALL_USERS, noclick.NO_USER, a User, or your id for one. It filters without acting as that user.
None)Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
None)A page whose data holds the requests and whose next_cursor is None on the last page.
page = noclick.HumanRequest.list_page(status="pending", limit=50)
while True:
for request in page.data:
print(request.request_status, request.url)
if page.next_cursor is None:
break
page = noclick.HumanRequest.list_page(status="pending", limit=50, cursor=page.next_cursor)retrieveclassmethodasync
noclick.HumanRequest.retrieve(request_id, *, user=..., client=None) -> HumanRequestOne request by its own id (a request_id, the /h/ page's): what it asks, how it stands
(request_status) and, once answered, the answer. A user reads only their own; any other raises
noclick.NotFound. Answer it with answer, approve or decline.
Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
None)The request.
request = noclick.HumanRequest.retrieve("hr_3f2a1c9e")
if request.request_status == "pending":
request.approve(note="Go ahead")summaryclassmethodasync
noclick.HumanRequest.summary(**filters) -> OperationSummaryHow many human-request operations (ask, approve, notify) match, by operation
status; takes Operation.summary's filters except kind.
The number that match in total, and per operation status in by_status.
counts = noclick.HumanRequest.summary(status="live")
print(counts.total, counts.by_status)answerasync
request.answer(
*, choice=None, choices=None, text=None, connection=None, secret_values=None,
file_content=None
) -> HumanRequestAnswer a question from your own code, as the person it waits on (who may: as approve
says). A question takes a choice (or choices for one asked with multiple) and/or
text; a connect question, a connection (a Connection, or its ref or name: one of
the account's that fits), which NoClick sets on the step as your key, so it needs the
workflows scope and a key acting for your whole account, never a user's or an agent's own
tools; a secret question, secret_values (a value for each of its keys), kept in the
secret and never with the answer, which needs the secrets scope. A file question is the
account's owner's alone, signed in: secret_values for its keys, else file_content (the
whole file as text, up to 1 MB), written into the asking agent's sandbox or machine while it runs
and never kept with the answer.
NoneNoneNoneNoneNoneNoneThis request, answered: request_status is answered.
for request in noclick.HumanRequest.list(status="pending", kind="ask", answerable="code"):
if request.request.get("connect"):
request.answer(connection="work-slack")approveasync
request.approve(*, note=None) -> HumanRequestApprove it from your own code, as the person it waits on: with a key acting for your
account, an approval routed to your account (a held call on one of its connections, say);
with a user's session or inside as_user, one addressed to that user. A held operation call
then runs exactly as it was held (a held shell command or other tool, the agent makes again
itself), and the agent gets a turn in the same conversation with its result, its reply going
out wherever the conversation lives (the chat, the call, or on an email thread the same
thread: an inbox agent's reply tool is bound to the thread's latest message, not to the
message that woke a turn). A call NoClick holds for the account's owner is answered only
with a key that names the approvals:answer scope, as noclick.Approval.approve answers
it. Anyone else gets noclick.PermissionDenied.
NoneThis request, answered: request_status is answered and note is yours.
for request in noclick.HumanRequest.list(status="pending", kind="approve", answerable="code"):
if request.request["details"].get("amount_usd", 0) < 50:
request.approve(note="Under $50: fine.")declineasync
request.decline(*, note=None) -> HumanRequestDecline it from your own code, as approve answers it. A held call never runs; the agent
gets a turn saying it was declined, with your note, so it can tell the person it was
acting for why.
NoneThis request, answered: request_status is answered and note is yours.
[request] = noclick.HumanRequest.list(status="pending", kind="approve", answerable="code", limit=1)
request.decline(note="Refunds over $500 go through finance; ask the customer for the invoice.")HumanOperations
class HumanOperationsSome of a person's tools for an agent (human.only(...)), for tools=.
| human | Human | |
| tools | list[str] |
Answer
class AnswerWhat the person chose (choice) and/or wrote (text). A pick's answer names the
choice in the account too (value: a repository's owner/name, a channel's id); a question
asked with multiple names each one they chose (choices, and a pick's values). A
connect question's names the connection set on the step (connection, its ref, also its
value; choice its name), a secret question's the secret its values went into
(secret), never the values.
| choice | str | None | |
| text | str | None | |
| raw | Any | The response JSON exactly as the API sent it. |
| value | str | None | |
| choices | list[str] | |
| values | list[str] | |
| connection | str | None | |
| secret | str | None |
HumanFileAsk
class HumanFileAskA file in the asking agent's sandbox or machine its owner fills in (HumanRequest.file): a local .env,
a key file. Only an agent's own ask tool asks one, and only the account's owner answers it: with keys, a
value for each (set in the file as KEY=value lines, the rest of it kept); without (keys None), the
whole file. NoClick writes it at path there as a file holding secrets, never keeping it anywhere else.
| path | str | |
| keys | list[str] | None | |
| agent_id | str | |
| agent_name | str | None |
OwnerEmail
class OwnerEmailAn email confirmed for the owner: status is added, or verified when an
agent's turn confirmed it (it's added once that turn ends); merged when an account
that already had the email takes this one in.
| str | ||
| status | str | |
| merged | bool |
OwnerLine
class OwnerLineOne of NoClick's own numbers the owner texts it on (Human.reach): app is
whatsapp or imessage.
| app | str | |
| number | str |
OwnerReach
class OwnerReachWhere the owner texts NoClick (Human.reach): NoClick's own numbers, one for each app
it answers on, whether a phone of the owner's is linked to the account (which one is never
said), and the address they email their assistant at (None before it has one).
| lines | list[OwnerLine] | |
| phone_linked | bool | |
| OwnerEmailAddress | None |
HumanRequestLink
noclick.HumanRequestLink(
request_id, *, key=None, base_url=None, timeout=60.0, max_retries=3
)A human request's page (/h/), as the person its link reached reads and answers it. The id is the
capability; the link NoClick sends its person carries a key beside it (?k=), which a request asked of the
account's owner, one only its person answers and a held call's approval need: pass it as key. Who may answer
is NoClick's to judge, as on its own page: a request the link can't open raises noclick.NotFound, and an
answer it doesn't take raises with its reason.
NoneNone60.03link = noclick.HumanRequestLink(request_id, key=key_from_the_link)
if link.read().kind == "approve":
link.answer({"decision": "approve"})| id | str | |
| key | str | None |
readasync
human_request_link.read() -> HumanRequestPageThe request as its page shows it.
page = noclick.HumanRequestLink(request_id, key=key).read()
print(page.kind, page.message)answerasync
human_request_link.answer(body) -> dict[str, Any]Answer it, once: a question's choice (or choices) and text, an approval's decision
(approve or deny); a held call's approved, note and each of its terms accepted; a step
question's connection or values. Raises with the reason an answer isn't taken (already answered,
expired, not this link's to give).
The request as it stands once answered.
noclick.HumanRequestLink(request_id, key=key).answer({"choice": "Yes"})connectasync
human_request_link.connect(*, credential_type=None) -> strA connect question's other account: the provider's sign-in link, which comes back to the request's page and
whose account answers the question. credential_type: which of its ways to sign in.
NoneThe sign-in link to open.
url = noclick.HumanRequestLink(request_id, key=key).connect()replyasync
human_request_link.reply(text) -> dict[str, Any]Reply in the conversation an agent handed this link's person.
The request as it stands.
noclick.HumanRequestLink(request_id, key=key).reply("I'll take it from here.")hand_backasync
human_request_link.hand_back() -> dict[str, Any]Give the handed-over conversation back to the agent, which answers from the next message.
The request as it stands.
noclick.HumanRequestLink(request_id, key=key).hand_back()HumanRequestPage
class HumanRequestPageA human request as its page shows it (HumanRequestLink.read): its kind (ask, approve,
notify, hand_off, setup, ...), its status (pending until it's answered), its message, when it
expires, and in raw everything the page shows (its options, its brand, a held call's approval, a step
question, a hand-off).
| id | str | |
| kind | str | |
| status | str | |
| message | str | None | |
| expires_at | datetime | None | |
| raw | dict[str, Any] | The response JSON exactly as the API sent it. |
OwnerEmailAddress
class OwnerEmailAddressThe address the owner emails their assistant at (OwnerReach.email): paused when
the owner turned its mail off (the address stays theirs), from_anyone when anyone's mail
reaches the assistant, not only the owner's.
| address | str | |
| paused | bool | |
| from_anyone | bool |