Expand description
Rust SDK for OpenIntents, the agentic API to buy anything. Send an intent in plain language; the API does the agentic work in a real browser, gets it paid (from your agent balance, or a payment link) and resolves to a receipt.
use openintents::{Client, CreateIntent, IntentStatus};
let oi = Client::from_env()?;
let intent = oi
.create_intent(CreateIntent::new("book an Uber to SFO at 7am").max_amount(6000))
.await?;
let intent = oi.wait(&intent.id, Default::default()).await?;
match intent.status {
IntentStatus::RequiresPayment => println!("pay: {}", intent.payment.unwrap().payment_url),
IntentStatus::Completed => println!("done: {:?}", intent.result),
other => println!("ended as {}", other.as_str()),
}Preview: the API is still being built and may change before launch.
Re-exports§
pub use webhooks::sign_webhook;pub use webhooks::verify_webhook;pub use types::*;pub use types_v1::*;
Modules§
- types
- Types for the OpenIntents v1 API. Source of truth:
spec/openapi.yaml. Unknown fields are ignored and unknown enum values map toUnknown, so new API fields never break older SDK versions. - types_
v1 - Portal sessions, secrets, sign-ins, live links and webhook endpoints.
Source of truth:
spec/openapi.yaml. Likecrate::types, unknown fields are ignored and unknown enum values map toUnknown. - webhooks
- Verify OpenIntents webhook signatures.
Structs§
- Client
- Client for the OpenIntents agentic API.
- Client
Builder - Configures a
Client. - Event
Stream - An intent’s or a session’s timeline: past events first, then new ones as
they happen. A stream that closes or drops is resumed after the last event
received (
Last-Event-ID) until the API answers204: the timeline is over and every event was sent. Connections that fail before sending anything are retried like any request; an error ends the stream. - Wait
Options - Options for
Client::wait.
Enums§
- Error
- Errors from the client.