GreenPT Docs

Mangrove

GreenPT's agent endpoint: send a task, and Mangrove searches, reads, transcribes and answers.

Mangrove is GreenPT's agent endpoint. A chat completion returns one reply from a model; Mangrove takes a whole task and carries it out. It decides which tools the task needs, uses them, checks its own answer, and returns the result. You send one request to POST /v1/agents/runs with your usual GreenPT API key, and there is no agent loop, tool wiring or orchestration to build on your side.

Mangrove can search the web and read the pages it finds, parse documents, look at images, transcribe meeting recordings, hand back files and remember values between runs. A run is asynchronous: the request returns an agentId straight away, and you poll or stream that run for its progress and final answer. Runs are paid from your API credits, by what each one uses; see Billing & limits.

How a run works

Send a task

POST /v1/agents/runs with a question, plus a file or a link when the question is about one. You get an agentId back at once.

Follow it

Poll the run, or stream its steps as Server-Sent Events while Mangrove searches, reads and checks its work.

Read the answer

A finished run is succeeded, or awaiting_input when it needs something only you can provide. Either way it stays readable for 24 hours.

How runs work covers each phase in detail.

What are agents?

By now you're most likely familiar with the concept of an "AI chat" (or "LLM completion"). This generally looks like so:

User: Hey, are you naturally intelligent?
Agent:  No, I'm artificially intelligent.

An "agent" is essentially this dialogue, but carried on by the system itself. In this made up example, to see if it knows what intelligence means, and what naturally means in that sense, and so on... So we're talking about "agents" because they can autonomously decide whether to look something up, and whether more work makes sense.

What makes an agent capable is the tools it has, the tools that a developer gives to it. (Our example was a bit too simplified. A capable LLM wouldn't need to use tools or extra capacities to know what intelligence means.) For instance, a model can search internet, or transcribe audios, or generate documents for you... given that a software developer implemented these and integrated them with the agent.

We're enthusiastic about this technology, so we'd like to make it easier for you to do this.

What you can do with it

  • Research a topic: ask a question with no extra input — Mangrove searches the web and cites what it finds.
  • Summarize a document or chart: pass documentUrl (or upload the file directly) alongside a question about it.
  • Understand a screenshot or photo: upload an image, or point documentUrl at one — Mangrove looks at it directly rather than running OCR, so it can describe layout, charts, and visual content OCR would miss.
  • Summarize a meeting: pass audioUrl (or upload the recording) for a speaker-attributed summary, decisions, and action items.
  • Take the answer away as a file: ask for the output as a CSV, a markdown summary, or a JSON blob, and Mangrove answers with a download link — see Case 4.
  • Compare against a previous run: ask Mangrove to remember a value under a name, then ask for it again on a later run to compare against what it saved before.
  • Follow up on an answer: start another run quoting the part of the previous answer you want built on — see Asking a follow-up.

Run when the grid is cleanest

A run that can wait may start up to 24 hours late. Send greenShiftWindowHours and Mangrove starts it at the cleanest hour in that window. See Carbon Aware.

Where to go next

Why we built it

More than a year ago Thomas Ptacek of Fly.io wrote:

[To grasp some] technologies, you need to get your feet on the pedals first. Get on this bike and push the pedals.

By then, we were already pushing the pedals for a long while. Since then, we've built many agents, for ourselves and for our partners. As our work changed, we've become proverbial bicycle makers :-)

We're nerds, so we're having fun getting on this bike, pedaling, and taking our bike apart in the weekend and cleaning up, and putting it back neatly... And it does indeed help grasping the technology.

We're also nerds that want to solve problems of our customers and partners. While we're always happy to have you over at "our shop" and tinker with things together... we think building agents must be easy for you. So we've built something for you!

Feedback about API? Join our Discord and let us know!

On this page